Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/coreutils/tty.c


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/tty.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
    10 /* BB_AUDIT SUSv3 compliant */
    11 /* http://www.opengroup.org/onlinepubs/007904975/utilities/tty.html */
     10/* BB_AUDIT SUSv4 compliant */
     11/* http://www.opengroup.org/onlinepubs/9699919799/utilities/tty.html */
    1212
    1313#include "libbb.h"
    1414
    15 int tty_main(int argc, char **argv);
    16 int tty_main(int argc, char **argv)
     15int tty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
     16int tty_main(int argc UNUSED_PARAM, char **argv)
    1717{
    1818    const char *s;
    19     USE_INCLUDE_SUSv2(int silent;)  /* Note: No longer relevant in SUSv3. */
     19    IF_INCLUDE_SUSv2(int silent;)  /* Note: No longer relevant in SUSv3. */
    2020    int retval;
    2121
    22     xfunc_error_retval = 2; /* SUSv3 requires > 1 for error. */
     22    xfunc_error_retval = 2;  /* SUSv3 requires > 1 for error. */
    2323
    24     USE_INCLUDE_SUSv2(silent = getopt32(argv, "s");)
     24    IF_INCLUDE_SUSv2(silent = getopt32(argv, "s");)
     25    IF_INCLUDE_SUSv2(argv += optind;)
     26    IF_NOT_INCLUDE_SUSv2(argv += 1;)
    2527
    2628    /* gnu tty outputs a warning that it is ignoring all args. */
    27     bb_warn_ignoring_args(argc - optind);
     29    bb_warn_ignoring_args(argv[0]);
    2830
    29     retval = 0;
     31    retval = EXIT_SUCCESS;
    3032
    31     s = ttyname(0);
     33    s = xmalloc_ttyname(STDIN_FILENO);
    3234    if (s == NULL) {
    33     /* According to SUSv3, ttyname can on fail with EBADF or ENOTTY.
     35    /* According to SUSv3, ttyname can fail with EBADF or ENOTTY.
    3436     * We know the file descriptor is good, so failure means not a tty. */
    3537        s = "not a tty";
    36         retval = 1;
     38        retval = EXIT_FAILURE;
    3739    }
    38     USE_INCLUDE_SUSv2(if (!silent) puts(s);)
    39     SKIP_INCLUDE_SUSv2(puts(s);)
     40    IF_INCLUDE_SUSv2(if (!silent) puts(s);)
     41    IF_NOT_INCLUDE_SUSv2(puts(s);)
    4042
    4143    fflush_stdout_and_exit(retval);
Note: See TracChangeset for help on using the changeset viewer.