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/head.c

    r1765 r2725  
    55 * Copyright (C) 2003  Manuel Novoa III  <mjn3@codepoet.org>
    66 *
    7  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
     7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    88 */
    99
     
    1414#include "libbb.h"
    1515
     16/* This is a NOEXEC applet. Be very careful! */
     17
    1618static const char head_opts[] ALIGN1 =
    1719    "n:"
     
    2123    ;
    2224
    23 #if ENABLE_FEATURE_FANCY_HEAD
    2425static const struct suffix_mult head_suffixes[] = {
    2526    { "b", 512 },
    2627    { "k", 1024 },
    2728    { "m", 1024*1024 },
    28     { }
     29    { "", 0 }
    2930};
    30 #endif
    3131
    32 static const char header_fmt_str[] ALIGN1 = "\n==> %s <==\n";
     32#define header_fmt_str "\n==> %s <==\n"
    3333
    34 int head_main(int argc, char **argv);
     34int head_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
    3535int head_main(int argc, char **argv)
    3636{
     
    4141    int header_threshhold = 1;
    4242#endif
    43 
    4443    FILE *fp;
    4544    const char *fmt;
     
    5150#if ENABLE_INCLUDE_SUSv2 || ENABLE_FEATURE_FANCY_HEAD
    5251    /* Allow legacy syntax of an initial numeric option without -n. */
    53     if (argc > 1 && argv[1][0] == '-'
     52    if (argv[1] && argv[1][0] == '-'
    5453     && isdigit(argv[1][1])
    5554    ) {
     
    8079 GET_COUNT:
    8180#endif
    82 
    83 #if !ENABLE_FEATURE_FANCY_HEAD
    84             count = xatoul(p);
    85 #else
    8681            count = xatoul_sfx(p, head_suffixes);
    87 #endif
    8882            break;
    8983        default:
     
    9286    }
    9387
     88    argc -= optind;
    9489    argv += optind;
    95     if (!*argv) {
     90    if (!*argv)
    9691        *--argv = (char*)"-";
    97     }
    9892
    9993    fmt = header_fmt_str + 1;
    10094#if ENABLE_FEATURE_FANCY_HEAD
    101     if (argc - optind <= header_threshhold) {
     95    if (argc <= header_threshhold) {
    10296        header_threshhold = 0;
    10397    }
    10498#else
    105     if (argc <= optind + 1) {
    106         fmt += 11;
     99    if (argc <= 1) {
     100        fmt += 11; /* "" */
    107101    }
    108102    /* Now define some things here to avoid #ifdefs in the code below.
     
    129123            }
    130124            if (fclose_if_not_stdin(fp)) {
    131                 bb_perror_msg("%s", *argv); /* Avoid multibyte problems. */
     125                bb_simple_perror_msg(*argv);
    132126                retval = EXIT_FAILURE;
    133127            }
    134128            die_if_ferror_stdout();
     129        } else {
     130            retval = EXIT_FAILURE;
    135131        }
    136132        fmt = header_fmt_str;
Note: See TracChangeset for help on using the changeset viewer.