OSDN Git Service

untabify
authorKoji Arai <jca02266@gmail.com>
Tue, 3 Jun 2008 14:27:58 +0000 (23:27 +0900)
committerKoji Arai <jca02266@gmail.com>
Tue, 3 Jun 2008 14:27:58 +0000 (23:27 +0900)
ar.c
encode.c
filelib.c
header.c
pathlib.c
strlib.c

diff --git a/ar.c b/ar.c
index 37bbdc4..bf4bd0e 100644 (file)
--- a/ar.c
+++ b/ar.c
@@ -500,7 +500,7 @@ main(int argc, char *argv[])
         case 'p':
             if (found != 0) {
                 rp->fp = arcfile;
-               rp->compsize = h.compsize;
+                rp->compsize = h.compsize;
                 extract(rp, cmd == 'x', &h);
                 if (++count == nfiles)
                     done = 1;
index 01df926..ec26683 100644 (file)
--- a/encode.c
+++ b/encode.c
@@ -327,7 +327,7 @@ get_next_match(struct lzh_ostream *wp, FILE *rfp, struct match_t *match)
     if (++pos == DICSIZ * 2) {
         memmove(&text[0], &text[DICSIZ], DICSIZ + MAXMATCH);
         n = fread_crc(&text[DICSIZ + MAXMATCH], DICSIZ, rfp, &wp->crc);
-       wp->origsize += n;
+        wp->origsize += n;
         remainder += n;
         pos = DICSIZ;
         if (wp->fp != stdout && opts.quiet < 1) {
index b1bee8d..61f39df 100644 (file)
--- a/filelib.c
+++ b/filelib.c
@@ -53,13 +53,13 @@ copy_stream(FILE *rfp, FILE *wfp)
     char buf[BUFSIZ];
 
     while ((readsz = fread(buf, 1, sizeof(buf), rfp)) != 0) {
-       if (fwrite(buf, readsz, 1, wfp) == 0) {
-           return -1;
-       }
+        if (fwrite(buf, readsz, 1, wfp) == 0) {
+            return -1;
+        }
     }
 
     if (ferror(rfp)) {
-       return -1;
+        return -1;
     }
 
     return 0;
@@ -71,7 +71,7 @@ move_file_to_stream(char *file, FILE *wfp)
     FILE *rfp = NULL;
 
     if ((rfp = fopen(file, "r")) == NULL)
-       goto err;
+        goto err;
 
     copy_stream(rfp, wfp);
 
@@ -92,10 +92,10 @@ xrename(char *from, char *to)
     FILE *rfp = NULL, *wfp = NULL;
 
     if ((rfp = fopen(from, "r")) == NULL)
-       goto err;
+        goto err;
 
     if ((wfp = fopen(to, "w")) == NULL)
-       goto err;
+        goto err;
 
     copy_stream(rfp, wfp);
 
index 18ab3cd..c46b33e 100644 (file)
--- a/header.c
+++ b/header.c
@@ -700,7 +700,7 @@ write_header_lv2(FILE *fp, struct lzh_header *h)
 
     {
         int i;
-       unsigned int crc;
+        unsigned int crc;
 
         crc = INIT_CRC;
         for (i = 0; i < headersize; i++)
index 287080d..c4ad315 100644 (file)
--- a/pathlib.c
+++ b/pathlib.c
@@ -48,16 +48,16 @@ xbasename(char *path)
 
     len = strlen(path);
     if (len == 0)
-       return path;
+        return path;
     if (len == 1 && path[0] == '/')
-       return path;
+        return path;
     if (path[len-1] == '/')
-       path[len-1] = '\0';
+        path[len-1] = '\0';
 
     for (p1 = p2 = path; *p1 != '\0'; p1++) {
-       if (*p1 == '/') {
-           p2 = p1 + 1;
-       }
+        if (*p1 == '/') {
+            p2 = p1 + 1;
+        }
     }
 
     return p2;
@@ -74,23 +74,23 @@ dirname(char *path)
 
     len = strlen(path);
     if (len == 0)
-       return current;
+        return current;
     if (len == 1 && path[0] == '/')
-       return path;
+        return path;
     if (path[len-1] == '/')
-       path[len-1] = '\0';
+        path[len-1] = '\0';
 
     for (p1 = p2 = path; *p1 != '\0'; p1++) {
-       if (*p1 == '/') {
-           p2 = p1;
-       }
+        if (*p1 == '/') {
+            p2 = p1;
+        }
     }
     if (*p2 == '/' && p2 == path)
-       p2++;
+        p2++;
     *p2 = '\0';
 
     if (path[0] == '\0')
-       return current;
+        return current;
 
     return path;
 }
@@ -147,7 +147,7 @@ makepath(char *dest, int dest_size,
 
 #include <stdio.h>
 #define basename glibc2_basename
-#include <string.h>            /* strdup() */
+#include <string.h>             /* strdup() */
 #undef basename
 
 #include <assert.h>
@@ -155,9 +155,9 @@ makepath(char *dest, int dest_size,
 split_path(char *path)
 {
     printf("\"%s\"\t= \"%s\" \"%s\"\n",
-          path,
-          dirname(strdup(path)),
-          basename(strdup(path)));
+           path,
+           dirname(strdup(path)),
+           basename(strdup(path)));
 }
 
 main()
@@ -168,9 +168,9 @@ main()
     split_path("/foo/bar");
     split_path("/bar");
     split_path("bar");
-    split_path("bar/");                /* should print "." and "bar" */
-    split_path("/");           /* should print "/" and "/" */
-    split_path("");            /* should print "." and "" */
+    split_path("bar/");         /* should print "." and "bar" */
+    split_path("/");            /* should print "/" and "/" */
+    split_path("");             /* should print "." and "" */
 
 
     len = makepath(work, sizeof work, "foo", "bar", "baz");
index d1afbad..badd963 100644 (file)
--- a/strlib.c
+++ b/strlib.c
@@ -42,13 +42,13 @@ string_copy(char *dst, char *src, int dstsz)
     if (dstsz < 1) return 0;
 
     for (i = 0; i < dstsz; i++) {
-       if ((dst[i] = src[i]) == '\0')
-           return i;
+        if ((dst[i] = src[i]) == '\0')
+            return i;
     }
 
     /* here is i == dstsz */
-    dst[--i] = '\0';   /* if eliminate this line and return dst,
-                          this function is same as strncpy(). */
+    dst[--i] = '\0';    /* if eliminate this line and return dst,
+                           this function is same as strncpy(). */
 
     return i;
 }
@@ -61,8 +61,8 @@ string_pcopy(char *dst, char *src, int dstsz)
     int i;
 
     for (i = 0; i < dstsz; i++) {
-       if ((dst[i] = src[i]) == '\0')
-           break;
+        if ((dst[i] = src[i]) == '\0')
+            break;
     }
 
     /* if here is `return dst', this function is same as strncpy() */
@@ -85,13 +85,13 @@ string_cat(char *dst, int dstsz, ...)
 
     dp = dst;
     while ((src = va_arg(ap, char *)) != NULL) {
-       tail = string_pcopy(dp, src, leftsz);
-       if (tail == dst + dstsz) {
-           *--tail = '\0';
-           break;
-       }
-       leftsz -= tail - dp;
-       dp = tail;
+        tail = string_pcopy(dp, src, leftsz);
+        if (tail == dst + dstsz) {
+            *--tail = '\0';
+            break;
+        }
+        leftsz -= tail - dp;
+        dp = tail;
     }
 
     va_end(ap);
@@ -105,11 +105,11 @@ char *
 string_tail(char *str)
 {
     if (*str == '\0') {
-       return str;
+        return str;
     }
 
     while (str != '\0') {
-       str++;
+        str++;
     }
 
     return str - 1;
@@ -126,24 +126,24 @@ chomp(char *s)
     if (len == 0) return 0;
 
     if (len > 0 && s[len-1] == '\n') {
-       s[len-1] = '\0';
-       len--;
+        s[len-1] = '\0';
+        len--;
     }
     if (len > 0 && s[len-1] == '\r') {
-       s[len-1] = '\0';
-       len--;
+        s[len-1] = '\0';
+        len--;
     }
     return len;
 }
 
 /* Return the address points non-space letter */
 /* the `space' means bellow. */
-#define IS_SPACE(c)    ((c) == ' ' || (c) == '\t' || (c) == '\n')
+#define IS_SPACE(c)     ((c) == ' ' || (c) == '\t' || (c) == '\n')
 char *
 skip_space(char *s)
 {
     while (IS_SPACE(*s))
-       s++;
+        s++;
 
     return s;
 }
@@ -153,7 +153,7 @@ char *
 skip_to_space(char *s)
 {
     while (!IS_SPACE(*s))
-       s++;
+        s++;
 
     return s;
 }
@@ -171,17 +171,17 @@ strip_space(char *s)
     char *first, *last;
 
     while (IS_SPACE(*s))
-       s++;
+        s++;
 
     if (*s == '\0')
-       return s;
+        return s;
 
     first = last = s;
 
     while (*s != '\0') {
-       if (! IS_SPACE(*s))
-           last = s;
-       s++;
+        if (! IS_SPACE(*s))
+            last = s;
+        s++;
     }
     *(last + 1) = '\0';
 
@@ -195,67 +195,67 @@ main()
 {
     puts("--- test string_copy()");
     {
-       int i;
-       char src[80] = "abcdefg", dst[5];
+        int i;
+        char src[80] = "abcdefg", dst[5];
 
-       strncpy(dst, src, sizeof dst); dst[sizeof dst - 1] = '\0';
-       i = strlen(dst);
-       printf("%d:%s\n", i, dst);
+        strncpy(dst, src, sizeof dst); dst[sizeof dst - 1] = '\0';
+        i = strlen(dst);
+        printf("%d:%s\n", i, dst);
 
-       /* same as above */
-       i = string_copy(dst, src, sizeof dst);
-       printf("%d:%s\n", i, dst);
+        /* same as above */
+        i = string_copy(dst, src, sizeof dst);
+        printf("%d:%s\n", i, dst);
     }
 
     puts("--- test string_pcopy()");
     {
-       char buf[10] = "", *p1, *p2;
-       int size, len, length = 0;
+        char buf[10] = "", *p1, *p2;
+        int size, len, length = 0;
 
-       size = 5;
+        size = 5;
 
-       p1 = string_pcopy(buf, "abc", size);
-       len = p1 - buf;
-       size -= len;
-       length += len;
+        p1 = string_pcopy(buf, "abc", size);
+        len = p1 - buf;
+        size -= len;
+        length += len;
 
-       p2 = string_pcopy(p1, "def", size);
-       len = p2 - p1;
-       size -= len;
-       length += len;
+        p2 = string_pcopy(p1, "def", size);
+        len = p2 - p1;
+        size -= len;
+        length += len;
 
-       printf("%d:%s\n", length, buf);
+        printf("%d:%s\n", length, buf);
     }
 
     puts("--- test string_cat()");
     {
-       char buf[10] = "";
-       int len;
+        char buf[10] = "";
+        int len;
 
-       len = string_cat(buf, 9, "012", "345", "678", "9ab", 0);
-       printf("%d:%s\n", len, buf);
+        len = string_cat(buf, 9, "012", "345", "678", "9ab", 0);
+        printf("%d:%s\n", len, buf);
     }
 
     puts("--- test for strip_space()");
     {
-       char buf[100], *ptr;
+        char buf[100], *ptr;
 
-       puts("test 1");
-       strcpy(buf, "   a b c   ");
-       ptr = strip_space(buf);
-       if (ptr != NULL) puts(ptr);
+        puts("test 1");
+        strcpy(buf, "   a b c   ");
+        ptr = strip_space(buf);
+        if (ptr != NULL) puts(ptr);
 
-       puts("test 2");
-       strcpy(buf, "a b c");
-       printf("\x22%s\x22\n", strip_space(buf));
+        puts("test 2");
+        strcpy(buf, "a b c");
+        printf("\x22%s\x22\n", strip_space(buf));
 
-       puts("test 3");
-       strcpy(buf, "   ");
-       printf("\x22%s\x22\n", strip_space(buf));
+        puts("test 3");
+        strcpy(buf, "   ");
+        printf("\x22%s\x22\n", strip_space(buf));
 
-       puts("test 4");
-       strcpy(buf, "");
-       printf("\x22%s\x22\n", strip_space(buf));
+        puts("test 4");
+        strcpy(buf, "");
+        printf("\x22%s\x22\n", strip_space(buf));
     }
     return 0;
 }