diff options
Diffstat (limited to 'daemons/getty.c')
-rw-r--r-- | daemons/getty.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/daemons/getty.c b/daemons/getty.c index 4810e6dd..bacec355 100644 --- a/daemons/getty.c +++ b/daemons/getty.c @@ -31,12 +31,33 @@ #include <string.h> #include <utmp.h> #include <sys/ioctl.h> +#include <termios.h> /* XXX */ extern char *localhost (); #define _PATH_LOGIN "/bin/login" +/* Parse the terminal speed. */ +static void +set_speed (int tty, char *speedstr) +{ + error_t err; + struct termios ttystat; + speed_t speed; + char *tail; + + errno = 0; + speed = strtoul (speedstr, &tail, 0); + if (errno || *tail) + return; + + err = tcgetattr (tty, &ttystat); + if (!err && !cfsetspeed (&ttystat, speed)) + tcsetattr (tty, TCSAFLUSH, &ttystat); +} + + /* Print a suitable welcome banner */ static void print_banner (int fd, char *ttyname) @@ -73,7 +94,7 @@ main (int argc, char **argv) } /* Don't do anything with this for now. */ - linespec = argv[2]; + linespec = argv[1]; tt = getttynam (argv[2]); asprintf (&ttyname, "%s/%s", _PATH_DEV, argv[2]); @@ -95,6 +116,8 @@ main (int argc, char **argv) } while (tty == -1); + set_speed (tty, linespec); + print_banner (tty, ttyname); if (login_tty (tty) == -1) |