diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2001-02-11 03:15:57 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2001-02-11 03:15:57 +0000 |
commit | 728875f34033ed965c143f8a5dc9c4db77c176f9 (patch) | |
tree | b785e0373a648191bf6929d89652d983450ba5d7 | |
parent | 631064613f50de2fe9cce2b679752e19c72fc58b (diff) | |
download | busybox-w32-728875f34033ed965c143f8a5dc9c4db77c176f9.tar.gz busybox-w32-728875f34033ed965c143f8a5dc9c4db77c176f9.tar.bz2 busybox-w32-728875f34033ed965c143f8a5dc9c4db77c176f9.zip |
Consmetic changes
-rw-r--r-- | ar.c | 18 | ||||
-rw-r--r-- | archival/ar.c | 18 |
2 files changed, 22 insertions, 14 deletions
@@ -43,7 +43,7 @@ typedef struct ar_headers_s { | |||
43 | /* | 43 | /* |
44 | * return the headerL_t struct for the filename descriptor | 44 | * return the headerL_t struct for the filename descriptor |
45 | */ | 45 | */ |
46 | extern ar_headers_t get_headers(int srcFd) | 46 | extern ar_headers_t get_ar_headers(int srcFd) |
47 | { | 47 | { |
48 | typedef struct raw_ar_header_s { /* Byte Offset */ | 48 | typedef struct raw_ar_header_s { /* Byte Offset */ |
49 | char name[16]; /* 0-15 */ | 49 | char name[16]; /* 0-15 */ |
@@ -54,6 +54,7 @@ extern ar_headers_t get_headers(int srcFd) | |||
54 | char size[10]; /* 48-57 */ | 54 | char size[10]; /* 48-57 */ |
55 | char fmag[2]; /* 58-59 */ | 55 | char fmag[2]; /* 58-59 */ |
56 | } raw_ar_header_t; | 56 | } raw_ar_header_t; |
57 | |||
57 | raw_ar_header_t raw_ar_header; | 58 | raw_ar_header_t raw_ar_header; |
58 | 59 | ||
59 | ar_headers_t *head, *entry; | 60 | ar_headers_t *head, *entry; |
@@ -64,21 +65,24 @@ extern ar_headers_t get_headers(int srcFd) | |||
64 | entry = (ar_headers_t *) xmalloc(sizeof(ar_headers_t)); | 65 | entry = (ar_headers_t *) xmalloc(sizeof(ar_headers_t)); |
65 | 66 | ||
66 | /* check ar magic */ | 67 | /* check ar magic */ |
67 | if (full_read(srcFd, ar_magic, 8) != 8) | 68 | if (full_read(srcFd, ar_magic, 8) != 8) { |
68 | error_msg_and_die("cannot read magic"); | 69 | error_msg_and_die("cannot read magic"); |
69 | if (strncmp(ar_magic,"!<arch>",7) != 0) | 70 | } |
71 | |||
72 | if (strncmp(ar_magic,"!<arch>",7) != 0) { | ||
70 | error_msg_and_die("invalid magic"); | 73 | error_msg_and_die("invalid magic"); |
74 | } | ||
71 | 75 | ||
72 | while (full_read(srcFd, (char *) &raw_ar_header, 60)==60) { | 76 | while (full_read(srcFd, (char *) &raw_ar_header, 60)==60) { |
73 | /* check the end of header markers are valid */ | 77 | /* check the end of header markers are valid */ |
74 | if ((raw_ar_header.fmag[0]!='`') || (raw_ar_header.fmag[1]!='\n')) { | 78 | if ((raw_ar_header.fmag[0]!='`') || (raw_ar_header.fmag[1]!='\n')) { |
75 | char newline[1]; | 79 | char newline; |
76 | if (raw_ar_header.fmag[1]!='`') { | 80 | if (raw_ar_header.fmag[1]!='`') { |
77 | break; | 81 | break; |
78 | } | 82 | } |
79 | /* some version of ar, have an extra '\n' after each entry */ | 83 | /* some version of ar, have an extra '\n' after each entry */ |
80 | read(srcFd, newline, 1); | 84 | read(srcFd, &newline, 1); |
81 | if (newline[0]!='\n') { | 85 | if (newline!='\n') { |
82 | break; | 86 | break; |
83 | } | 87 | } |
84 | /* fix up the header, we started reading 1 byte too early due to a '\n' */ | 88 | /* fix up the header, we started reading 1 byte too early due to a '\n' */ |
@@ -171,7 +175,7 @@ extern int ar_main(int argc, char **argv) | |||
171 | error_msg_and_die("Cannot read %s", argv[optind]); | 175 | error_msg_and_die("Cannot read %s", argv[optind]); |
172 | 176 | ||
173 | optind++; | 177 | optind++; |
174 | head = get_headers(srcFd); | 178 | head = get_ar_headers(srcFd); |
175 | 179 | ||
176 | /* find files to extract or display */ | 180 | /* find files to extract or display */ |
177 | /* search through argv and build extract list */ | 181 | /* search through argv and build extract list */ |
diff --git a/archival/ar.c b/archival/ar.c index 5aba30de0..7a5169e95 100644 --- a/archival/ar.c +++ b/archival/ar.c | |||
@@ -43,7 +43,7 @@ typedef struct ar_headers_s { | |||
43 | /* | 43 | /* |
44 | * return the headerL_t struct for the filename descriptor | 44 | * return the headerL_t struct for the filename descriptor |
45 | */ | 45 | */ |
46 | extern ar_headers_t get_headers(int srcFd) | 46 | extern ar_headers_t get_ar_headers(int srcFd) |
47 | { | 47 | { |
48 | typedef struct raw_ar_header_s { /* Byte Offset */ | 48 | typedef struct raw_ar_header_s { /* Byte Offset */ |
49 | char name[16]; /* 0-15 */ | 49 | char name[16]; /* 0-15 */ |
@@ -54,6 +54,7 @@ extern ar_headers_t get_headers(int srcFd) | |||
54 | char size[10]; /* 48-57 */ | 54 | char size[10]; /* 48-57 */ |
55 | char fmag[2]; /* 58-59 */ | 55 | char fmag[2]; /* 58-59 */ |
56 | } raw_ar_header_t; | 56 | } raw_ar_header_t; |
57 | |||
57 | raw_ar_header_t raw_ar_header; | 58 | raw_ar_header_t raw_ar_header; |
58 | 59 | ||
59 | ar_headers_t *head, *entry; | 60 | ar_headers_t *head, *entry; |
@@ -64,21 +65,24 @@ extern ar_headers_t get_headers(int srcFd) | |||
64 | entry = (ar_headers_t *) xmalloc(sizeof(ar_headers_t)); | 65 | entry = (ar_headers_t *) xmalloc(sizeof(ar_headers_t)); |
65 | 66 | ||
66 | /* check ar magic */ | 67 | /* check ar magic */ |
67 | if (full_read(srcFd, ar_magic, 8) != 8) | 68 | if (full_read(srcFd, ar_magic, 8) != 8) { |
68 | error_msg_and_die("cannot read magic"); | 69 | error_msg_and_die("cannot read magic"); |
69 | if (strncmp(ar_magic,"!<arch>",7) != 0) | 70 | } |
71 | |||
72 | if (strncmp(ar_magic,"!<arch>",7) != 0) { | ||
70 | error_msg_and_die("invalid magic"); | 73 | error_msg_and_die("invalid magic"); |
74 | } | ||
71 | 75 | ||
72 | while (full_read(srcFd, (char *) &raw_ar_header, 60)==60) { | 76 | while (full_read(srcFd, (char *) &raw_ar_header, 60)==60) { |
73 | /* check the end of header markers are valid */ | 77 | /* check the end of header markers are valid */ |
74 | if ((raw_ar_header.fmag[0]!='`') || (raw_ar_header.fmag[1]!='\n')) { | 78 | if ((raw_ar_header.fmag[0]!='`') || (raw_ar_header.fmag[1]!='\n')) { |
75 | char newline[1]; | 79 | char newline; |
76 | if (raw_ar_header.fmag[1]!='`') { | 80 | if (raw_ar_header.fmag[1]!='`') { |
77 | break; | 81 | break; |
78 | } | 82 | } |
79 | /* some version of ar, have an extra '\n' after each entry */ | 83 | /* some version of ar, have an extra '\n' after each entry */ |
80 | read(srcFd, newline, 1); | 84 | read(srcFd, &newline, 1); |
81 | if (newline[0]!='\n') { | 85 | if (newline!='\n') { |
82 | break; | 86 | break; |
83 | } | 87 | } |
84 | /* fix up the header, we started reading 1 byte too early due to a '\n' */ | 88 | /* fix up the header, we started reading 1 byte too early due to a '\n' */ |
@@ -171,7 +175,7 @@ extern int ar_main(int argc, char **argv) | |||
171 | error_msg_and_die("Cannot read %s", argv[optind]); | 175 | error_msg_and_die("Cannot read %s", argv[optind]); |
172 | 176 | ||
173 | optind++; | 177 | optind++; |
174 | head = get_headers(srcFd); | 178 | head = get_ar_headers(srcFd); |
175 | 179 | ||
176 | /* find files to extract or display */ | 180 | /* find files to extract or display */ |
177 | /* search through argv and build extract list */ | 181 | /* search through argv and build extract list */ |