diff options
author | Moritz Jodeit <moritz@cvs.openbsd.org> | 2006-03-17 14:43:07 +0000 |
---|---|---|
committer | Moritz Jodeit <moritz@cvs.openbsd.org> | 2006-03-17 14:43:07 +0000 |
commit | b678932bdb4b0fd73d046c7eb934809c2e3e605d (patch) | |
tree | 5466b01c4a9586066e4adb231293812efc59be2a /usr.bin | |
parent | 6d052bb0ddd1b432e9e85fc458c8d131d179f76e (diff) |
big prototype cleanup:
o make more functions static
o add all the prototypes to tip.h
o consistently declare functions in the cmd table
testing and ok dhill@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tip/acu.c | 8 | ||||
-rw-r--r-- | usr.bin/tip/aculib/biz22.c | 17 | ||||
-rw-r--r-- | usr.bin/tip/aculib/courier.c | 16 | ||||
-rw-r--r-- | usr.bin/tip/aculib/df.c | 21 | ||||
-rw-r--r-- | usr.bin/tip/aculib/hayes.c | 14 | ||||
-rw-r--r-- | usr.bin/tip/aculib/t3000.c | 16 | ||||
-rw-r--r-- | usr.bin/tip/aculib/ventel.c | 16 | ||||
-rw-r--r-- | usr.bin/tip/cmds.c | 84 | ||||
-rw-r--r-- | usr.bin/tip/cmdtab.c | 8 | ||||
-rw-r--r-- | usr.bin/tip/cu.c | 9 | ||||
-rw-r--r-- | usr.bin/tip/hunt.c | 10 | ||||
-rw-r--r-- | usr.bin/tip/remote.c | 6 | ||||
-rw-r--r-- | usr.bin/tip/tip.c | 23 | ||||
-rw-r--r-- | usr.bin/tip/tip.h | 43 | ||||
-rw-r--r-- | usr.bin/tip/tipout.c | 19 | ||||
-rw-r--r-- | usr.bin/tip/value.c | 22 |
16 files changed, 170 insertions, 162 deletions
diff --git a/usr.bin/tip/acu.c b/usr.bin/tip/acu.c index f300689b390..4fdbea30afa 100644 --- a/usr.bin/tip/acu.c +++ b/usr.bin/tip/acu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acu.c,v 1.11 2006/03/16 19:32:46 deraadt Exp $ */ +/* $OpenBSD: acu.c,v 1.12 2006/03/17 14:43:06 moritz Exp $ */ /* $NetBSD: acu.c,v 1.4 1996/12/29 10:34:03 cgd Exp $ */ /* @@ -34,15 +34,15 @@ #if 0 static char sccsid[] = "@(#)acu.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: acu.c,v 1.11 2006/03/16 19:32:46 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: acu.c,v 1.12 2006/03/17 14:43:06 moritz Exp $"; #endif /* not lint */ #include "tip.h" static acu_t *acu = NOACU; static int conflag; -static void acuabort(); -static acu_t *acutype(); +static void acuabort(int); +static acu_t *acutype(char *); static jmp_buf jmpbuf; /* * Establish connection for tip diff --git a/usr.bin/tip/aculib/biz22.c b/usr.bin/tip/aculib/biz22.c index 75a0d13f46b..702faf0e7b4 100644 --- a/usr.bin/tip/aculib/biz22.c +++ b/usr.bin/tip/aculib/biz22.c @@ -1,4 +1,4 @@ -/* $OpenBSD: biz22.c,v 1.11 2003/06/03 02:56:18 millert Exp $ */ +/* $OpenBSD: biz22.c,v 1.12 2006/03/17 14:43:06 moritz Exp $ */ /* $NetBSD: biz22.c,v 1.6 1997/02/11 09:24:11 mrg Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)biz22.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: biz22.c,v 1.11 2003/06/03 02:56:18 millert Exp $"; +static const char rcsid[] = "$OpenBSD: biz22.c,v 1.12 2006/03/17 14:43:06 moritz Exp $"; #endif /* not lint */ #include "tip.h" @@ -42,7 +42,7 @@ static const char rcsid[] = "$OpenBSD: biz22.c,v 1.11 2003/06/03 02:56:18 miller #define DISCONNECT_CMD "\20\04" /* disconnection string */ static void sigALRM(); -static int timeout = 0; +static int dialtimeout = 0; static jmp_buf timeoutbuf; static int cmd(), detect(); @@ -91,7 +91,7 @@ biz_dialer(num, mod) */ connected = detect("1\r"); #ifdef ACULOG - if (timeout) { + if (dialtimeout) { char line[80]; (void)snprintf(line, sizeof line, "%ld second dial timeout", @@ -99,7 +99,7 @@ biz_dialer(num, mod) logent(value(HOST), num, "biz1022", line); } #endif - if (timeout) + if (dialtimeout) biz22_disconnect(); /* insurance */ return (connected); } @@ -138,8 +138,7 @@ biz22_abort() static void sigALRM() { - - timeout = 1; + dialtimeout = 1; longjmp(timeoutbuf, 1); } @@ -173,7 +172,7 @@ detect(s) char c; f = signal(SIGALRM, sigALRM); - timeout = 0; + dialtimeout = 0; while (*s) { if (setjmp(timeoutbuf)) { biz22_abort(); @@ -187,5 +186,5 @@ detect(s) return (0); } signal(SIGALRM, f); - return (timeout == 0); + return (dialtimeout == 0); } diff --git a/usr.bin/tip/aculib/courier.c b/usr.bin/tip/aculib/courier.c index 91350089355..0661f1e84f8 100644 --- a/usr.bin/tip/aculib/courier.c +++ b/usr.bin/tip/aculib/courier.c @@ -1,4 +1,4 @@ -/* $OpenBSD: courier.c,v 1.13 2003/06/03 02:56:18 millert Exp $ */ +/* $OpenBSD: courier.c,v 1.14 2006/03/17 14:43:06 moritz Exp $ */ /* $NetBSD: courier.c,v 1.7 1997/02/11 09:24:16 mrg Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)courier.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: courier.c,v 1.13 2003/06/03 02:56:18 millert Exp $"; +static const char rcsid[] = "$OpenBSD: courier.c,v 1.14 2006/03/17 14:43:06 moritz Exp $"; #endif /* not lint */ /* @@ -49,7 +49,7 @@ static const char rcsid[] = "$OpenBSD: courier.c,v 1.13 2003/06/03 02:56:18 mill static void cour_write(int fd, char *cp, int n); static void sigALRM(); -static int timeout = 0; +static int dialtimeout = 0; static int connected = 0; static jmp_buf timeoutbuf; static int coursync(), cour_connect(), cour_swallow(); @@ -104,13 +104,13 @@ badsynch: cour_write(FD, "\r", 1); connected = cour_connect(); #ifdef ACULOG - if (timeout) { + if (dialtimeout) { (void)snprintf(line, sizeof line, "%ld second dial timeout", number(value(DIALTIMEOUT))); logent(value(HOST), num, "cour", line); } #endif - if (timeout) + if (dialtimeout) cour_disconnect(); return (connected); } @@ -137,7 +137,7 @@ static void sigALRM() { printf("\07timeout waiting for reply\n"); - timeout = 1; + dialtimeout = 1; longjmp(timeoutbuf, 1); } @@ -149,7 +149,7 @@ cour_swallow(match) char c; f = signal(SIGALRM, sigALRM); - timeout = 0; + dialtimeout = 0; do { if (*match =='\0') { signal(SIGALRM, f); @@ -203,7 +203,7 @@ cour_connect() again: nc = 0; nl = sizeof(dialer_buf)-1; bzero(dialer_buf, sizeof(dialer_buf)); - timeout = 0; + dialtimeout = 0; for (nc = 0, nl = sizeof(dialer_buf)-1 ; nl > 0 ; nc++, nl--) { if (setjmp(timeoutbuf)) break; diff --git a/usr.bin/tip/aculib/df.c b/usr.bin/tip/aculib/df.c index 85ceed0f613..78f3d2d32d7 100644 --- a/usr.bin/tip/aculib/df.c +++ b/usr.bin/tip/aculib/df.c @@ -1,4 +1,4 @@ -/* $OpenBSD: df.c,v 1.7 2003/06/03 02:56:18 millert Exp $ */ +/* $OpenBSD: df.c,v 1.8 2006/03/17 14:43:06 moritz Exp $ */ /* $NetBSD: df.c,v 1.4 1995/10/29 00:49:51 pk Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)df.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: df.c,v 1.7 2003/06/03 02:56:18 millert Exp $"; +static const char rcsid[] = "$OpenBSD: df.c,v 1.8 2006/03/17 14:43:06 moritz Exp $"; #endif /* not lint */ /* @@ -44,9 +44,9 @@ static const char rcsid[] = "$OpenBSD: df.c,v 1.7 2003/06/03 02:56:18 millert Ex #include "tip.h" static jmp_buf Sjbuf; -static void timeout(); -static int df_dialer(char *num, char *acu, int df03); -static void df_disconnect(); +static void alrm_timeout(int); +static int df_dialer(char *, char *, int); +static void df_disconnect(void); int df02_dialer(num, acu) @@ -100,7 +100,7 @@ df_dialer(num, acu, df03) ioctl(f, TIOCMBIS, &st); /* set ST for 1200 baud */ } #endif - signal(SIGALRM, timeout); + signal(SIGALRM, alrm_timeout); alarm(5 * strlen(num) + 10); tcflush(f, TCIOFLUSH); write(f, "\001", 1); @@ -119,25 +119,22 @@ df_dialer(num, acu, df03) } void -df_disconnect() +df_disconnect(void) { write(FD, "\001", 1); sleep(1); tcflush(FD, TCIOFLUSH); } - void df_abort() { - df_disconnect(); } - +/*ARGSUSED*/ static void -timeout() +alrm_timeout(int signo) { - longjmp(Sjbuf, 1); } diff --git a/usr.bin/tip/aculib/hayes.c b/usr.bin/tip/aculib/hayes.c index b8b06b56671..65f5f9eb81b 100644 --- a/usr.bin/tip/aculib/hayes.c +++ b/usr.bin/tip/aculib/hayes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hayes.c,v 1.11 2003/06/03 02:56:18 millert Exp $ */ +/* $OpenBSD: hayes.c,v 1.12 2006/03/17 14:43:06 moritz Exp $ */ /* $NetBSD: hayes.c,v 1.6 1997/02/11 09:24:17 mrg Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)hayes.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: hayes.c,v 1.11 2003/06/03 02:56:18 millert Exp $"; +static const char rcsid[] = "$OpenBSD: hayes.c,v 1.12 2006/03/17 14:43:06 moritz Exp $"; #endif /* not lint */ /* @@ -68,7 +68,7 @@ static const char rcsid[] = "$OpenBSD: hayes.c,v 1.11 2003/06/03 02:56:18 miller #define min(a,b) ((a < b) ? a : b) static void sigALRM(); -static int timeout = 0; +static int dialtimeout = 0; static jmp_buf timeoutbuf; static char gobble(); static void error_rep(char c); @@ -131,13 +131,13 @@ hay_dialer(num, acu) } tcflush(FD, TCIOFLUSH); #ifdef ACULOG - if (timeout) { + if (dialtimeout) { (void)snprintf(line, sizeof line, "%ld second dial timeout", number(value(DIALTIMEOUT))); logent(value(HOST), num, "hayes", line); } #endif - if (timeout) + if (dialtimeout) hay_disconnect(); /* insurance */ return (connected); } @@ -169,7 +169,7 @@ sigALRM() { printf("\07timeout waiting for reply\n\r"); - timeout = 1; + dialtimeout = 1; longjmp(timeoutbuf, 1); } @@ -182,7 +182,7 @@ gobble(match) int i, status = 0; f = signal(SIGALRM, sigALRM); - timeout = 0; + dialtimeout = 0; #ifdef DEBUG printf("\ngobble: waiting for %s\n", match); #endif diff --git a/usr.bin/tip/aculib/t3000.c b/usr.bin/tip/aculib/t3000.c index 625c4c4a04c..f4331807902 100644 --- a/usr.bin/tip/aculib/t3000.c +++ b/usr.bin/tip/aculib/t3000.c @@ -1,4 +1,4 @@ -/* $OpenBSD: t3000.c,v 1.12 2003/06/03 02:56:18 millert Exp $ */ +/* $OpenBSD: t3000.c,v 1.13 2006/03/17 14:43:06 moritz Exp $ */ /* $NetBSD: t3000.c,v 1.5 1997/02/11 09:24:18 mrg Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)t3000.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: t3000.c,v 1.12 2003/06/03 02:56:18 millert Exp $"; +static const char rcsid[] = "$OpenBSD: t3000.c,v 1.13 2006/03/17 14:43:06 moritz Exp $"; #endif /* not lint */ /* @@ -49,7 +49,7 @@ static const char rcsid[] = "$OpenBSD: t3000.c,v 1.12 2003/06/03 02:56:18 miller #define MAXRETRY 5 static void sigALRM(); -static int timeout = 0; +static int dialtimeout = 0; static int connected = 0; static jmp_buf timeoutbuf; static int t3000_sync(), t3000_connect(), t3000_swallow(); @@ -104,13 +104,13 @@ badsynch: t3000_write(FD, "\r", 1); connected = t3000_connect(); #ifdef ACULOG - if (timeout) { + if (dialtimeout) { (void)snprintf(line, sizeof line, "%ld second dial timeout", number(value(DIALTIMEOUT))); logent(value(HOST), num, "t3000", line); } #endif - if (timeout) + if (dialtimeout) t3000_disconnect(); return (connected); } @@ -137,7 +137,7 @@ static void sigALRM() { printf("\07timeout waiting for reply\n"); - timeout = 1; + dialtimeout = 1; longjmp(timeoutbuf, 1); } @@ -149,7 +149,7 @@ t3000_swallow(match) char c; f = signal(SIGALRM, sigALRM); - timeout = 0; + dialtimeout = 0; do { if (*match =='\0') { signal(SIGALRM, f); @@ -217,7 +217,7 @@ t3000_connect() again: nc = 0; nl = sizeof(dialer_buf)-1; bzero(dialer_buf, sizeof(dialer_buf)); - timeout = 0; + dialtimeout = 0; for (nc = 0, nl = sizeof(dialer_buf)-1 ; nl > 0 ; nc++, nl--) { if (setjmp(timeoutbuf)) break; diff --git a/usr.bin/tip/aculib/ventel.c b/usr.bin/tip/aculib/ventel.c index 523269392b2..94a9571e6c3 100644 --- a/usr.bin/tip/aculib/ventel.c +++ b/usr.bin/tip/aculib/ventel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ventel.c,v 1.10 2003/06/03 02:56:18 millert Exp $ */ +/* $OpenBSD: ventel.c,v 1.11 2006/03/17 14:43:06 moritz Exp $ */ /* $NetBSD: ventel.c,v 1.6 1997/02/11 09:24:21 mrg Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)ventel.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: ventel.c,v 1.10 2003/06/03 02:56:18 millert Exp $"; +static const char rcsid[] = "$OpenBSD: ventel.c,v 1.11 2006/03/17 14:43:06 moritz Exp $"; #endif /* not lint */ /* @@ -48,7 +48,7 @@ static const char rcsid[] = "$OpenBSD: ventel.c,v 1.10 2003/06/03 02:56:18 mille #define MAXRETRY 5 static void sigALRM(); -static int timeout = 0; +static int dialtimeout = 0; static jmp_buf timeoutbuf; static int gobble(), vensync(); @@ -103,15 +103,15 @@ ven_dialer(num, acu) connected = gobble('!', line); tcflush(FD, TCIOFLUSH); #ifdef ACULOG - if (timeout) { + if (dialtimeout) { (void)snprintf(line, sizeof line, "%ld second dial timeout", number(value(DIALTIMEOUT))); logent(value(HOST), num, "ventel", line); } #endif - if (timeout) + if (dialtimeout) ven_disconnect(); /* insurance */ - if (connected || timeout || !boolean(value(VERBOSE))) + if (connected || dialtimeout || !boolean(value(VERBOSE))) return (connected); /* call failed, parse response for user */ cp = strchr(line, '\r'); @@ -177,7 +177,7 @@ static void sigALRM() { printf("\07timeout waiting for reply\n"); - timeout = 1; + dialtimeout = 1; longjmp(timeoutbuf, 1); } @@ -191,7 +191,7 @@ gobble(match, response) char c; f = signal(SIGALRM, sigALRM); - timeout = 0; + dialtimeout = 0; do { if (setjmp(timeoutbuf)) { signal(SIGALRM, f); diff --git a/usr.bin/tip/cmds.c b/usr.bin/tip/cmds.c index c6123f3b3c6..2e66c0e5761 100644 --- a/usr.bin/tip/cmds.c +++ b/usr.bin/tip/cmds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmds.c,v 1.23 2006/03/16 21:13:12 moritz Exp $ */ +/* $OpenBSD: cmds.c,v 1.24 2006/03/17 14:43:06 moritz 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.23 2006/03/16 21:13:12 moritz Exp $"; +static const char rcsid[] = "$OpenBSD: cmds.c,v 1.24 2006/03/17 14:43:06 moritz Exp $"; #endif /* not lint */ #include "tip.h" @@ -54,18 +54,26 @@ char null = '\0'; char *sep[] = { "second", "minute", "hour" }; static char *argv[10]; /* argument vector for take and put */ -void timeout(int); /* timeout function called on alarm */ -void stopsnd(int); /* SIGINT handler during file transfers */ -void intcopy(int); /* interrupt routine for file transfers */ +static void transfer(char *, int, char *); +static void stopsnd(int); /* SIGINT handler during file transfers */ +static void intcopy(int); /* interrupt routine for file transfers */ +static void transmit(FILE *, char *, char *); +static void send(int); +static void execute(char *); +static int args(char *, char **, int); +static void prtime(char *, time_t); +static void tandem(char *); +static void hardwareflow(char *); +static int anyof(char *, char *); /* * FTP - remote ==> local * get a file from the remote host */ void -getfl(char c) +getfl(int c) { - char buf[256], *cp, *expand(char *); + char buf[256], *cp; putchar(c); /* @@ -93,10 +101,10 @@ getfl(char c) * Cu-like take command */ void -cu_take(char cc) +cu_take(int c) { int fd, argc; - char line[BUFSIZ], *expand(char *), *cp; + char line[BUFSIZ], *cp; if (prompt("[take] ", copyname, sizeof(copyname))) return; @@ -122,7 +130,7 @@ static jmp_buf intbuf; * Bulk transfer routine -- * used by getfl(), cu_take(), and pipefile() */ -void +static void transfer(char *buf, int fd, char *eofchars) { int ct; @@ -196,8 +204,9 @@ transfer(char *buf, int fd, char *eofchars) * FTP - remote ==> local process * send remote input to local process via pipe */ +/*ARGSUSED*/ void -pipefile(void) +pipefile(int c) { int pdes[2]; char buf[256]; @@ -244,10 +253,9 @@ pipefile(void) * Interrupt service routine for FTP */ /*ARGSUSED*/ -void +static void stopsnd(int signo) { - stop = 1; signal(SIGINT, SIG_IGN); } @@ -258,13 +266,12 @@ stopsnd(int signo) * terminate transmission with pseudo EOF sequence */ void -sendfile(char cc) +sendfile(int c) { FILE *fp; char *fnamex; - char *expand(char *); - putchar(cc); + putchar(c); /* * get file name */ @@ -288,7 +295,7 @@ sendfile(char cc) * Bulk transfer routine to remote host -- * used by sendfile() and cu_put() */ -void +static void transmit(FILE *fp, char *eofchars, char *command) { char *pc, lastc; @@ -384,13 +391,13 @@ out: /* * Cu-like put command */ +/*ARGSUSED*/ void -cu_put(char cc) +cu_put(int c) { FILE *fp; char line[BUFSIZ]; int argc; - char *expand(char *); char *copynamex; if (prompt("[put] ", copyname, sizeof(copyname))) @@ -419,7 +426,7 @@ cu_put(char cc) * FTP - send single character * wait for echo & handle timeout */ -void +static void send(int c) { char cc; @@ -562,8 +569,9 @@ consh(int c) /* * Escape to local shell */ +/*ARGSUSED*/ void -shell(void) +shell(int c) { int status; char *cp; @@ -621,8 +629,9 @@ setscript(void) * Change current working directory of * local portion of tip */ +/*ARGSUSED*/ void -chdirectory(void) +chdirectory(int c) { char dirname[PATH_MAX]; char *cp = dirname; @@ -653,8 +662,9 @@ tipabort(char *msg) exit(0); } +/*ARGSUSED*/ void -finish(void) +finish(int c) { char *dismsg; @@ -665,7 +675,7 @@ finish(void) tipabort(NOSTR); } -void +static void intcopy(int signo) { raw(); @@ -673,7 +683,7 @@ intcopy(int signo) longjmp(intbuf, 1); } -void +static void execute(char *s) { char *cp; @@ -686,7 +696,7 @@ execute(char *s) execl(value(SHELL), cp, "-c", s, (char *)NULL); } -int +static int args(char *buf, char *a[], int num) { char *p = buf, *start; @@ -710,7 +720,7 @@ args(char *buf, char *a[], int num) return(n); } -void +static void prtime(char *s, time_t a) { int i; @@ -728,8 +738,9 @@ prtime(char *s, time_t a) printf("\r\n!\r\n"); } +/*ARGSUSED*/ void -variable(void) +variable(int c) { char buf[256]; @@ -779,8 +790,9 @@ variable(void) } } +/*ARGSUSED*/ void -listvariables(void) +listvariables(int c) { value_t *p; char buf[BUFSIZ]; @@ -816,7 +828,7 @@ listvariables(void) /* * Turn tandem mode on or off for remote tty. */ -void +static void tandem(char *option) { struct termios rmtty; @@ -836,7 +848,7 @@ tandem(char *option) /* * Turn hardware flow control on or off for remote tty. */ -void +static void hardwareflow(char *option) { struct termios rmtty; @@ -852,10 +864,10 @@ hardwareflow(char *option) /* * Send a break. */ +/*ARGSUSED*/ void -genbrk(void) +genbrk(int c) { - ioctl(FD, TIOCSBRK, NULL); sleep(1); ioctl(FD, TIOCCBRK, NULL); @@ -865,9 +877,8 @@ genbrk(void) * Suspend tip */ void -suspend(char c) +suspend(int c) { - unraw(); kill(c == CTRL('y') ? getpid() : 0, SIGTSTP); raw(); @@ -876,7 +887,6 @@ suspend(char c) /* * expand a file name if it includes shell meta characters */ - char * expand(char name[]) { @@ -947,7 +957,7 @@ expand(char name[]) /* * Are any of the characters in the two strings the same? */ -int +static int anyof(char *s1, char *s2) { int c; diff --git a/usr.bin/tip/cmdtab.c b/usr.bin/tip/cmdtab.c index b0e7e00863a..99b563d7ad7 100644 --- a/usr.bin/tip/cmdtab.c +++ b/usr.bin/tip/cmdtab.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmdtab.c,v 1.6 2006/03/16 19:32:46 deraadt Exp $ */ +/* $OpenBSD: cmdtab.c,v 1.7 2006/03/17 14:43:06 moritz Exp $ */ /* $NetBSD: cmdtab.c,v 1.3 1994/12/08 09:30:46 jtc Exp $ */ /* @@ -34,15 +34,11 @@ #if 0 static char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: cmdtab.c,v 1.6 2006/03/16 19:32:46 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: cmdtab.c,v 1.7 2006/03/17 14:43:06 moritz Exp $"; #endif /* not lint */ #include "tip.h" -extern int shell(int), getfl(int), sendfile(int), chdirectory(int); -extern int finish(int), help(int), pipefile(int), pipeout(int), consh(int), variable(int); -extern int cu_take(int), cu_put(int), dollar(int), genbrk(int), suspend(int), listvariables(int); - esctable_t etable[] = { { '!', NORM, "shell", shell }, { '<', NORM, "receive file from remote host", getfl }, diff --git a/usr.bin/tip/cu.c b/usr.bin/tip/cu.c index 15ef76b3b39..85cb0e19a09 100644 --- a/usr.bin/tip/cu.c +++ b/usr.bin/tip/cu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cu.c,v 1.17 2006/03/16 19:32:46 deraadt Exp $ */ +/* $OpenBSD: cu.c,v 1.18 2006/03/17 14:43:06 moritz Exp $ */ /* $NetBSD: cu.c,v 1.5 1997/02/11 09:24:05 mrg Exp $ */ /* @@ -34,13 +34,12 @@ #if 0 static char sccsid[] = "@(#)cu.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: cu.c,v 1.17 2006/03/16 19:32:46 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: cu.c,v 1.18 2006/03/17 14:43:06 moritz Exp $"; #endif /* not lint */ #include "tip.h" -void cleanup(); -void cuusage(); +static void cuusage(void); /* * Botch the interface to look like cu's @@ -187,7 +186,7 @@ cumain(int argc, char *argv[]) } } -void +static void cuusage(void) { fprintf(stderr, "usage: cu [-ehot] [-a acu] [-l line] [-s speed] [-#] " diff --git a/usr.bin/tip/hunt.c b/usr.bin/tip/hunt.c index 4d102e3370a..8cc46d3022d 100644 --- a/usr.bin/tip/hunt.c +++ b/usr.bin/tip/hunt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hunt.c,v 1.11 2006/03/16 19:32:46 deraadt Exp $ */ +/* $OpenBSD: hunt.c,v 1.12 2006/03/17 14:43:06 moritz Exp $ */ /* $NetBSD: hunt.c,v 1.6 1997/04/20 00:02:10 mellon Exp $ */ /* @@ -34,17 +34,17 @@ #if 0 static char sccsid[] = "@(#)hunt.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: hunt.c,v 1.11 2006/03/16 19:32:46 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: hunt.c,v 1.12 2006/03/17 14:43:06 moritz Exp $"; #endif /* not lint */ #include "tip.h" -extern char *getremote(char *); - static jmp_buf deadline; static int deadfl; -void +static void dead(int); + +static void dead(int signo) { deadfl = 1; diff --git a/usr.bin/tip/remote.c b/usr.bin/tip/remote.c index 1dd89425647..1384d5c6ba2 100644 --- a/usr.bin/tip/remote.c +++ b/usr.bin/tip/remote.c @@ -1,4 +1,4 @@ -/* $OpenBSD: remote.c,v 1.14 2006/03/16 19:32:46 deraadt Exp $ */ +/* $OpenBSD: remote.c,v 1.15 2006/03/17 14:43:06 moritz Exp $ */ /* $NetBSD: remote.c,v 1.5 1997/04/20 00:02:45 mellon Exp $ */ /* @@ -41,7 +41,7 @@ static const char copyright[] = #if 0 static char sccsid[] = "@(#)remote.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: remote.c,v 1.14 2006/03/16 19:32:46 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: remote.c,v 1.15 2006/03/17 14:43:06 moritz Exp $"; #endif /* not lint */ #include <stdio.h> @@ -68,6 +68,8 @@ static char *db_array[3] = { _PATH_REMOTE, 0, 0 }; #define cgetflag(f) (cgetcap(bp, f, ':') != NULL) +static void getremcap(char *); + static void getremcap(char *host) { diff --git a/usr.bin/tip/tip.c b/usr.bin/tip/tip.c index a2d90259374..975337e550e 100644 --- a/usr.bin/tip/tip.c +++ b/usr.bin/tip/tip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tip.c,v 1.25 2006/03/16 19:32:46 deraadt Exp $ */ +/* $OpenBSD: tip.c,v 1.26 2006/03/17 14:43:06 moritz 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.25 2006/03/16 19:32:46 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: tip.c,v 1.26 2006/03/17 14:43:06 moritz Exp $"; #endif /* not lint */ /* @@ -53,11 +53,12 @@ static const char rcsid[] = "$OpenBSD: tip.c,v 1.25 2006/03/16 19:32:46 deraadt #include "pathnames.h" int disc = TTYDISC; /* tip normally runs this way */ -void intprompt(); -void timeout(); -void cleanup(int); char PNbuf[256]; /* This limits the size of a number */ +static void intprompt(int); +static void tipin(void); +static int escape(void); + int main(int argc, char *argv[]) { @@ -245,7 +246,6 @@ cucommon: void cleanup(int signo) { - daemon_uid(); (void)uu_unlock(uucplock); if (odisc) @@ -347,10 +347,9 @@ prompt(char *s, char *p, size_t sz) /* * Interrupt service routine during prompting */ -void -intprompt(void) +static void +intprompt(int signo) { - (void)signal(SIGINT, SIG_IGN); stoprompt = 1; printf("\r\n"); @@ -360,7 +359,7 @@ intprompt(void) /* * ****TIPIN TIPIN**** */ -void +static void tipin(void) { char bol = 1; @@ -415,7 +414,7 @@ extern esctable_t etable[]; * Escape handler -- * called on recognition of ``escapec'' at the beginning of a line */ -int +static int escape(void) { int gch; @@ -503,7 +502,7 @@ ctrl(char c) * Help command */ void -help(char c) +help(int c) { esctable_t *p; diff --git a/usr.bin/tip/tip.h b/usr.bin/tip/tip.h index daa4b2ef53d..0eeffd5698e 100644 --- a/usr.bin/tip/tip.h +++ b/usr.bin/tip/tip.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tip.h,v 1.20 2006/03/16 21:13:12 moritz Exp $ */ +/* $OpenBSD: tip.h,v 1.21 2006/03/17 14:43:06 moritz Exp $ */ /* $NetBSD: tip.h,v 1.7 1997/04/20 00:02:46 mellon Exp $ */ /* @@ -168,7 +168,7 @@ typedef char e_char; /* char to match on */ char e_flags; /* experimental, privileged */ char *e_help; /* help string */ - int (*e_func)(int); /* command */ + void (*e_func)(int); /* command */ } esctable_t; @@ -269,16 +269,12 @@ extern int disc; /* current tty discpline */ extern char *__progname; /* program name */ -extern char *ctrl(char); -extern char *vinterp(char *, int); -extern char *con(void); - -char *sname(char *); +char *con(void); +char *ctrl(char); +char *expand(char *); +char *getremote(char *); char *interp(char *); int any(int, char *); -int anyof(char *, char *); -int args(char *, char **, int); -int escape(void); int prompt(char *, char *, size_t); int size(char *); int ttysetup(int); @@ -286,27 +282,36 @@ int uu_lock(char *); int uu_unlock(char *); int vstring(char *, char *); long hunt(char *); +void chdirectory(int); +void cleanup(int); +void consh(int); +void cu_put(int); +void cu_take(int); void cumain(int, char **); void daemon_uid(void); void disconnect(char *); -void execute(char *); -void hardwareflow(char *); +void finish(int); +void genbrk(int); +void getfl(int); +void help(int); +void listvariables(int); void logent(char *, char *, char *, char *); void loginit(void); -void prtime(char *, time_t); void parwrite(int, char *, int); +void pipefile(int); +void pipeout(int); void raw(void); -void send(int); +void sendfile(int); void setparity(char *); void setscript(void); +void shell(int); void shell_uid(void); -void tandem(char *); +void suspend(int); +void timeout(int); void tipabort(char *); -void tipin(void); void tipout(void); -void transfer(char *, int, char *); -void transmit(FILE *, char *, char *); -void unraw(void); void user_uid(void); +void unraw(void); +void variable(int); void vinit(void); void vlex(char *); diff --git a/usr.bin/tip/tipout.c b/usr.bin/tip/tipout.c index 29494f33d4d..b62af2f51b6 100644 --- a/usr.bin/tip/tipout.c +++ b/usr.bin/tip/tipout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tipout.c,v 1.13 2006/03/16 19:32:46 deraadt Exp $ */ +/* $OpenBSD: tipout.c,v 1.14 2006/03/17 14:43:06 moritz 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.13 2006/03/16 19:32:46 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: tipout.c,v 1.14 2006/03/17 14:43:06 moritz Exp $"; #endif /* not lint */ #include "tip.h" @@ -48,14 +48,18 @@ static const char rcsid[] = "$OpenBSD: tipout.c,v 1.13 2006/03/16 19:32:46 deraa static jmp_buf sigbuf; +static void intIOT(int); +static void intEMT(int); +static void intTERM(int); +static void intSYS(int); + /* * TIPOUT wait state routine -- * sent by TIPIN when it wants to posses the remote host */ -void +static void intIOT(int signo) { - write(repdes[1],&ccc,1); read(fildes[0], &ccc,1); longjmp(sigbuf, 1); @@ -65,7 +69,7 @@ intIOT(int signo) * Scripting command interpreter -- * accepts script file name over the pipe and acts accordingly */ -void +static void intEMT(int signo) { char c, line[256]; @@ -95,7 +99,7 @@ intEMT(int signo) longjmp(sigbuf, 1); } -void +static void intTERM(int signo) { if (boolean(value(SCRIPT)) && fscript != NULL) @@ -105,10 +109,9 @@ intTERM(int signo) exit(0); } -void +static void intSYS(int signo) { - setboolean(value(BEAUTIFY), !boolean(value(BEAUTIFY))); longjmp(sigbuf, 1); } diff --git a/usr.bin/tip/value.c b/usr.bin/tip/value.c index b3c7fc4ddc0..9f262c7ff23 100644 --- a/usr.bin/tip/value.c +++ b/usr.bin/tip/value.c @@ -1,4 +1,4 @@ -/* $OpenBSD: value.c,v 1.12 2006/03/16 21:13:12 moritz Exp $ */ +/* $OpenBSD: value.c,v 1.13 2006/03/17 14:43:06 moritz Exp $ */ /* $NetBSD: value.c,v 1.6 1997/02/11 09:24:09 mrg Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)value.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: value.c,v 1.12 2006/03/16 21:13:12 moritz Exp $"; +static const char rcsid[] = "$OpenBSD: value.c,v 1.13 2006/03/17 14:43:06 moritz Exp $"; #endif /* not lint */ #include "tip.h" @@ -42,7 +42,12 @@ static const char rcsid[] = "$OpenBSD: value.c,v 1.12 2006/03/16 21:13:12 moritz #define MIDDLE 35 static value_t *vlookup(char *); -static int vaccess(unsigned int mode, unsigned int rw); +static void vassign(value_t *, char *); +static void vtoken(char *); +static void vprint(value_t *); +static int vaccess(unsigned int, unsigned int); +static char *vinterp(char *, int); + static int col = 0; /* @@ -91,10 +96,9 @@ vinit(void) } /*VARARGS1*/ -void +static void vassign(value_t *p, char *v) { - if (!vaccess(p->v_access, WRITE)) { printf("access denied\r\n"); return; @@ -130,9 +134,6 @@ vassign(value_t *p, char *v) p->v_access |= CHANGED; } -static void vprint(); -static void vtoken(); - void vlex(char *s) { @@ -162,7 +163,6 @@ vtoken(char *s) { value_t *p; char *cp; - char *expand(char *); if ((cp = strchr(s, '='))) { *cp = '\0'; @@ -247,7 +247,6 @@ vprint(value_t *p) } } - static int vaccess(unsigned int mode, unsigned int rw) { @@ -269,7 +268,7 @@ vlookup(char *s) return (NULL); } -char * +static char * vinterp(char *s, int stop) { char *p = s, c; @@ -328,7 +327,6 @@ int vstring(char *s, char *v) { value_t *p; - char *expand(char *); p = vlookup(s); if (p == 0) |