tty -s support

Denys Vlasenko vda.linux at googlemail.com
Fri Aug 13 04:23:34 UTC 2010


On Thursday 12 August 2010 17:17, Alexander Griesser wrote:
> Hey there,
> 
> today I tried to run a script on one of my busybox installations which 
> has been created by the famous “makeself” script.
> It failed because the tty command did not support the “-s” option.
> 
> I wanted to quickly add that option to tty and found out, that it’s 
> already in there, but is only enabled in SUSv2 mode?
> 
> Here’s the code in coreutils/tty.c:
> 
>          IF_INCLUDE_SUSv2(silent = getopt32(argv, "s");)
>          IF_INCLUDE_SUSv2(argv += optind;)
>          IF_NOT_INCLUDE_SUSv2(argv += 1;)
>
> And here’s what I found when grepping through the whole busybox source 
> for IF_INCLUDE_SUSv2:
> 
> # grep -r IF_INCLUDE_SUSv2 *
> coreutils/tty.c:      IF_INCLUDE_SUSv2(int silent;) /* Note: No longer 
> relevant in SUSv3. */
> coreutils/tty.c:      IF_INCLUDE_SUSv2(silent = getopt32(argv, "s");)
> coreutils/tty.c:      IF_INCLUDE_SUSv2(argv += optind;)
> coreutils/tty.c:      IF_INCLUDE_SUSv2(if (!silent) puts(s);)
> include/usage.h:      IF_INCLUDE_SUSv2( "\n" \
> include/autoconf.h:#define IF_INCLUDE_SUSv2(...)
> include/usage.src.h:  IF_INCLUDE_SUSv2( "\n" \
> 
> So, is it safe to assume that this needs to be cleaned up since it is 
> not used anywhere else?

head and tail also use it:

# grep -r INCLUDE_SUS .
./TEST_config_rh9:CONFIG_INCLUDE_SUSv2=y
./coreutils/tty.c:      IF_INCLUDE_SUSv2(int silent;)   /* Note: No longer relevant in SUSv3. */
./coreutils/tty.c:      IF_INCLUDE_SUSv2(silent = getopt32(argv, "s");)
./coreutils/tty.c:      IF_INCLUDE_SUSv2(argv += optind;)
./coreutils/tty.c:      IF_NOT_INCLUDE_SUSv2(argv += 1;)
./coreutils/tty.c:      IF_INCLUDE_SUSv2(if (!silent) puts(s);)
./coreutils/tty.c:      IF_NOT_INCLUDE_SUSv2(puts(s);)
./coreutils/fold.c:     if (ENABLE_INCLUDE_SUSv2) {
./coreutils/head.c:#if ENABLE_INCLUDE_SUSv2 || ENABLE_FEATURE_FANCY_HEAD
./coreutils/head.c:#if ENABLE_INCLUDE_SUSv2 || ENABLE_FEATURE_FANCY_HEAD
./coreutils/tail.c:#if ENABLE_INCLUDE_SUSv2 || ENABLE_FEATURE_FANCY_TAIL
./Config.in:config INCLUDE_SUSv2
./TEST_config_nommu:CONFIG_INCLUDE_SUSv2=y
./include/usage.src.h:  IF_INCLUDE_SUSv2( "\n" \
./testsuite/tail/tail-works:# FEATURE: CONFIG_INCLUDE_SUSv2
./TEST_config_noprintf:CONFIG_INCLUDE_SUSv2=y

-- 
vda


More information about the busybox mailing list