[PATCH] getty: Wait until all output written to stdout has been transmitted

Rich Felker dalias at aerifal.cx
Wed Feb 9 20:46:43 UTC 2011


On Sun, Jan 23, 2011 at 08:05:44PM -0600, Rob Landley wrote:
> /* Optionally wait for CR or LF before writing /etc/issue */
> if (option_mask32 & F_WAITCRLF) {
>         char ch;
> 
>         debug("waiting for cr-lf\n");
>         while (safe_read(STDIN_FILENO, &ch, 1) == 1) {
>                 debug("read %x\n", (unsigned char)ch);
>                 ch &= 0x7f;                     /* strip "parity bit" */
>                 if (ch == '\n' || ch == '\r')
>                         break;
>         }
> }
> 
> Strip parity bit?  Really?
> 
> I'm going to stop before I have to start rewriting the thing myself...

I got bored and did it for you:

#!/bin/sh
exec </dev/$1 >/dev/$1 2>&1 || { sleep 1 ; exit 1 ; }
stty sane
reset
printf "%s login: " "`hostname`"
read -r login
exec /bin/login "$login"


Cheers,
Rich


More information about the busybox mailing list