Ignore:
Timestamp:
Feb 25, 2011, 9:26:54 PM (13 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi-busybox/coreutils/split.c

    r1765 r2725  
    22/*
    33 * split - split a file into pieces
    4  * Copyright (c) 2007 Bernhard Fischer
     4 * Copyright (c) 2007 Bernhard Reutner-Fischer
    55 *
    6  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
     6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    77 */
    88/* BB_AUDIT: SUSv3 compliant
     
    2121    { "g", 1024*1024*1024 },
    2222#endif
    23     { }
     23    { "", 0 }
    2424};
    2525
     
    5656#define SPLIT_OPT_a (1<<2)
    5757
    58 int split_main(int argc, char **argv);
    59 int split_main(int argc, char **argv)
     58int split_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
     59int split_main(int argc UNUSED_PARAM, char **argv)
    6060{
    6161    unsigned suffix_len = 2;
     
    6969    char *src;
    7070
    71     opt_complementary = "?2";
    72     opt = getopt32(argv, "l:b:a:", &count_p, &count_p, &sfx);
     71    opt_complementary = "?2:a+"; /* max 2 args; -a N */
     72    opt = getopt32(argv, "l:b:a:", &count_p, &count_p, &suffix_len);
    7373
    7474    if (opt & SPLIT_OPT_l)
    75         cnt = xatoul(count_p);
    76     if (opt & SPLIT_OPT_b)
    77         cnt = xatoul_sfx(count_p, split_suffices);
    78     if (opt & SPLIT_OPT_a)
    79         suffix_len = xatou(sfx);
     75        cnt = XATOOFF(count_p);
     76    if (opt & SPLIT_OPT_b) // FIXME: also needs XATOOFF
     77        cnt = xatoull_sfx(count_p, split_suffices);
    8078    sfx = "x";
    8179
    8280    argv += optind;
    8381    if (argv[0]) {
     82        int fd;
    8483        if (argv[1])
    8584            sfx = argv[1];
    86         xmove_fd(xopen(argv[0], O_RDONLY), 0);
     85        fd = xopen_stdin(argv[0]);
     86        xmove_fd(fd, STDIN_FILENO);
    8787    } else {
    8888        argv[0] = (char *) bb_msg_standard_input;
     
    101101
    102102    while (1) {
    103         bytes_read = safe_read(0, read_buffer, READ_BUFFER_SIZE);
     103        bytes_read = safe_read(STDIN_FILENO, read_buffer, READ_BUFFER_SIZE);
    104104        if (!bytes_read)
    105105            break;
    106106        if (bytes_read < 0)
    107             bb_perror_msg_and_die("%s", argv[0]);
     107            bb_simple_perror_msg_and_die(argv[0]);
    108108        src = read_buffer;
    109109        do {
     
    133133            }
    134134
    135             xwrite(1, src, to_write);
     135            xwrite(STDOUT_FILENO, src, to_write);
    136136            bytes_read -= to_write;
    137137            src += to_write;
    138138        } while (bytes_read);
    139139    }
    140     return 0;
     140    return EXIT_SUCCESS;
    141141}
Note: See TracChangeset for help on using the changeset viewer.