$NetBSD: patch-ab,v 1.7 2017/02/17 17:00:03 joerg Exp $ --- common/ttio.c.orig 1997-02-21 23:06:09.000000000 +0000 +++ common/ttio.c @@ -45,12 +45,21 @@ static char copyright[] = #include "osdep.h" #include "cdefs.h" #include "global.h" +#include #include #include #include #include "mcap.h" #include "ttio.h" #include +#include +#include +#include +#ifndef __sun +#include +#else +#include +#endif static void dectl PROTO ((char *, int, char *, int, char *)); @@ -73,6 +82,16 @@ int ttsetup (name) { if (chown (nbuf, pw -> pw_uid, pw -> pw_gid) < 0) warn ("Can't set owner on %s: %m", nbuf); +#ifdef __NetBSD__ + if (chmod (nbuf, 0600) < 0) + warn ("Can't set mode on %s: %m", nbuf); + revoke(nbuf); + if (ttyaction(nbuf, "modemd", "root")) + warn ("Can't ttyaction %s: %m", nbuf); + + /* delay open so DTR stays down long enough to be detected */ + usleep(100); +#endif } /* Open the terminal device. */ @@ -131,20 +150,19 @@ int ttsetup (name) return fd; } -void ttnormal (fd) +void ttnormal (int fd) { NORMAL_TTY (ts); PUT_TTY_STATE (fd, ts); } -void tthupcl (fd) +void tthupcl (int fd) { HUPCL_TTY (ts); PUT_TTY_STATE (fd, ts); } -void redirect_std (fd) - int fd; +void redirect_std (int fd) { int i; @@ -203,10 +221,8 @@ static int tteof = 0; /* Match the specified string with input from the specified tty. Return nonzero if input matches, zero if not. */ -ttmatch (ANSI_DECL (int) tty, ANSI_DECL (int) timeout, VA_DOTDOTDOT) - KandR (int tty;) - KandR (int timeout;) - va_dcl +int +ttmatch (int tty, int timeout, ...) { TIME entry, now, to; int cur, curmatch, next; @@ -230,7 +246,7 @@ ttmatch (ANSI_DECL (int) tty, ANSI_DECL match, try reading some more data from the tty... */ matchID = 1; VA_start (list, timeout); - while (string = va_arg (list, char *)) + while ((string = va_arg (list, char *))) { syslog (LOG_DEBUG, "Matching against %s", string); for (cur = ttstart; cur != ttend; cur = NEXT (cur)) @@ -316,9 +332,7 @@ ttmatch (ANSI_DECL (int) tty, ANSI_DECL } /* Read a connect speed from standard in... */ -ttread_connect_speed (tty, timeout) - int tty; - int timeout; +int ttread_connect_speed (int tty, int timeout) { TIME entry, now, to; int status;