diff options
-rw-r--r-- | daemons/ChangeLog | 6 | ||||
-rw-r--r-- | daemons/getty.c | 25 |
2 files changed, 30 insertions, 1 deletions
diff --git a/daemons/ChangeLog b/daemons/ChangeLog index a1a13f10..5f5b7fee 100644 --- a/daemons/ChangeLog +++ b/daemons/ChangeLog @@ -1,3 +1,9 @@ +2002-09-15 Marcus Brinkmann <marcus@gnu.org> + + * getty.c: Include <termios.h>. + (set_speed): New function. + (main): Take linespec from argc[1], not argc[2]. Call set_speed. + 2002-03-23 James A. Morrison <ja2morri@uwaterloo.ca> * console-run.c (open_console): Use ERR, not errno. 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) |