diff options
| author | christos <christos@NetBSD.org> | 1998-02-27 10:44:12 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 1998-02-27 10:44:12 +0000 |
| commit | 434ea11b221a41f03472ef7308a8a5bcec83f84f (patch) | |
| tree | 435fed39d33a65460d71960aa4d434b6af603737 | |
| parent | 0667d12238f09717fa762c94a026ab6e290e0c06 (diff) | |
WARNSify and fix problems passing int * -> long *
| -rw-r--r-- | usr.bin/telnet/Makefile | 3 | ||||
| -rw-r--r-- | usr.bin/telnet/authenc.c | 5 | ||||
| -rw-r--r-- | usr.bin/telnet/commands.c | 340 | ||||
| -rw-r--r-- | usr.bin/telnet/externs.h | 228 | ||||
| -rw-r--r-- | usr.bin/telnet/main.c | 20 | ||||
| -rw-r--r-- | usr.bin/telnet/network.c | 8 | ||||
| -rw-r--r-- | usr.bin/telnet/ring.c | 8 | ||||
| -rw-r--r-- | usr.bin/telnet/ring.h | 9 | ||||
| -rw-r--r-- | usr.bin/telnet/sys_bsd.c | 31 | ||||
| -rw-r--r-- | usr.bin/telnet/telnet.c | 52 | ||||
| -rw-r--r-- | usr.bin/telnet/terminal.c | 5 | ||||
| -rw-r--r-- | usr.bin/telnet/tn3270.c | 9 | ||||
| -rw-r--r-- | usr.bin/telnet/utilities.c | 12 |
13 files changed, 451 insertions, 279 deletions
diff --git a/usr.bin/telnet/Makefile b/usr.bin/telnet/Makefile index a39343dbda4..afd80c7d604 100644 --- a/usr.bin/telnet/Makefile +++ b/usr.bin/telnet/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.9 1997/10/24 09:01:05 lukem Exp $ +# $NetBSD: Makefile,v 1.10 1998/02/27 10:44:12 christos Exp $ # # Copyright (c) 1990 The Regents of the University of California. # All rights reserved. @@ -34,7 +34,6 @@ # from: @(#)Makefile 8.1 (Berkeley) 6/6/93 # -WARNS= 0 PROG= telnet CPPFLAGS+=-DTERMCAP -DKLUDGELINEMODE -DUSE_TERMIO -Dunix diff --git a/usr.bin/telnet/authenc.c b/usr.bin/telnet/authenc.c index 36e3f05af1f..59488538488 100644 --- a/usr.bin/telnet/authenc.c +++ b/usr.bin/telnet/authenc.c @@ -1,4 +1,4 @@ -/* $NetBSD: authenc.c,v 1.5 1996/02/28 21:03:52 thorpej Exp $ */ +/* $NetBSD: authenc.c,v 1.6 1998/02/27 10:44:12 christos Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -33,11 +33,12 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)authenc.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$NetBSD: authenc.c,v 1.5 1996/02/28 21:03:52 thorpej Exp $"; +__RCSID("$NetBSD: authenc.c,v 1.6 1998/02/27 10:44:12 christos Exp $"); #endif #endif /* not lint */ diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c index 02aecbdb88d..dd90a990ab4 100644 --- a/usr.bin/telnet/commands.c +++ b/usr.bin/telnet/commands.c @@ -1,4 +1,4 @@ -/* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */ +/* $NetBSD: commands.c,v 1.15 1998/02/27 10:44:12 christos Exp $ */ /* * Copyright (c) 1988, 1990, 1993 @@ -33,11 +33,12 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95"; #else -static char rcsid[] = "$NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $"; +__RCSID("$NetBSD: commands.c,v 1.15 1998/02/27 10:44:12 christos Exp $"); #endif #endif /* not lint */ @@ -50,8 +51,10 @@ static char rcsid[] = "$NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $" #else #include <sys/types.h> #endif /* defined(unix) */ +#include <sys/wait.h> #include <sys/socket.h> #include <netinet/in.h> +#include <arpa/inet.h> #ifdef CRAY #include <fcntl.h> #endif /* CRAY */ @@ -60,8 +63,13 @@ static char rcsid[] = "$NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $" #include <netdb.h> #include <ctype.h> #include <pwd.h> +#ifdef __STDC__ +#include <stdarg.h> +#else #include <varargs.h> +#endif #include <errno.h> +#include <unistd.h> #include <arpa/telnet.h> #include <sys/cdefs.h> @@ -74,6 +82,7 @@ static char rcsid[] = "$NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $" #include "externs.h" #include "defines.h" #include "types.h" +#include <libtelnet/misc.h> #if !defined(CRAY) && !defined(sysV88) #include <netinet/in_systm.h> @@ -95,18 +104,11 @@ int tos = -1; char *hostname; static char _hostname[MAXHOSTNAMELEN]; -extern char *getenv(); - -extern int isprefix(); -extern char **genget(); -extern int Ambiguous(); - -static call(); - typedef struct { char *name; /* command name */ char *help; /* help string (NULL for no help) */ - int (*handler)(); /* routine which executes command */ + int (*handler) /* routine which executes command */ + P((int, char *[])); int needconnect; /* Do we need to be connected to execute? */ } Command; @@ -115,6 +117,54 @@ static char saveline[256]; static int margc; static char *margv[20]; +static void makeargv P((void)); +static special P((char *)); +static char *control P((cc_t)); +static int sendcmd P((int, char **)); +static int send_esc P((char *)); +static int send_docmd P((char *)); +static int send_dontcmd P((char *)); +static int send_willcmd P((char *)); +static int send_wontcmd P((char *)); +static int send_help P((char *)); +static int lclchars P((int)); +static int togdebug P((int)); +static int togcrlf P((int)); +static int togbinary P((int)); +static int togrbinary P((int)); +static int togxbinary P((int)); +static int togglehelp P((int)); +static void settogglehelp P((int)); +static int toggle P((int, char *[])); +static struct setlist *getset P((char *)); +static int setcmd P((int, char *[])); +static int unsetcmd P((int, char *[])); +static int dokludgemode P((int)); +static int dolinemode P((int)); +static int docharmode P((int)); +static int dolmmode P((int, int )); +static int modecmd P((int, char *[])); +static int display P((int, char *[])); +static int setescape P((int, char *[])); +static int togcrmod P((int, char *[])); +static bye P((int, char *[])); +static void slc_help P((int)); +static struct slclist *getslc P((char *)); +static slccmd P((int, char *[])); +static struct env_lst *env_help P((unsigned char *, unsigned char *)); +static struct envlist *getenvcmd P((char *)); +#ifdef AUTHENTICATION +static int auth_help P((void)); +#endif +#if defined(unix) && defined(TN3270) +static void filestuff P((int)); +#endif +static status P((int, char *[])); +typedef int (*intrtn_t) P((int, char **)); +static int call P((intrtn_t, ...)); +static Command *getcmd P((char *)); +static help P((int, char *[])); + static void makeargv() { @@ -129,7 +179,7 @@ makeargv() margc++; cp++; } - while (c = *cp) { + while ((c = *cp) != '\0') { register int inquote = 0; while (isspace(c)) c = *++cp; @@ -172,7 +222,7 @@ makeargv() * Todo: 1. Could take random integers (12, 0x12, 012, 0b1). */ - static + static int special(s) register char *s; { @@ -248,20 +298,13 @@ struct sendlist { char *help; /* Help information (0 ==> no help) */ int needconnect; /* Need to be connected */ int narg; /* Number of arguments */ - int (*handler)(); /* Routine to perform (for special ops) */ + int (*handler) /* Routine to perform (for special ops) */ + P((char *)); int nbyte; /* Number of bytes to send this command */ int what; /* Character to be sent (<0 ==> special) */ }; -static int - send_esc P((void)), - send_help P((void)), - send_docmd P((char *)), - send_dontcmd P((char *)), - send_willcmd P((char *)), - send_wontcmd P((char *)); - static struct sendlist Sendlist[] = { { "ao", "Send Telnet Abort output", 1, 0, 0, 2, AO }, { "ayt", "Send Telnet 'Are You There'", 1, 0, 0, 2, AYT }, @@ -301,7 +344,6 @@ sendcmd(argc, argv) { int count; /* how many bytes we are going to need to send */ int i; - int question = 0; /* was at least one argument a question */ struct sendlist *s; /* pointer to current command */ int success = 0; int needconnect = 0; @@ -337,7 +379,7 @@ sendcmd(argc, argv) } count += s->nbyte; if (s->handler == send_help) { - send_help(); + send_help(NULL); return 0; } @@ -362,13 +404,12 @@ sendcmd(argc, argv) for (i = 1; i < argc; i++) { if ((s = GETSEND(argv[i])) == 0) { fprintf(stderr, "Telnet 'send' error - argument disappeared!\n"); - (void) quit(); + (void) quit(0, NULL); /*NOTREACHED*/ } if (s->handler) { count++; - success += (*s->handler)((s->narg > 0) ? argv[i+1] : 0, - (s->narg > 1) ? argv[i+2] : 0); + success += (*s->handler)(argv[i+1]); i += s->narg; } else { NET2ADD(IAC, s->what); @@ -379,7 +420,8 @@ sendcmd(argc, argv) } static int -send_esc() +send_esc(s) + char *s; { NETADD(escape); return 1; @@ -413,7 +455,7 @@ send_wontcmd(name) int send_tncmd(func, cmd, name) - void (*func)(); + void (*func) P((int, int)); char *cmd, *name; { char **cpp; @@ -475,7 +517,8 @@ send_tncmd(func, cmd, name) } static int -send_help() +send_help(n) + char *n; { struct sendlist *s; /* pointer to current command */ for (s = Sendlist; s->name; s++) { @@ -491,14 +534,16 @@ send_help() */ static int -lclchars() +lclchars(n) + int n; { donelclchars = 1; return 1; } static int -togdebug() +togdebug(n) + int n; { #ifndef NOT43 if (net > 0 && @@ -517,7 +562,8 @@ togdebug() static int -togcrlf() +togcrlf(n) + int n; { if (crlf) { printf("Will send carriage returns as telnet <CR><LF>.\n"); @@ -623,15 +669,11 @@ togxbinary(val) } -static int togglehelp P((void)); -#if defined(AUTHENTICATION) -extern int auth_togdebug P((int)); -#endif - struct togglelist { char *name; /* name of toggle */ char *help; /* help message */ - int (*handler)(); /* routine to do actual setting */ + int (*handler) /* routine to do actual setting */ + P((int)); int *variable; char *actionexplanation; }; @@ -681,7 +723,7 @@ static struct togglelist Togglelist[] = { 0 }, { "crlf", "sending carriage returns as telnet <CR><LF>", - togcrlf, + togcrlf, &crlf, 0 }, { "crmod", @@ -744,7 +786,8 @@ static struct togglelist Togglelist[] = { }; static int -togglehelp() +togglehelp(n) + int n; { struct togglelist *c; @@ -835,7 +878,7 @@ struct termio new_tc = { 0 }; struct setlist { char *name; /* name */ char *help; /* help information */ - void (*handler)(); + void (*handler) P((char *)); cc_t *charp; /* where it is located at */ }; @@ -1063,17 +1106,20 @@ unsetcmd(argc, argv) extern int kludgelinemode; static int -dokludgemode() +dokludgemode(n) + int n; { kludgelinemode = 1; send_wont(TELOPT_LINEMODE, 1); send_dont(TELOPT_SGA, 1); send_dont(TELOPT_ECHO, 1); + return 1; } #endif static int -dolinemode() +dolinemode(n) + int n; { #ifdef KLUDGELINEMODE if (kludgelinemode) @@ -1085,7 +1131,8 @@ dolinemode() } static int -docharmode() +docharmode(n) + int n; { #ifdef KLUDGELINEMODE if (kludgelinemode) @@ -1119,13 +1166,15 @@ dolmmode(bit, on) } int -setmode(bit) +set_mode(bit) + int bit; { return dolmmode(bit, 1); } int -clearmode(bit) +clear_mode(bit) + int bit; { return dolmmode(bit, 0); } @@ -1133,13 +1182,12 @@ clearmode(bit) struct modelist { char *name; /* command name */ char *help; /* help string */ - int (*handler)(); /* routine which executes command */ + int (*handler) /* routine which executes command */ + P((int)); int needconnect; /* Do we need to be connected to execute? */ int arg1; }; -extern int modehelp(); - static struct modelist ModeList[] = { { "character", "Disable LINEMODE option", docharmode, 1 }, #ifdef KLUDGELINEMODE @@ -1151,18 +1199,18 @@ static struct modelist ModeList[] = { #endif { "", "", 0 }, { "", "These require the LINEMODE option to be enabled", 0 }, - { "isig", "Enable signal trapping", setmode, 1, MODE_TRAPSIG }, - { "+isig", 0, setmode, 1, MODE_TRAPSIG }, - { "-isig", "Disable signal trapping", clearmode, 1, MODE_TRAPSIG }, - { "edit", "Enable character editing", setmode, 1, MODE_EDIT }, - { "+edit", 0, setmode, 1, MODE_EDIT }, - { "-edit", "Disable character editing", clearmode, 1, MODE_EDIT }, - { "softtabs", "Enable tab expansion", setmode, 1, MODE_SOFT_TAB }, - { "+softtabs", 0, setmode, 1, MODE_SOFT_TAB }, - { "-softtabs", "Disable character editing", clearmode, 1, MODE_SOFT_TAB }, - { "litecho", "Enable literal character echo", setmode, 1, MODE_LIT_ECHO }, - { "+litecho", 0, setmode, 1, MODE_LIT_ECHO }, - { "-litecho", "Disable literal character echo", clearmode, 1, MODE_LIT_ECHO }, + { "isig", "Enable signal trapping", set_mode, 1, MODE_TRAPSIG }, + { "+isig", 0, set_mode, 1, MODE_TRAPSIG }, + { "-isig", "Disable signal trapping", clear_mode, 1, MODE_TRAPSIG }, + { "edit", "Enable character editing", set_mode, 1, MODE_EDIT }, + { "+edit", 0, set_mode, 1, MODE_EDIT }, + { "-edit", "Disable character editing", clear_mode, 1, MODE_EDIT }, + { "softtabs", "Enable tab expansion", set_mode, 1, MODE_SOFT_TAB }, + { "+softtabs", 0, set_mode, 1, MODE_SOFT_TAB }, + { "-softtabs", "Disable character editing", clear_mode, 1, MODE_SOFT_TAB }, + { "litecho", "Enable literal character echo", set_mode, 1, MODE_LIT_ECHO }, + { "+litecho", 0, set_mode, 1, MODE_LIT_ECHO }, + { "-litecho", "Disable literal character echo", clear_mode, 1, MODE_LIT_ECHO }, { "help", 0, modehelp, 0 }, #ifdef KLUDGELINEMODE { "kludgeline", 0, dokludgemode, 1 }, @@ -1174,7 +1222,8 @@ static struct modelist ModeList[] = { int -modehelp() +modehelp(n) + int n; { struct modelist *mt; @@ -1318,7 +1367,9 @@ setescape(argc, argv) /*VARARGS*/ static int -togcrmod() +togcrmod(argc, argv) + int argc; + char *argv[]; { crmod = !crmod; printf("Deprecated usage - please use 'toggle crmod' in the future.\n"); @@ -1329,7 +1380,9 @@ togcrmod() /*VARARGS*/ int -suspend() +suspend(argc, argv) + int argc; + char *argv[]; { #ifdef SIGTSTP setcommandmode(); @@ -1380,7 +1433,6 @@ shell(argc, argv) * Fire up the shell in the child. */ register char *shellp, *shellname; - extern char *strrchr(); shellp = getenv("SHELL"); if (shellp == NULL) @@ -1412,7 +1464,7 @@ extern int shell(); #endif /* !defined(TN3270) */ /*VARARGS*/ - static + static int bye(argc, argv) int argc; /* Number of arguments */ char *argv[]; /* arguments */ @@ -1442,7 +1494,10 @@ bye(argc, argv) } /*VARARGS*/ -quit() +int +quit(argc, argv) + int argc; + char *argv[]; { (void) call(bye, "bye", "fromquit", 0); Exit(0); @@ -1451,7 +1506,9 @@ quit() /*VARARGS*/ int -logout() +logout(argc, argv) + int argc; + char *argv[]; { send_do(TELOPT_LOGOUT, 1); (void) netflush(); @@ -1466,12 +1523,10 @@ logout() struct slclist { char *name; char *help; - void (*handler)(); + void (*handler) P((int)); int arg; }; -static void slc_help(); - struct slclist SlcList[] = { { "export", "Use local special character definitions", slc_mode_export, 0 }, @@ -1485,7 +1540,8 @@ struct slclist SlcList[] = { }; static void -slc_help() +slc_help(n) + int n; { struct slclist *c; @@ -1507,7 +1563,7 @@ getslc(name) genget(name, (char **) SlcList, sizeof(struct slclist)); } - static + static int slccmd(argc, argv) int argc; char *argv[]; @@ -1542,27 +1598,13 @@ slccmd(argc, argv) struct envlist { char *name; char *help; - void (*handler)(); + struct env_lst *(*handler) P((unsigned char *, unsigned char *)); int narg; }; -extern struct env_lst * - env_define P((unsigned char *, unsigned char *)); -extern void - env_undefine P((unsigned char *)), - env_export P((unsigned char *)), - env_unexport P((unsigned char *)), - env_send P((unsigned char *)), -#if defined(OLD_ENVIRON) && defined(ENV_HACK) - env_varval P((unsigned char *)), -#endif - env_list P((void)); -static void - env_help P((void)); - struct envlist EnvList[] = { { "define", "Define an environment variable", - (void (*)())env_define, 2 }, + env_define, 2 }, { "undefine", "Undefine an environment variable", env_undefine, 1 }, { "export", "Mark an environment variable for automatic export", @@ -1581,8 +1623,9 @@ struct envlist EnvList[] = { { 0 }, }; - static void -env_help() + static struct env_lst * +env_help(us1, us2) + unsigned char *us1, *us2; { struct envlist *c; @@ -1594,6 +1637,7 @@ env_help() printf("\n"); } } + return NULL; } static struct envlist * @@ -1604,6 +1648,7 @@ getenvcmd(name) genget(name, (char **) EnvList, sizeof(struct envlist)); } + int env_cmd(argc, argv) int argc; char *argv[]; @@ -1667,10 +1712,9 @@ env_init() extern char **environ; register char **epp, *cp; register struct env_lst *ep; - extern char *strchr(); for (epp = environ; *epp; epp++) { - if (cp = strchr(*epp, '=')) { + if ((cp = strchr(*epp, '=')) != NULL) { *cp = '\0'; ep = env_define((unsigned char *)*epp, (unsigned char *)cp+1); @@ -1703,10 +1747,10 @@ env_init() */ if ((env_find("USER") == NULL) && (ep = env_find("LOGNAME"))) { env_define((unsigned char *)"USER", ep->value); - env_unexport((unsigned char *)"USER"); + env_unexport((unsigned char *)"USER", NULL); } - env_export((unsigned char *)"DISPLAY"); - env_export((unsigned char *)"PRINTER"); + env_export((unsigned char *)"DISPLAY", NULL); + env_export((unsigned char *)"PRINTER", NULL); } struct env_lst * @@ -1715,7 +1759,7 @@ env_define(var, value) { register struct env_lst *ep; - if (ep = env_find(var)) { + if ((ep = env_find(var)) != NULL) { if (ep->var) free(ep->var); if (ep->value) @@ -1735,13 +1779,14 @@ env_define(var, value) return(ep); } - void -env_undefine(var) + struct env_lst * +env_undefine(var, d) unsigned char *var; + unsigned char *d; { register struct env_lst *ep; - if (ep = env_find(var)) { + if ((ep = env_find(var)) != NULL) { ep->prev->next = ep->next; if (ep->next) ep->next->prev = ep->prev; @@ -1751,31 +1796,37 @@ env_undefine(var) free(ep->value); free(ep); } + return NULL; } - void -env_export(var) + struct env_lst * +env_export(var, d) unsigned char *var; + unsigned char *d; { register struct env_lst *ep; - if (ep = env_find(var)) + if ((ep = env_find(var)) != NULL) ep->export = 1; + return NULL; } - void -env_unexport(var) + struct env_lst * +env_unexport(var, d) unsigned char *var; + unsigned char *d; { register struct env_lst *ep; - if (ep = env_find(var)) + if ((ep = env_find(var)) != NULL) ep->export = 0; + return NULL; } - void -env_send(var) + struct env_lst * +env_send(var, d) unsigned char *var; + unsigned char *d; { register struct env_lst *ep; @@ -1787,21 +1838,23 @@ env_send(var) fprintf(stderr, "Cannot send '%s': Telnet ENVIRON option not enabled\n", var); - return; + return NULL; } ep = env_find(var); if (ep == 0) { fprintf(stderr, "Cannot send '%s': variable not defined\n", var); - return; + return NULL; } env_opt_start_info(); env_opt_add(ep->var); env_opt_end(0); + return NULL; } - void -env_list() + struct env_lst * +env_list(d1, d2) + unsigned char *d1, *d2; { register struct env_lst *ep; @@ -1809,6 +1862,7 @@ env_list() printf("%c %-20s %s\n", ep->export ? '*' : ' ', ep->var, ep->value); } + return NULL; } unsigned char * @@ -1819,10 +1873,10 @@ env_default(init, welldefined) if (init) { nep = &envlisthead; - return; + return NULL; } if (nep) { - while (nep = nep->next) { + while ((nep = nep->next) != NULL) { if (nep->export && (nep->welldefined == welldefined)) return(nep->var); } @@ -1836,7 +1890,7 @@ env_getvalue(var) { register struct env_lst *ep; - if (ep = env_find(var)) + if ((ep = env_find(var)) != NULL) return(ep->value); return(NULL); } @@ -1999,7 +2053,7 @@ filestuff(fd) * Print status about the connection. */ /*ARGSUSED*/ - static + static int status(argc, argv) int argc; char *argv[]; @@ -2069,14 +2123,13 @@ status(argc, argv) /* * Function that gets called when SIGINFO is received. */ +int ayt_status() { - (void) call(status, "status", "notmuch", 0); + return call(status, "status", "notmuch", 0); } #endif -unsigned long inet_addr(); - int tn(argc, argv) int argc; @@ -2086,12 +2139,14 @@ tn(argc, argv) struct sockaddr_in sin; struct servent *sp = 0; unsigned long temp; - extern char *inet_ntoa(); #if defined(IP_OPTIONS) && defined(IPPROTO_IP) - char *srp = 0, *strrchr(); - unsigned long sourceroute(), srlen; + char *srp = 0; + unsigned long srlen; #endif char *cmd, *hostp = 0, *portp = 0, *user = 0; +#ifdef __GNUC__ /* Avoid vfork clobbering */ + (void) &user; +#endif /* clear the socket address prior to use */ memset((char *)&sin, 0, sizeof(sin)); @@ -2295,8 +2350,8 @@ tn(argc, argv) user = getenv("USER"); if (user == NULL || - (pw = getpwnam(user)) && pw->pw_uid != getuid()) { - if (pw = getpwuid(getuid())) + ((pw = getpwnam(user)) && pw->pw_uid != getuid())) { + if ((pw = getpwuid(getuid())) != NULL) user = pw->pw_name; else user = NULL; @@ -2304,7 +2359,7 @@ tn(argc, argv) } if (user) { env_define((unsigned char *)"USER", (unsigned char *)user); - env_export((unsigned char *)"USER"); + env_export((unsigned char *)"USER", NULL); } (void) call(status, "status", "notmuch", 0); if (setjmp(peerdied) == 0) @@ -2342,8 +2397,6 @@ static char envhelp[] = "change environment variables ('environ ?' for more)", modestring[] = "try to enter line or character mode ('mode ?' for more)"; -static int help(); - static Command cmdtab[] = { { "close", closehelp, bye, 1 }, { "logout", logouthelp, logout, 1 }, @@ -2373,7 +2426,7 @@ static Command cmdtab[] = { #endif { "environ", envhelp, env_cmd, 0 }, { "?", helphelp, help, 0 }, - 0 + { NULL, NULL, NULL, 0 } }; static char crmodhelp[] = "deprecated command -- use 'toggle crmod' instead"; @@ -2383,7 +2436,7 @@ static Command cmdtab2[] = { { "help", 0, help, 0 }, { "escape", escapehelp, setescape, 0 }, { "crmod", crmodhelp, togcrmod, 0 }, - 0 + { NULL, NULL, NULL, 0 } }; @@ -2392,18 +2445,26 @@ static Command cmdtab2[] = { */ /*VARARGS1*/ - static + static int +#ifdef __STDC__ +call(intrtn_t routine, ...) +#else call(va_alist) va_dcl +#endif { va_list ap; - typedef int (*intrtn_t)(); - intrtn_t routine; char *args[100]; int argno = 0; +#ifndef __STDC__ + intrtn_t routine; va_start(ap); routine = (va_arg(ap, intrtn_t)); +#else + va_start(ap, routine); +#endif + while ((args[argno++] = va_arg(ap, char *)) != 0) { ; } @@ -2418,7 +2479,7 @@ getcmd(name) { Command *cm; - if (cm = (Command *) genget(name, (char **) cmdtab, sizeof(Command))) + if ((cm = (Command *) genget(name, (char **) cmdtab, sizeof(Command))) != NULL) return cm; return (Command *) genget(name, (char **) cmdtab2, sizeof(Command)); } @@ -2460,7 +2521,7 @@ command(top, tbuf, cnt) printf("%s> ", prompt); if (fgets(line, sizeof(line), stdin) == NULL) { if (feof(stdin) || ferror(stdin)) { - (void) quit(); + (void) quit(0, NULL); /*NOTREACHED*/ } break; @@ -2507,7 +2568,7 @@ command(top, tbuf, cnt) /* * Help command. */ - static + static int help(argc, argv) int argc; char *argv[]; @@ -2540,6 +2601,7 @@ help(argc, argv) static char *rcname = 0; static char rcbuf[128]; +void cmdrc(m1, m2) char *m1, *m2; { @@ -2665,7 +2727,7 @@ cmdrc(m1, m2) sourceroute(arg, cpp, lenp) char *arg; char **cpp; - int *lenp; + unsigned long *lenp; { static char lsr[44]; #ifdef sysV88 @@ -2733,7 +2795,7 @@ sourceroute(arg, cpp, lenp) for (c = 0;;) { if (c == ':') cp2 = 0; - else for (cp2 = cp; c = *cp2; cp2++) { + else for (cp2 = cp; (c = *cp2) != '\0'; cp2++) { if (c == ',') { *cp2++ = '\0'; if (*cp2 == '@') @@ -2751,7 +2813,7 @@ sourceroute(arg, cpp, lenp) if ((tmp = inet_addr(cp)) != INADDR_NONE) { sin_addr.s_addr = tmp; - } else if (host = gethostbyname(cp)) { + } else if ((host = gethostbyname(cp)) != NULL) { #if defined(h_addr) memmove((caddr_t)&sin_addr, host->h_addr_list[0], host->h_length); diff --git a/usr.bin/telnet/externs.h b/usr.bin/telnet/externs.h index 48af049bca9..01b0bb1e848 100644 --- a/usr.bin/telnet/externs.h +++ b/usr.bin/telnet/externs.h @@ -1,4 +1,4 @@ -/* $NetBSD: externs.h,v 1.8 1996/02/28 21:03:58 thorpej Exp $ */ +/* $NetBSD: externs.h,v 1.9 1998/02/27 10:44:13 christos Exp $ */ /* * Copyright (c) 1988, 1990, 1993 @@ -230,80 +230,153 @@ extern FILE *NetTrace; /* Where debugging output goes */ extern unsigned char NetTraceFile[]; /* Name of file where debugging output goes */ -extern void - SetNetTrace P((char *)); /* Function to change where debugging goes */ extern jmp_buf peerdied, toplevel; /* For error conditions. */ -extern void - command P((int, char *, int)), - Dump P((int, unsigned char *, int)), - init_3270 P((void)), - printoption P((char *, int, int)), - printsub P((int, unsigned char *, int)), - sendnaws P((void)), - setconnmode P((int)), - setcommandmode P((void)), - setneturg P((void)), - sys_telnet_init P((void)), - telnet P((char *)), - tel_enter_binary P((int)), - TerminalFlushOutput P((void)), - TerminalNewMode P((int)), - TerminalRestoreState P((void)), - TerminalSaveState P((void)), - tninit P((void)), - upcase P((char *)), - willoption P((int)), - wontoption P((int)); - -extern void - send_do P((int, int)), - send_dont P((int, int)), - send_will P((int, int)), - send_wont P((int, int)); - -extern void - lm_will P((unsigned char *, int)), - lm_wont P((unsigned char *, int)), - lm_do P((unsigned char *, int)), - lm_dont P((unsigned char *, int)), - lm_mode P((unsigned char *, int, int)); - -extern void - slc_init P((void)), - slcstate P((void)), - slc_mode_export P((void)), - slc_mode_import P((int)), - slc_import P((int)), - slc_export P((void)), - slc P((unsigned char *, int)), - slc_check P((void)), - slc_start_reply P((void)), - slc_add_reply P((int, int, int)), - slc_end_reply P((void)); -extern int - slc_update P((void)); - -extern void - env_opt P((unsigned char *, int)), - env_opt_start P((void)), - env_opt_start_info P((void)), - env_opt_add P((unsigned char *)), - env_opt_end P((int)); -extern unsigned char - *env_default P((int, int)), - *env_getvalue P((unsigned char *)); - -extern int - get_status P((void)), - dosynch P((void)); - -extern cc_t - *tcval P((int)); +/* authenc.c */ +int net_write P((unsigned char *, int)); +void net_encrypt P((void)); +int telnet_spin P((void)); +char *telnet_getenv P((char *)); +char *telnet_gets P((char *, char *, int, int)); + +/* commands.c */ +int send_tncmd P((void (*)(int, int), char *, char *)); +void _setlist_init P((void)); +void set_escape_char P((char *)); +int set_mode P((int)); +int clear_mode P((int)); +int modehelp P((int)); +int suspend P((int, char *[])); +int shell P((int, char *[])); +int quit P((int, char *[])); +int logout P((int, char *[])); +int env_cmd P((int, char *[])); +struct env_lst *env_find P((unsigned char *)); +void env_init P((void)); +struct env_lst *env_define P((unsigned char *, unsigned char *)); +struct env_lst *env_undefine P((unsigned char *, unsigned char *)); +struct env_lst *env_export P((unsigned char *, unsigned char *)); +struct env_lst *env_unexport P((unsigned char *, unsigned char *)); +struct env_lst *env_send P((unsigned char *, unsigned char *)); +struct env_lst *env_list P((unsigned char *, unsigned char *)); +unsigned char *env_default P((int, int )); +unsigned char *env_getvalue P((unsigned char *)); +void env_varval P((unsigned char *)); +int auth_cmd P((int, char *[])); +int ayt_status P((void)); +int tn P((int, char *[])); +void command P((int, char *, int)); +void cmdrc P((char *, char *)); +unsigned long sourceroute P((char *, char **, unsigned long *)); + +/* main.c */ +void tninit P((void)); +void usage P((void)); + +/* network.c */ +void init_network P((void)); +int stilloob P((void)); +void setneturg P((void)); +int netflush P((void)); + +/* sys_bsd.c */ +void init_sys P((void)); +int TerminalWrite P((char *, int)); +int TerminalRead P((unsigned char *, int)); +int TerminalAutoFlush P((void)); +int TerminalSpecialChars P((int)); +void TerminalFlushOutput P((void)); +void TerminalSaveState P((void)); +cc_t *tcval P((int)); +void TerminalDefaultChars P((void)); +void TerminalRestoreState P((void)); +void TerminalNewMode P((int)); +void TerminalSpeeds P((long *, long *)); +int TerminalWindowSize P((long *, long *)); +int NetClose P((int)); +void NetNonblockingIO P((int, int)); +void NetSigIO P((int, int)); +void NetSetPgrp P((int)); +void sys_telnet_init P((void)); +int process_rings P((int , int , int , int , int , int)); + +/* telnet.c */ +void init_telnet P((void)); +void send_do P((int, int )); +void send_dont P((int, int )); +void send_will P((int, int )); +void send_wont P((int, int )); +void willoption P((int)); +void wontoption P((int)); +char **mklist P((char *, char *)); +int is_unique P((char *, char **, char **)); +int setupterm P((char *, int, int *)); +char *gettermname P((void)); +void lm_will P((unsigned char *, int)); +void lm_wont P((unsigned char *, int)); +void lm_do P((unsigned char *, int)); +void lm_dont P((unsigned char *, int)); +void lm_mode P((unsigned char *, int, int )); +void slc_init P((void)); +void slcstate P((void)); +void slc_mode_export P((int)); +void slc_mode_import P((int)); +void slc_import P((int)); +void slc_export P((void)); +void slc P((unsigned char *, int)); +void slc_check P((void)); +void slc_start_reply P((void)); +void slc_add_reply P((unsigned int, unsigned int, cc_t)); +void slc_end_reply P((void)); +int slc_update P((void)); +void env_opt P((unsigned char *, int)); +void env_opt_start P((void)); +void env_opt_start_info P((void)); +void env_opt_add P((unsigned char *)); +int opt_welldefined P((char *)); +void env_opt_end P((int)); +int telrcv P((void)); +int rlogin_susp P((void)); +int Scheduler P((int)); +void telnet P((char *)); +void xmitAO P((void)); +void xmitEL P((void)); +void xmitEC P((void)); +int dosynch P((char *)); +int get_status P((char *)); +void intp P((void)); +void sendbrk P((void)); +void sendabort P((void)); +void sendsusp P((void)); +void sendeof P((void)); +void sendayt P((void)); +void sendnaws P((void)); +void tel_enter_binary P((int)); +void tel_leave_binary P((int)); + +/* terminal.c */ +void init_terminal P((void)); +int ttyflush P((int)); +int getconnmode P((void)); +void setconnmode P((int)); +void setcommandmode P((void)); + +/* utilities.c */ +void upcase P((char *)); +int SetSockOpt P((int, int , int , int )); +void SetNetTrace P((char *)); +void Dump P((int, unsigned char *, int)); +void printoption P((char *, int, int )); +void optionstatus P((void)); +void printsub P((int, unsigned char *, int)); +void EmptyTerminal P((void)); +void SetForExit P((void)); +void Exit P((int)) __attribute__((__noreturn__)); +void ExitString P((char *, int)) __attribute__((__noreturn__)); #ifndef USE_TERMIO @@ -469,9 +542,18 @@ extern char tline[], *transcom; /* Transparent command */ -extern int - settranscom P((int, char**)); +/* tn3270.c */ +void init_3270 P((void)); +int DataToNetwork P((char *, int, int)); +void inputAvailable P((int)); +void outputPurge P((void)); +int DataToTerminal P((char *, int)); +int Push3270 P((void)); +void Finish3270 P((void)); +void StringToTerminal P((char *)); +void _putchar P((int)); +void SetIn3270 P((void)); +int tn3270_ttype P((void)); +int settranscom P((int, char *[])); -extern void - inputAvailable P((int)); #endif /* defined(TN3270) */ diff --git a/usr.bin/telnet/main.c b/usr.bin/telnet/main.c index 7cba5885b4d..1950d0962f5 100644 --- a/usr.bin/telnet/main.c +++ b/usr.bin/telnet/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.6 1997/11/01 06:51:46 lukem Exp $ */ +/* $NetBSD: main.c,v 1.7 1998/02/27 10:44:13 christos Exp $ */ /* * Copyright (c) 1988, 1990, 1993 @@ -33,17 +33,17 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint -static char copyright[] = -"@(#) Copyright (c) 1988, 1990, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; +__COPYRIGHT("@(#) Copyright (c) 1988, 1990, 1993\n\ + The Regents of the University of California. All rights reserved.\n"); #endif /* not lint */ #ifndef lint #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 5/30/95"; #else -static char rcsid[] = "$NetBSD: main.c,v 1.6 1997/11/01 06:51:46 lukem Exp $"; +__RCSID("$NetBSD: main.c,v 1.7 1998/02/27 10:44:13 christos Exp $"); #endif #endif /* not lint */ @@ -62,6 +62,8 @@ static char rcsid[] = "$NetBSD: main.c,v 1.6 1997/11/01 06:51:46 lukem Exp $"; #define FORWARD #endif +int main P((int, char *[])); + /* * Initialize variables. */ @@ -112,6 +114,7 @@ usage() */ +int main(argc, argv) int argc; char *argv[]; @@ -119,7 +122,7 @@ main(argc, argv) extern char *optarg; extern int optind; int ch; - char *user, *strrchr(); + char *user; #ifdef FORWARD extern int forward_flags; #endif /* FORWARD */ @@ -131,7 +134,7 @@ main(argc, argv) TerminalSaveState(); - if (prompt = strrchr(argv[0], '/')) + if ((prompt = strrchr(argv[0], '/')) != NULL) ++prompt; else prompt = argv[0]; @@ -287,6 +290,9 @@ main(argc, argv) if (argc) { char *args[7], **argp = args; +#ifdef __GNUC__ + (void) &argp; /* avoid longjmp clobbering */ +#endif if (argc > 2) usage(); diff --git a/usr.bin/telnet/network.c b/usr.bin/telnet/network.c index 7bea409b3ab..0adf3bb7616 100644 --- a/usr.bin/telnet/network.c +++ b/usr.bin/telnet/network.c @@ -1,4 +1,4 @@ -/* $NetBSD: network.c,v 1.5 1996/02/28 21:04:06 thorpej Exp $ */ +/* $NetBSD: network.c,v 1.6 1998/02/27 10:44:13 christos Exp $ */ /* * Copyright (c) 1988, 1993 @@ -33,11 +33,12 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)network.c 8.2 (Berkeley) 12/15/93"; #else -static char rcsid[] = "$NetBSD: network.c,v 1.5 1996/02/28 21:04:06 thorpej Exp $"; +__RCSID("$NetBSD: network.c,v 1.6 1998/02/27 10:44:13 christos Exp $"); #endif #endif /* not lint */ @@ -46,6 +47,7 @@ static char rcsid[] = "$NetBSD: network.c,v 1.5 1996/02/28 21:04:06 thorpej Exp #include <sys/time.h> #include <errno.h> +#include <unistd.h> #include <arpa/telnet.h> @@ -95,7 +97,7 @@ stilloob() if (value < 0) { perror("select"); - (void) quit(); + (void) quit(0, NULL); /* NOTREACHED */ } if (FD_ISSET(net, &excepts)) { diff --git a/usr.bin/telnet/ring.c b/usr.bin/telnet/ring.c index e12936c59a3..0093bd5aac5 100644 --- a/usr.bin/telnet/ring.c +++ b/usr.bin/telnet/ring.c @@ -1,4 +1,4 @@ -/* $NetBSD: ring.c,v 1.7 1996/02/28 21:04:07 thorpej Exp $ */ +/* $NetBSD: ring.c,v 1.8 1998/02/27 10:44:13 christos Exp $ */ /* * Copyright (c) 1988, 1993 @@ -33,11 +33,12 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)ring.c 8.2 (Berkeley) 5/30/95"; #else -static char rcsid[] = "$NetBSD: ring.c,v 1.7 1996/02/28 21:04:07 thorpej Exp $"; +__RCSID("$NetBSD: ring.c,v 1.8 1998/02/27 10:44:13 christos Exp $"); #endif #endif /* not lint */ @@ -109,7 +110,8 @@ static u_long ring_clock = 0; /* Buffer state transition routines */ - ring_init(ring, buffer, count) + int +ring_init(ring, buffer, count) Ring *ring; unsigned char *buffer; int count; diff --git a/usr.bin/telnet/ring.h b/usr.bin/telnet/ring.h index c86d22096a2..3018138fdaf 100644 --- a/usr.bin/telnet/ring.h +++ b/usr.bin/telnet/ring.h @@ -1,4 +1,4 @@ -/* $NetBSD: ring.h,v 1.5 1996/02/28 21:04:09 thorpej Exp $ */ +/* $NetBSD: ring.h,v 1.6 1998/02/27 10:44:14 christos Exp $ */ /* * Copyright (c) 1988, 1993 @@ -83,9 +83,10 @@ extern int ring_empty_count P((Ring *ring)), ring_empty_consecutive P((Ring *ring)), ring_full_count P((Ring *ring)), - ring_full_consecutive P((Ring *ring)); + ring_full_consecutive P((Ring *ring)), + ring_at_mark P((Ring *ring)); extern void - ring_clear_mark(), - ring_mark(); + ring_clear_mark P((Ring *ring)), + ring_mark P((Ring *ring)); diff --git a/usr.bin/telnet/sys_bsd.c b/usr.bin/telnet/sys_bsd.c index 4ae9a27a889..9d6ef744bbc 100644 --- a/usr.bin/telnet/sys_bsd.c +++ b/usr.bin/telnet/sys_bsd.c @@ -1,4 +1,4 @@ -/* $NetBSD: sys_bsd.c,v 1.11 1996/02/28 21:04:10 thorpej Exp $ */ +/* $NetBSD: sys_bsd.c,v 1.12 1998/02/27 10:44:14 christos Exp $ */ /* * Copyright (c) 1988, 1990, 1993 @@ -33,11 +33,12 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 from: static char sccsid[] = "@(#)sys_bsd.c 8.4 (Berkeley) 5/30/95"; #else -static char rcsid[] = "$NetBSD: sys_bsd.c,v 1.11 1996/02/28 21:04:10 thorpej Exp $"; +__RCSID("$NetBSD: sys_bsd.c,v 1.12 1998/02/27 10:44:14 christos Exp $"); #endif #endif /* not lint */ @@ -52,6 +53,8 @@ static char rcsid[] = "$NetBSD: sys_bsd.c,v 1.11 1996/02/28 21:04:10 thorpej Exp #include <sys/time.h> #include <sys/socket.h> #include <signal.h> +#include <stdlib.h> +#include <unistd.h> #include <errno.h> #include <arpa/telnet.h> @@ -69,10 +72,19 @@ static char rcsid[] = "$NetBSD: sys_bsd.c,v 1.11 1996/02/28 21:04:10 thorpej Exp #define SIG_FUNC_RET int #endif +#ifdef SIGTSTP +SIG_FUNC_RET susp P((int)); +#endif /* SIGTSTP */ #ifdef SIGINFO -extern SIG_FUNC_RET ayt_status(); +SIG_FUNC_RET ayt P((int)); #endif +SIG_FUNC_RET intr P((int)); +SIG_FUNC_RET intr2 P((int)); +SIG_FUNC_RET sendwin P((int)); +SIG_FUNC_RET deadpeer P((int)); + + int tout, /* Output file descriptor */ tin, /* Input file descriptor */ @@ -184,8 +196,6 @@ extern int kludgelinemode; * 1 Do add this character */ -extern void xmitAO(), xmitEL(), xmitEC(), intp(), sendbrk(); - int TerminalSpecialChars(c) int c; @@ -615,13 +625,6 @@ TerminalNewMode(f) if (f != -1) { #ifdef SIGTSTP - SIG_FUNC_RET susp(); -#endif /* SIGTSTP */ -#ifdef SIGINFO - SIG_FUNC_RET ayt(); -#endif - -#ifdef SIGTSTP (void) signal(SIGTSTP, susp); #endif /* SIGTSTP */ #ifdef SIGINFO @@ -667,9 +670,7 @@ TerminalNewMode(f) #endif } else { #ifdef SIGINFO - SIG_FUNC_RET ayt_status(); - - (void) signal(SIGINFO, ayt_status); + (void) signal(SIGINFO, (void (*) P((int))) ayt_status); #endif #ifdef SIGTSTP (void) signal(SIGTSTP, SIG_DFL); diff --git a/usr.bin/telnet/telnet.c b/usr.bin/telnet/telnet.c index 50765f8bda8..56e806c4dc6 100644 --- a/usr.bin/telnet/telnet.c +++ b/usr.bin/telnet/telnet.c @@ -1,4 +1,4 @@ -/* $NetBSD: telnet.c,v 1.8 1997/06/03 01:51:43 mycroft Exp $ */ +/* $NetBSD: telnet.c,v 1.9 1998/02/27 10:44:14 christos Exp $ */ /* * Copyright (c) 1988, 1990, 1993 @@ -33,11 +33,12 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)telnet.c 8.4 (Berkeley) 5/30/95"; #else -static char rcsid[] = "$NetBSD: telnet.c,v 1.8 1997/06/03 01:51:43 mycroft Exp $"; +__RCSID("$NetBSD: telnet.c,v 1.9 1998/02/27 10:44:14 christos Exp $"); #endif #endif /* not lint */ @@ -45,6 +46,7 @@ static char rcsid[] = "$NetBSD: telnet.c,v 1.8 1997/06/03 01:51:43 mycroft Exp $ #if defined(unix) #include <signal.h> +#include <termcap.h> /* By the way, we need to include curses.h before telnet.h since, * among other things, telnet.h #defines 'DO', which is a variable * declared in curses.h. @@ -151,6 +153,13 @@ int linemode; int kludgelinemode = 1; #endif +static void dooption P((int)); +static void dontoption P((int)); +static void suboption P((void)); +static int telsnd P((void)); +static void netclear P((void)); +static void doflush P((void)); + /* * The following are some clocks used to decide how to interpret * the relationship between various variables. @@ -853,8 +862,8 @@ suboption() TerminalSpeeds(&ispeed, &ospeed); - sprintf((char *)temp, "%c%c%c%c%d,%d%c%c", IAC, SB, TELOPT_TSPEED, - TELQUAL_IS, ospeed, ispeed, IAC, SE); + sprintf((char *)temp, "%c%c%c%c%ld,%ld%c%c", IAC, SB, TELOPT_TSPEED, + TELQUAL_IS, (long)ospeed, (long)ispeed, IAC, SE); len = strlen((char *)temp+4) + 4; /* temp[3] is 0 ... */ if (len < NETROOM()) { @@ -1148,7 +1157,7 @@ slc_init() #define initfunc(func, flags) { \ spcp = &spc_data[func]; \ - if (spcp->valp = tcval(func)) { \ + if ((spcp->valp = tcval(func)) != NULL){ \ spcp->val = *spcp->valp; \ spcp->mylevel = SLC_VARIABLE|flags; \ } else { \ @@ -1206,7 +1215,8 @@ slcstate() } void -slc_mode_export() +slc_mode_export(n) + int n; { slc_mode = SLC_EXPORT; if (my_state_is_will(TELOPT_LINEMODE)) @@ -1375,8 +1385,8 @@ slc_start_reply() void slc_add_reply(func, flags, value) - unsigned char func; - unsigned char flags; + unsigned int func; + unsigned int flags; cc_t value; { if ((*slc_replyp++ = func) == IAC) @@ -1556,12 +1566,12 @@ env_opt_add(ep) if (ep == NULL || *ep == '\0') { /* Send user defined variables first. */ env_default(1, 0); - while (ep = env_default(0, 0)) + while ((ep = env_default(0, 0)) != NULL) env_opt_add(ep); /* Now add the list of well know variables. */ env_default(1, 1); - while (ep = env_default(0, 1)) + while ((ep = env_default(0, 1)) != NULL) env_opt_add(ep); return; } @@ -1591,7 +1601,7 @@ env_opt_add(ep) else *opt_replyp++ = ENV_USERVAR; for (;;) { - while (c = *ep++) { + while ((c = *ep++) != '\0') { switch(c&0xff) { case IAC: *opt_replyp++ = IAC; @@ -1605,7 +1615,7 @@ env_opt_add(ep) } *opt_replyp++ = c; } - if (ep = vp) { + if ((ep = vp) != NULL) { #ifdef OLD_ENVIRON if (telopt_environ == TELOPT_OLD_ENVIRON) *opt_replyp++ = old_env_value; @@ -1660,7 +1670,7 @@ telrcv() { register int c; register int scc; - register unsigned char *sbp; + register unsigned char *sbp = NULL; int count; int returnValue = 0; @@ -1934,7 +1944,7 @@ telsnd() int tcc; int count; int returnValue = 0; - unsigned char *tbp; + unsigned char *tbp = NULL; tcc = 0; count = 0; @@ -2401,7 +2411,8 @@ xmitEC() int -dosynch() +dosynch(s) + char *s; { netclear(); /* clear the path to the network */ NETADD(IAC); @@ -2414,7 +2425,8 @@ dosynch() int want_status_response = 0; int -get_status() +get_status(s) + char *s; { unsigned char tmp[16]; register unsigned char *cp; @@ -2449,7 +2461,7 @@ intp() doflush(); } if (autosynch) { - dosynch(); + dosynch(NULL); } } @@ -2463,7 +2475,7 @@ sendbrk() doflush(); } if (autosynch) { - dosynch(); + dosynch(NULL); } } @@ -2477,7 +2489,7 @@ sendabort() doflush(); } if (autosynch) { - dosynch(); + dosynch(NULL); } } @@ -2491,7 +2503,7 @@ sendsusp() doflush(); } if (autosynch) { - dosynch(); + dosynch(NULL); } } diff --git a/usr.bin/telnet/terminal.c b/usr.bin/telnet/terminal.c index 3a4373bfb03..4034102d813 100644 --- a/usr.bin/telnet/terminal.c +++ b/usr.bin/telnet/terminal.c @@ -1,4 +1,4 @@ -/* $NetBSD: terminal.c,v 1.5 1996/02/28 21:04:17 thorpej Exp $ */ +/* $NetBSD: terminal.c,v 1.6 1998/02/27 10:44:14 christos Exp $ */ /* * Copyright (c) 1988, 1990, 1993 @@ -33,11 +33,12 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)terminal.c 8.2 (Berkeley) 2/16/95"; #else -static char rcsid[] = "$NetBSD: terminal.c,v 1.5 1996/02/28 21:04:17 thorpej Exp $"; +__RCSID("$NetBSD: terminal.c,v 1.6 1998/02/27 10:44:14 christos Exp $"); #endif #endif /* not lint */ diff --git a/usr.bin/telnet/tn3270.c b/usr.bin/telnet/tn3270.c index 1c104f20f42..a3786c4258d 100644 --- a/usr.bin/telnet/tn3270.c +++ b/usr.bin/telnet/tn3270.c @@ -1,4 +1,4 @@ -/* $NetBSD: tn3270.c,v 1.6 1998/02/17 11:38:27 kleink Exp $ */ +/* $NetBSD: tn3270.c,v 1.7 1998/02/27 10:44:15 christos Exp $ */ /* * Copyright (c) 1988, 1993 @@ -33,11 +33,12 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)tn3270.c 8.2 (Berkeley) 5/30/95"; #else -static char rcsid[] = "$NetBSD: tn3270.c,v 1.6 1998/02/17 11:38:27 kleink Exp $"; +__RCSID("$NetBSD: tn3270.c,v 1.7 1998/02/27 10:44:15 christos Exp $"); #endif #endif /* not lint */ @@ -84,10 +85,10 @@ static int #endif /* defined(TN3270) */ +#if defined(TN3270) void init_3270() { -#if defined(TN3270) #if defined(unix) HaveInput = 0; sigiocount = 0; @@ -98,8 +99,8 @@ init_3270() init_keyboard(); init_screen(); init_system(); -#endif /* defined(TN3270) */ } +#endif /* defined(TN3270) */ #if defined(TN3270) diff --git a/usr.bin/telnet/utilities.c b/usr.bin/telnet/utilities.c index 10aa40d2afa..991c3baf9cb 100644 --- a/usr.bin/telnet/utilities.c +++ b/usr.bin/telnet/utilities.c @@ -1,4 +1,4 @@ -/* $NetBSD: utilities.c,v 1.5 1996/02/28 21:04:21 thorpej Exp $ */ +/* $NetBSD: utilities.c,v 1.6 1998/02/27 10:44:15 christos Exp $ */ /* * Copyright (c) 1988, 1993 @@ -33,11 +33,12 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)utilities.c 8.3 (Berkeley) 5/30/95"; #else -static char rcsid[] = "$NetBSD: utilities.c,v 1.5 1996/02/28 21:04:21 thorpej Exp $"; +__RCSID("$NetBSD: utilities.c,v 1.6 1998/02/27 10:44:15 christos Exp $"); #endif #endif /* not lint */ @@ -47,6 +48,10 @@ static char rcsid[] = "$NetBSD: utilities.c,v 1.5 1996/02/28 21:04:21 thorpej Ex #include <arpa/telnet.h> #include <sys/types.h> #include <sys/time.h> +#ifndef NOT43 +#include <sys/socket.h> +#endif +#include <unistd.h> #include <ctype.h> @@ -140,7 +145,6 @@ Dump(direction, buffer, length) # define min(x,y) ((x<y)? x:y) unsigned char *pThis; int offset; - extern pettydump; offset = 0; @@ -302,7 +306,6 @@ printsub(direction, pointer, length) int length; /* length of suboption data */ { register int i; - char buf[512]; extern int want_status_response; if (showoptions || direction == 0 || @@ -755,7 +758,6 @@ printsub(direction, pointer, length) break; default: - def_case: if (isprint(pointer[i]) && pointer[i] != '"') { if (noquote) { putc('"', NetTrace); |
