diff options
author | bug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-02-11 03:15:57 +0000 |
---|---|---|
committer | bug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-02-11 03:15:57 +0000 |
commit | 3759315890e33b53b5b29309e63fe04fd38e9702 (patch) | |
tree | b785e0373a648191bf6929d89652d983450ba5d7 /ar.c | |
parent | a1be2a16353409fc9a8c4d7b6eb413d68e2e2f8c (diff) | |
download | busybox-w32-3759315890e33b53b5b29309e63fe04fd38e9702.tar.gz busybox-w32-3759315890e33b53b5b29309e63fe04fd38e9702.tar.bz2 busybox-w32-3759315890e33b53b5b29309e63fe04fd38e9702.zip |
Consmetic changes
git-svn-id: svn://busybox.net/trunk/busybox@1791 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'ar.c')
-rw-r--r-- | ar.c | 18 |
1 files changed, 11 insertions, 7 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 */ |