diff options
author | 2006-03-17 19:39:46 +0000 | |
---|---|---|
committer | 2006-03-17 19:39:46 +0000 | |
commit | 960672ebe384a838d694192a5aa7220d768a344b (patch) | |
tree | f8929dd5d21c3cffa347cb8189e3db0409d86311 | |
parent | ansification and correct prototypes. ok deraadt@ (diff) | |
download | wireguard-openbsd-960672ebe384a838d694192a5aa7220d768a344b.tar.xz wireguard-openbsd-960672ebe384a838d694192a5aa7220d768a344b.zip |
more cleanups; ok moritz
-rw-r--r-- | usr.bin/tip/cmds.c | 17 | ||||
-rw-r--r-- | usr.bin/tip/hunt.c | 5 | ||||
-rw-r--r-- | usr.bin/tip/tip.c | 29 | ||||
-rw-r--r-- | usr.bin/tip/tip.h | 4 | ||||
-rw-r--r-- | usr.bin/tip/tipout.c | 6 |
5 files changed, 32 insertions, 29 deletions
diff --git a/usr.bin/tip/cmds.c b/usr.bin/tip/cmds.c index 2e66c0e5761..60f903acc1e 100644 --- a/usr.bin/tip/cmds.c +++ b/usr.bin/tip/cmds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmds.c,v 1.24 2006/03/17 14:43:06 moritz Exp $ */ +/* $OpenBSD: cmds.c,v 1.25 2006/03/17 19:39:46 deraadt Exp $ */ /* $NetBSD: cmds.c,v 1.7 1997/02/11 09:24:03 mrg Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)cmds.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: cmds.c,v 1.24 2006/03/17 14:43:06 moritz Exp $"; +static const char rcsid[] = "$OpenBSD: cmds.c,v 1.25 2006/03/17 19:39:46 deraadt Exp $"; #endif /* not lint */ #include "tip.h" @@ -133,10 +133,10 @@ static jmp_buf intbuf; static void transfer(char *buf, int fd, char *eofchars) { - int ct; + int ct, eof; char c, buffer[BUFSIZ]; char *p = buffer; - int cnt, eof; + size_t cnt; time_t start; sig_t f; char r; @@ -355,7 +355,7 @@ transmit(FILE *fp, char *eofchars, char *command) printf("\r%d", ++lcount); if (boolean(value(ECHOCHECK))) { timedout = 0; - alarm((unsigned int)value(ETIMEOUT)); + alarm((unsigned int)lvalue(ETIMEOUT)); do { /* wait for prompt */ read(FD, (char *)&c, 1); if (timedout || stop) { @@ -443,7 +443,7 @@ send(int c) } tryagain: timedout = 0; - alarm((long)value(ETIMEOUT)); + alarm((unsigned int)lvalue(ETIMEOUT)); read(FD, &cc, 1); alarm(0); if (timedout) { @@ -455,6 +455,7 @@ tryagain: } } +/*ARGSUSED*/ void timeout(int signo) { @@ -546,8 +547,6 @@ consh(int c) while ((p = wait(&status)) > 0 && p != cpid) ; } else { - int i; - dup2(FD, 0); dup2(3, 1); closefrom(3); @@ -610,6 +609,7 @@ void setscript(void) { char c; + /* * enable TIPOUT side for dialogue */ @@ -675,6 +675,7 @@ finish(int c) tipabort(NOSTR); } +/*ARGSUSED*/ static void intcopy(int signo) { diff --git a/usr.bin/tip/hunt.c b/usr.bin/tip/hunt.c index 8cc46d3022d..a6cf72ec6c5 100644 --- a/usr.bin/tip/hunt.c +++ b/usr.bin/tip/hunt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hunt.c,v 1.12 2006/03/17 14:43:06 moritz Exp $ */ +/* $OpenBSD: hunt.c,v 1.13 2006/03/17 19:39:46 deraadt Exp $ */ /* $NetBSD: hunt.c,v 1.6 1997/04/20 00:02:10 mellon Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)hunt.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: hunt.c,v 1.12 2006/03/17 14:43:06 moritz Exp $"; +static const char rcsid[] = "$OpenBSD: hunt.c,v 1.13 2006/03/17 19:39:46 deraadt Exp $"; #endif /* not lint */ #include "tip.h" @@ -44,6 +44,7 @@ static int deadfl; static void dead(int); +/*ARGSUSED*/ static void dead(int signo) { diff --git a/usr.bin/tip/tip.c b/usr.bin/tip/tip.c index 975337e550e..7d00d117203 100644 --- a/usr.bin/tip/tip.c +++ b/usr.bin/tip/tip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tip.c,v 1.26 2006/03/17 14:43:06 moritz Exp $ */ +/* $OpenBSD: tip.c,v 1.27 2006/03/17 19:39:46 deraadt Exp $ */ /* $NetBSD: tip.c,v 1.13 1997/04/20 00:03:05 mellon Exp $ */ /* @@ -40,7 +40,7 @@ static const char copyright[] = #if 0 static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: tip.c,v 1.26 2006/03/17 14:43:06 moritz Exp $"; +static const char rcsid[] = "$OpenBSD: tip.c,v 1.27 2006/03/17 19:39:46 deraadt Exp $"; #endif /* not lint */ /* @@ -62,7 +62,7 @@ static int escape(void); int main(int argc, char *argv[]) { - char *system = NOSTR, sbuf[12], *p; + char *sys = NOSTR, sbuf[12], *p; int i; gid = getgid(); @@ -86,7 +86,7 @@ main(int argc, char *argv[]) for (; argc > 1; argv++, argc--) { if (argv[1][0] != '-') - system = argv[1]; + sys = argv[1]; else switch (argv[1][1]) { case 'v': @@ -109,26 +109,26 @@ main(int argc, char *argv[]) } } - if (system == NOSTR) + if (sys == NOSTR) goto notnumber; - if (isalpha(*system)) + if (isalpha(*sys)) goto notnumber; /* * System name is really a phone number... * Copy the number then stomp on the original (in case the number * is private, we don't want 'ps' or 'w' to find it). */ - if (strlen(system) > sizeof PNbuf - 1) { + if (strlen(sys) > sizeof PNbuf - 1) { fprintf(stderr, "%s: phone number too long (max = %d bytes)\n", __progname, (int)sizeof(PNbuf) - 1); exit(1); } - strncpy( PNbuf, system, sizeof PNbuf - 1 ); - for (p = system; *p; p++) + strlcpy(PNbuf, sys, sizeof PNbuf - 1); + for (p = sys; *p; p++) *p = '\0'; PN = PNbuf; (void)snprintf(sbuf, sizeof(sbuf), "tip%ld", BR); - system = sbuf; + sys = sbuf; notnumber: (void)signal(SIGINT, cleanup); @@ -137,7 +137,7 @@ notnumber: (void)signal(SIGTERM, cleanup); (void)signal(SIGCHLD, SIG_DFL); - if ((i = hunt(system)) == 0) { + if ((i = hunt(sys)) == 0) { printf("all ports busy\n"); exit(3); } @@ -249,7 +249,7 @@ cleanup(int signo) daemon_uid(); (void)uu_unlock(uucplock); if (odisc) - ioctl(0, TIOCSETD, (char *)&odisc); + ioctl(0, TIOCSETD, &odisc); unraw(); if (signo && tipout_pid) { kill(tipout_pid, signo); @@ -347,6 +347,7 @@ prompt(char *s, char *p, size_t sz) /* * Interrupt service routine during prompting */ +/*ARGSUSED*/ static void intprompt(int signo) { @@ -362,7 +363,7 @@ intprompt(int signo) static void tipin(void) { - char bol = 1; + int bol = 1; int gch; char ch; @@ -551,7 +552,7 @@ static char partab[0200]; * with the right parity and output it. */ void -parwrite(int fd, char *buf, int n) +parwrite(int fd, char *buf, size_t n) { int i; char *bp; diff --git a/usr.bin/tip/tip.h b/usr.bin/tip/tip.h index 3a7bdb1ea25..8b75cafc034 100644 --- a/usr.bin/tip/tip.h +++ b/usr.bin/tip/tip.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tip.h,v 1.23 2006/03/17 19:17:13 moritz Exp $ */ +/* $OpenBSD: tip.h,v 1.24 2006/03/17 19:39:46 deraadt Exp $ */ /* $NetBSD: tip.h,v 1.7 1997/04/20 00:02:46 mellon Exp $ */ /* @@ -322,7 +322,7 @@ void help(int); void listvariables(int); void logent(char *, char *, char *, char *); void loginit(void); -void parwrite(int, char *, int); +void parwrite(int, char *, size_t); void pipefile(int); void pipeout(int); void raw(void); diff --git a/usr.bin/tip/tipout.c b/usr.bin/tip/tipout.c index 14e752e5774..6463949e683 100644 --- a/usr.bin/tip/tipout.c +++ b/usr.bin/tip/tipout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tipout.c,v 1.15 2006/03/17 17:43:15 deraadt Exp $ */ +/* $OpenBSD: tipout.c,v 1.16 2006/03/17 19:39:46 deraadt Exp $ */ /* $NetBSD: tipout.c,v 1.5 1996/12/29 10:34:12 cgd Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)tipout.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: tipout.c,v 1.15 2006/03/17 17:43:15 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: tipout.c,v 1.16 2006/03/17 19:39:46 deraadt Exp $"; #endif /* not lint */ #include "tip.h" @@ -127,7 +127,7 @@ tipout(void) { char buf[BUFSIZ]; char *cp; - int cnt; + size_t cnt; sigset_t mask, omask; signal(SIGINT, SIG_IGN); |