summaryrefslogtreecommitdiff
path: root/daemons
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2002-09-15 16:31:17 +0000
committerMarcus Brinkmann <marcus@gnu.org>2002-09-15 16:31:17 +0000
commit8c3531f3a632b61c392b0f9362cc9a267f3bbb81 (patch)
treec18556cd112b5844d88a44c00873435e1abd9b48 /daemons
parentc459dbcc280609b937dafb28e8b1f8e644e23903 (diff)
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.
Diffstat (limited to 'daemons')
-rw-r--r--daemons/ChangeLog6
-rw-r--r--daemons/getty.c25
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)