diff options
| author | Eric Andersen <andersen@codepoet.org> | 2000-09-11 04:55:31 +0000 |
|---|---|---|
| committer | Eric Andersen <andersen@codepoet.org> | 2000-09-11 04:55:31 +0000 |
| commit | 49352adf9c96c05babe78fa99ddaa7caaf440655 (patch) | |
| tree | 922f53dc53e94ee22e49a07258ade07ead0e756f | |
| parent | 605a819a179e4cd00823dda41a6804c6636a3523 (diff) | |
| download | busybox-w32-49352adf9c96c05babe78fa99ddaa7caaf440655.tar.gz busybox-w32-49352adf9c96c05babe78fa99ddaa7caaf440655.tar.bz2 busybox-w32-49352adf9c96c05babe78fa99ddaa7caaf440655.zip | |
Simplify a few little things, and merge in a patch from
robotti@metconnect.com so that 'ar -xv' and 'ar -x -v'
both work.
-Erik
| -rw-r--r-- | ar.c | 22 | ||||
| -rw-r--r-- | archival/ar.c | 22 |
2 files changed, 22 insertions, 22 deletions
| @@ -181,7 +181,7 @@ static headerL_t *getHeaders(int srcFd, headerL_t *head, int funct) | |||
| 181 | *head = *list; | 181 | *head = *list; |
| 182 | 182 | ||
| 183 | /* recursive check for sub-archives */ | 183 | /* recursive check for sub-archives */ |
| 184 | if ((funct & RECURSIVE) == RECURSIVE) | 184 | if ( funct & RECURSIVE ) |
| 185 | head = getHeaders(srcFd, head, funct); | 185 | head = getHeaders(srcFd, head, funct); |
| 186 | lseek(srcFd, head->offset + head->size, SEEK_SET); | 186 | lseek(srcFd, head->offset + head->size, SEEK_SET); |
| 187 | } | 187 | } |
| @@ -207,7 +207,7 @@ static headerL_t *findEntry(headerL_t *head, const char *filename) | |||
| 207 | */ | 207 | */ |
| 208 | static int displayEntry(headerL_t *head, int funct) | 208 | static int displayEntry(headerL_t *head, int funct) |
| 209 | { | 209 | { |
| 210 | if ((funct & VERBOSE) == VERBOSE) { | 210 | if ( funct & VERBOSE ) { |
| 211 | printf("%s %d/%d %8d %s ", modeString(head->mode), head->uid, head->gid, head->size, timeString(head->mtime)); | 211 | printf("%s %d/%d %8d %s ", modeString(head->mode), head->uid, head->gid, head->size, timeString(head->mtime)); |
| 212 | } | 212 | } |
| 213 | printf("%s\n", head->name); | 213 | printf("%s\n", head->name); |
| @@ -232,22 +232,22 @@ extern int ar_main(int argc, char **argv) | |||
| 232 | while ((opt = getopt(argc, argv, "ovtpxR")) != -1) { | 232 | while ((opt = getopt(argc, argv, "ovtpxR")) != -1) { |
| 233 | switch (opt) { | 233 | switch (opt) { |
| 234 | case 'o': | 234 | case 'o': |
| 235 | funct = funct | PRESERVE_DATE; | 235 | funct |= PRESERVE_DATE; |
| 236 | break; | 236 | break; |
| 237 | case 'v': | 237 | case 'v': |
| 238 | funct = funct | VERBOSE; | 238 | funct |= VERBOSE; |
| 239 | break; | 239 | break; |
| 240 | case 't': | 240 | case 't': |
| 241 | funct = funct | DISPLAY; | 241 | funct |= DISPLAY; |
| 242 | break; | 242 | break; |
| 243 | case 'x': | 243 | case 'x': |
| 244 | funct = funct | EXT_TO_FILE; | 244 | funct |= EXT_TO_FILE; |
| 245 | break; | 245 | break; |
| 246 | case 'p': | 246 | case 'p': |
| 247 | funct = funct | EXT_TO_STDOUT; | 247 | funct |= EXT_TO_STDOUT; |
| 248 | break; | 248 | break; |
| 249 | case 'R': | 249 | case 'R': |
| 250 | funct = funct | RECURSIVE; | 250 | funct |= RECURSIVE; |
| 251 | break; | 251 | break; |
| 252 | default: | 252 | default: |
| 253 | usage(ar_usage); | 253 | usage(ar_usage); |
| @@ -288,14 +288,14 @@ extern int ar_main(int argc, char **argv) | |||
| 288 | extractList = header; | 288 | extractList = header; |
| 289 | 289 | ||
| 290 | while(extractList->next != NULL) { | 290 | while(extractList->next != NULL) { |
| 291 | if ( (funct & EXT_TO_FILE) == EXT_TO_FILE) { | 291 | if ( funct & EXT_TO_FILE ) { |
| 292 | dstFd = open(extractList->name, O_WRONLY | O_CREAT, extractList->mode); | 292 | dstFd = open(extractList->name, O_WRONLY | O_CREAT, extractList->mode); |
| 293 | 293 | ||
| 294 | extractAr(srcFd, dstFd, extractList); | 294 | extractAr(srcFd, dstFd, extractList); |
| 295 | } | 295 | } |
| 296 | if ( (funct & EXT_TO_STDOUT) == EXT_TO_STDOUT) | 296 | if ( funct & EXT_TO_STDOUT ) |
| 297 | extractAr(srcFd, fileno(stdout), extractList); | 297 | extractAr(srcFd, fileno(stdout), extractList); |
| 298 | if ( (funct & DISPLAY) == DISPLAY) | 298 | if ( (funct & DISPLAY) || (funct & VERBOSE)) |
| 299 | displayEntry(extractList, funct); | 299 | displayEntry(extractList, funct); |
| 300 | extractList=extractList->next; | 300 | extractList=extractList->next; |
| 301 | } | 301 | } |
diff --git a/archival/ar.c b/archival/ar.c index adb6982b2..61ce83029 100644 --- a/archival/ar.c +++ b/archival/ar.c | |||
| @@ -181,7 +181,7 @@ static headerL_t *getHeaders(int srcFd, headerL_t *head, int funct) | |||
| 181 | *head = *list; | 181 | *head = *list; |
| 182 | 182 | ||
| 183 | /* recursive check for sub-archives */ | 183 | /* recursive check for sub-archives */ |
| 184 | if ((funct & RECURSIVE) == RECURSIVE) | 184 | if ( funct & RECURSIVE ) |
| 185 | head = getHeaders(srcFd, head, funct); | 185 | head = getHeaders(srcFd, head, funct); |
| 186 | lseek(srcFd, head->offset + head->size, SEEK_SET); | 186 | lseek(srcFd, head->offset + head->size, SEEK_SET); |
| 187 | } | 187 | } |
| @@ -207,7 +207,7 @@ static headerL_t *findEntry(headerL_t *head, const char *filename) | |||
| 207 | */ | 207 | */ |
| 208 | static int displayEntry(headerL_t *head, int funct) | 208 | static int displayEntry(headerL_t *head, int funct) |
| 209 | { | 209 | { |
| 210 | if ((funct & VERBOSE) == VERBOSE) { | 210 | if ( funct & VERBOSE ) { |
| 211 | printf("%s %d/%d %8d %s ", modeString(head->mode), head->uid, head->gid, head->size, timeString(head->mtime)); | 211 | printf("%s %d/%d %8d %s ", modeString(head->mode), head->uid, head->gid, head->size, timeString(head->mtime)); |
| 212 | } | 212 | } |
| 213 | printf("%s\n", head->name); | 213 | printf("%s\n", head->name); |
| @@ -232,22 +232,22 @@ extern int ar_main(int argc, char **argv) | |||
| 232 | while ((opt = getopt(argc, argv, "ovtpxR")) != -1) { | 232 | while ((opt = getopt(argc, argv, "ovtpxR")) != -1) { |
| 233 | switch (opt) { | 233 | switch (opt) { |
| 234 | case 'o': | 234 | case 'o': |
| 235 | funct = funct | PRESERVE_DATE; | 235 | funct |= PRESERVE_DATE; |
| 236 | break; | 236 | break; |
| 237 | case 'v': | 237 | case 'v': |
| 238 | funct = funct | VERBOSE; | 238 | funct |= VERBOSE; |
| 239 | break; | 239 | break; |
| 240 | case 't': | 240 | case 't': |
| 241 | funct = funct | DISPLAY; | 241 | funct |= DISPLAY; |
| 242 | break; | 242 | break; |
| 243 | case 'x': | 243 | case 'x': |
| 244 | funct = funct | EXT_TO_FILE; | 244 | funct |= EXT_TO_FILE; |
| 245 | break; | 245 | break; |
| 246 | case 'p': | 246 | case 'p': |
| 247 | funct = funct | EXT_TO_STDOUT; | 247 | funct |= EXT_TO_STDOUT; |
| 248 | break; | 248 | break; |
| 249 | case 'R': | 249 | case 'R': |
| 250 | funct = funct | RECURSIVE; | 250 | funct |= RECURSIVE; |
| 251 | break; | 251 | break; |
| 252 | default: | 252 | default: |
| 253 | usage(ar_usage); | 253 | usage(ar_usage); |
| @@ -288,14 +288,14 @@ extern int ar_main(int argc, char **argv) | |||
| 288 | extractList = header; | 288 | extractList = header; |
| 289 | 289 | ||
| 290 | while(extractList->next != NULL) { | 290 | while(extractList->next != NULL) { |
| 291 | if ( (funct & EXT_TO_FILE) == EXT_TO_FILE) { | 291 | if ( funct & EXT_TO_FILE ) { |
| 292 | dstFd = open(extractList->name, O_WRONLY | O_CREAT, extractList->mode); | 292 | dstFd = open(extractList->name, O_WRONLY | O_CREAT, extractList->mode); |
| 293 | 293 | ||
| 294 | extractAr(srcFd, dstFd, extractList); | 294 | extractAr(srcFd, dstFd, extractList); |
| 295 | } | 295 | } |
| 296 | if ( (funct & EXT_TO_STDOUT) == EXT_TO_STDOUT) | 296 | if ( funct & EXT_TO_STDOUT ) |
| 297 | extractAr(srcFd, fileno(stdout), extractList); | 297 | extractAr(srcFd, fileno(stdout), extractList); |
| 298 | if ( (funct & DISPLAY) == DISPLAY) | 298 | if ( (funct & DISPLAY) || (funct & VERBOSE)) |
| 299 | displayEntry(extractList, funct); | 299 | displayEntry(extractList, funct); |
| 300 | extractList=extractList->next; | 300 | extractList=extractList->next; |
| 301 | } | 301 | } |
