[BusyBox] multiple cin patch

Vladimir N. Oleynik dzo at simtreas.ru
Fri Jan 26 09:31:38 UTC 2001


Bryan Rittmeyer wrote:

> I figured I might as well continue my history of submitting extremely
> minor patches:
> 
> -       setTermSettings(fileno(cin), &initial_settings);
> +       setTermSettings(fileno(morecin), &initial_settings);

Hmm, I think, that it is better for placing in utilites.c ?

>  #ifdef BB_FEATURE_USE_TERMIOS
> -               cin = fopen("/dev/tty", "r");
> -               if (!cin)
> -                       cin = fopen("/dev/console", "r");
> -               getTermSettings(fileno(cin), &initial_settings);
> +               morecin = fopen("/dev/tty", "r");
> +               if (!morecin)
> +                       morecin = fopen("/dev/console", "r");
> +               getTermSettings(fileno(morecin), &initial_settings);
> -               setTermSettings(fileno(cin), &new_settings);
> +               setTermSettings(fileno(morecin), &new_settings);

To all:

There can be I do not understand something in modern style, but unless
there are situations when the applicaion _interactive_ and discriptor 
it is not equal 0 in stdin? :00

I think, that it is standart idea for intercative test:

if(isatty(0)) setTermSettings(0, &new_settings);

And /dev/console must open only `init'.


--w
vodz





More information about the busybox mailing list