aboutsummaryrefslogtreecommitdiff
path: root/ar.c
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-09-11 04:55:31 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-09-11 04:55:31 +0000
commitc7012cbf41d206ed52a229c34f410efdcdd4982d (patch)
tree922f53dc53e94ee22e49a07258ade07ead0e756f /ar.c
parent567e6d303b63c0136133c17f0c56b4fa23afa8e7 (diff)
downloadbusybox-w32-c7012cbf41d206ed52a229c34f410efdcdd4982d.tar.gz
busybox-w32-c7012cbf41d206ed52a229c34f410efdcdd4982d.tar.bz2
busybox-w32-c7012cbf41d206ed52a229c34f410efdcdd4982d.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 git-svn-id: svn://busybox.net/trunk/busybox@1032 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'ar.c')
-rw-r--r--ar.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/ar.c b/ar.c
index adb6982b2..61ce83029 100644
--- a/ar.c
+++ b/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 */
208static int displayEntry(headerL_t *head, int funct) 208static 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 }