Changeset 1765 in MondoRescue for branches/2.2.5/mindi-busybox/archival/ar.c
- Timestamp:
- Nov 4, 2007, 3:16:40 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.5/mindi-busybox/archival/ar.c
r821 r1765 8 8 * Based in part on BusyBox tar, Debian dpkg-deb and GNU ar. 9 9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by 12 * the Free Software Foundation; either version 2 of the License, or 13 * (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with this program; if not, write to the Free Software 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 10 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 23 11 * 24 12 * There is no single standard to adhere to so ar may not portable … … 27 15 */ 28 16 29 #include <fcntl.h> 30 #include <stdio.h> 31 #include <stdlib.h> 32 #include <string.h> 33 #include <time.h> 34 #include <utime.h> 35 #include <unistd.h> 36 17 #include "libbb.h" 37 18 #include "unarchive.h" 38 #include "busybox.h"39 19 40 20 static void header_verbose_list_ar(const file_header_t *file_header) … … 47 27 memmove(&mtime[17], &mtime[20], 4); 48 28 mtime[21] = '\0'; 49 printf("%s %d/%d%7d %s %s\n", &mode[1], file_header->uid, file_header->gid, (int) file_header->size, &mtime[4], file_header->name); 29 printf("%s %d/%d%7d %s %s\n", &mode[1], file_header->uid, file_header->gid, 30 (int) file_header->size, &mtime[4], file_header->name); 50 31 } 51 32 … … 58 39 #define AR_OPT_INSERT 0x40 59 40 41 int ar_main(int argc, char **argv); 60 42 int ar_main(int argc, char **argv) 61 43 { 44 static const char msg_unsupported_err[] ALIGN1 = 45 "archive %s is not supported"; 46 62 47 archive_handle_t *archive_handle; 63 unsigned long opt; 64 static const char msg_unsupported_err[] = 65 "Archive %s not supported. Install binutils 'ar'."; 48 unsigned opt; 66 49 char magic[8]; 67 50 … … 69 52 70 53 /* Prepend '-' to the first argument if required */ 71 bb_opt_complementally = "--:p:t:x:-1:?:p--tx:t--px:x--pt";72 opt = bb_getopt_ulflags(argc,argv, "ptxovcr");54 opt_complementary = "--:p:t:x:-1:p--tx:t--px:x--pt"; 55 opt = getopt32(argv, "ptxovcr"); 73 56 74 57 if (opt & AR_CTX_PRINT) { … … 94 77 } 95 78 96 archive_handle->src_fd = bb_xopen(argv[optind++], O_RDONLY);79 archive_handle->src_fd = xopen(argv[optind++], O_RDONLY); 97 80 98 81 while (optind < argc) { … … 101 84 } 102 85 103 archive_xread_all(archive_handle, magic, 7);86 xread(archive_handle->src_fd, magic, 7); 104 87 if (strncmp(magic, "!<arch>", 7) != 0) { 105 bb_error_msg_and_die(" Invalid ar magic");88 bb_error_msg_and_die("invalid ar magic"); 106 89 } 107 90 archive_handle->offset += 7; 108 91 109 while (get_header_ar(archive_handle) == EXIT_SUCCESS); 92 while (get_header_ar(archive_handle) == EXIT_SUCCESS) 93 continue; 110 94 111 95 return EXIT_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.