Changeset 1765 in MondoRescue for branches/2.2.5/mindi-busybox/archival/ar.c


Ignore:
Timestamp:
Nov 4, 2007, 3:16:40 AM (16 years ago)
Author:
Bruno Cornec
Message:

Update to busybox 1.7.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mindi-busybox/archival/ar.c

    r821 r1765  
    88 * Based in part on BusyBox tar, Debian dpkg-deb and GNU ar.
    99 *
    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.
    2311 *
    2412 * There is no single standard to adhere to so ar may not portable
     
    2715 */
    2816
    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"
    3718#include "unarchive.h"
    38 #include "busybox.h"
    3919
    4020static void header_verbose_list_ar(const file_header_t *file_header)
     
    4727    memmove(&mtime[17], &mtime[20], 4);
    4828    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);
    5031}
    5132
     
    5839#define AR_OPT_INSERT       0x40
    5940
     41int ar_main(int argc, char **argv);
    6042int ar_main(int argc, char **argv)
    6143{
     44    static const char msg_unsupported_err[] ALIGN1 =
     45        "archive %s is not supported";
     46
    6247    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;
    6649    char magic[8];
    6750
     
    6952
    7053    /* 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");
    7356
    7457    if (opt & AR_CTX_PRINT) {
     
    9477    }
    9578
    96     archive_handle->src_fd = bb_xopen(argv[optind++], O_RDONLY);
     79    archive_handle->src_fd = xopen(argv[optind++], O_RDONLY);
    9780
    9881    while (optind < argc) {
     
    10184    }
    10285
    103     archive_xread_all(archive_handle, magic, 7);
     86    xread(archive_handle->src_fd, magic, 7);
    10487    if (strncmp(magic, "!<arch>", 7) != 0) {
    105         bb_error_msg_and_die("Invalid ar magic");
     88        bb_error_msg_and_die("invalid ar magic");
    10689    }
    10790    archive_handle->offset += 7;
    10891
    109     while (get_header_ar(archive_handle) == EXIT_SUCCESS);
     92    while (get_header_ar(archive_handle) == EXIT_SUCCESS)
     93        continue;
    11094
    11195    return EXIT_SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.