From: Ezra Peisach Date: Fri, 15 Nov 2002 20:21:35 +0000 (+0000) Subject: * sys_bsd.c: Moved declaration for susp() to type of file and X-Git-Tag: krb5-1.3-alpha1~263 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d8ce52e5fb91ad51c4fbe974b7f837498c7e1d92;p=krb5.git * sys_bsd.c: Moved declaration for susp() to type of file and provide prototype. * commands.c, externs.h, telnet.c, network.c: Add prototype declaration for command handler table dispatch functions. Make functions called consistant with prototype. Misc unsigned/signed cleanups. * authenc.c, main.c, utilities.c: Signed vs. unsigned cleanup. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15011 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/telnet/telnet/ChangeLog b/src/appl/telnet/telnet/ChangeLog index 72a0e273d..e381aaa8e 100644 --- a/src/appl/telnet/telnet/ChangeLog +++ b/src/appl/telnet/telnet/ChangeLog @@ -1,3 +1,15 @@ +2002-11-15 Ezra Peisach + + * sys_bsd.c: Moved declaration for susp() to type of file and + provide prototype. + + * commands.c, externs.h, telnet.c, network.c: Add prototype + declaration for command handler table dispatch functions. Make + functions called consistant with prototype. Misc unsigned/signed + cleanups. + + * authenc.c, main.c, utilities.c: Signed vs. unsigned cleanup. + 2002-10-22 Ezra Peisach * configure.in: Autoconf 2.55 will not simply use cpp to test for diff --git a/src/appl/telnet/telnet/authenc.c b/src/appl/telnet/telnet/authenc.c index ef2bf2d63..aa4459f27 100644 --- a/src/appl/telnet/telnet/authenc.c +++ b/src/appl/telnet/telnet/authenc.c @@ -106,7 +106,7 @@ telnet_gets(tprompt, result, length, echo) printf("%s", tprompt); res = fgets(result, length, stdin); } else if ((res = getpass(tprompt))) { - strncpy(result, res, length); + strncpy(result, res, (unsigned) length); res = result; } TerminalNewMode(om); diff --git a/src/appl/telnet/telnet/commands.c b/src/appl/telnet/telnet/commands.c index 5e693bd1a..a637e9e60 100644 --- a/src/appl/telnet/telnet/commands.c +++ b/src/appl/telnet/telnet/commands.c @@ -145,7 +145,8 @@ extern void herror(const char *); 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 */ + (int, char *[]); int needconnect; /* Do we need to be connected to execute? */ } Command; @@ -289,15 +290,16 @@ 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) */ + (char *); int nbyte; /* Number of bytes to send this command */ int what; /* Character to be sent (<0 ==> special) */ }; static int - send_esc (void), - send_help (void), + send_esc (char *), + send_help (char *), send_docmd (char *), send_dontcmd (char *), send_willcmd (char *), @@ -377,7 +379,7 @@ sendcmd(argc, argv) } count += s->nbyte; if (s->handler == send_help) { - send_help(); + send_help(NULL); return 0; } @@ -402,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); @@ -419,7 +420,8 @@ sendcmd(argc, argv) } static int -send_esc() +send_esc(s) + char *s; { NETADD(escape); return 1; @@ -515,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++) { @@ -531,14 +534,16 @@ send_help() */ static int -lclchars() +lclchars(s) + int s; { donelclchars = 1; return 1; } static int -togdebug() +togdebug(s) + int s; { #ifndef NOT43 if (net > 0 && @@ -557,7 +562,8 @@ togdebug() static int -togcrlf() +togcrlf(s) + int s; { if (crlf) { printf("Will send carriage returns as telnet .\r\n"); @@ -663,7 +669,7 @@ togxbinary(val) } -static int togglehelp (void); +static int togglehelp (int); #if defined(AUTHENTICATION) extern int auth_togdebug (int); #endif @@ -671,7 +677,8 @@ extern int auth_togdebug (int); 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 */ + (int); int *variable; char *actionexplanation; }; @@ -804,7 +811,8 @@ static struct togglelist Togglelist[] = { }; static int -togglehelp() +togglehelp(n) + int n; { struct togglelist *c; @@ -1384,7 +1392,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.\r\n"); @@ -1395,7 +1405,9 @@ togcrmod() /*VARARGS*/ static int -suspend() +suspend(argc, argv) + int argc; + char **argv; { #ifdef SIGTSTP setcommandmode(); @@ -1508,7 +1520,9 @@ bye(argc, argv) /*VARARGS*/ int -quit() +quit(argc, argv) + int argc; + char *argv[]; { (void) call(bye, "bye", "fromquit", 0); Exit(0); @@ -1518,7 +1532,9 @@ quit() /*VARARGS*/ static int -logout() +logout(argc, argv) + int argc; + char **argv; { send_do(TELOPT_LOGOUT, 1); (void) netflush(); @@ -1795,7 +1811,7 @@ env_define(var, value) if (ep->next) ep->next->prev = ep; } - ep->welldefined = opt_welldefined(var); + ep->welldefined = opt_welldefined((char *)var); ep->export = 1; ep->var = (unsigned char *)strdup((char *)var); ep->value = (unsigned char *)strdup((char *)value); @@ -1925,7 +1941,7 @@ env_varval(what) unsigned char *what; { extern int old_env_var, old_env_value, env_auto; - int len = strlen((char *)what); + unsigned int len = strlen((char *)what); if (len == 0) goto unknown; @@ -2421,7 +2437,8 @@ tn(argc, argv) if (argc < 2) { (void) strcpy(line, "open "); printf("(to) "); - (void) fgets(&line[strlen(line)], sizeof(line) - strlen(line), stdin); + (void) fgets(&line[strlen(line)], (int) (sizeof(line) - strlen(line)), + stdin); makeargv(); argc = margc; argv = margv; @@ -2833,7 +2850,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; @@ -2920,8 +2937,8 @@ cmdrc(m1, m2) register Command *c; FILE *rcfile; int gotmachine = 0; - int l1 = strlen(m1); - int l2 = strlen(m2); + unsigned int l1 = strlen(m1); + unsigned int l2 = strlen(m2); char m1save[64]; if (skiprc) diff --git a/src/appl/telnet/telnet/externs.h b/src/appl/telnet/telnet/externs.h index ad16a0333..65a1c67c0 100644 --- a/src/appl/telnet/telnet/externs.h +++ b/src/appl/telnet/telnet/externs.h @@ -318,7 +318,7 @@ extern void slc_end_reply (void); extern int - quit (void), + quit (int, char *[]), ttyflush (int), rlogin_susp (void), tn (int, char **), @@ -333,8 +333,8 @@ extern int stilloob (void), telrcv (void), telnet_spin (void), - TerminalWrite (char *, int), - TerminalRead (char *, int), + TerminalWrite (unsigned char *, int), + TerminalRead (unsigned char *, int), TerminalAutoFlush (void), TerminalSpecialChars (int), TerminalWindowSize (long *, long *); @@ -357,8 +357,8 @@ extern int env_is_exported (unsigned char *); extern int - get_status (void), - dosynch (void); + get_status (char *), + dosynch (char *); extern cc_t *tcval (int); diff --git a/src/appl/telnet/telnet/main.c b/src/appl/telnet/telnet/main.c index f41ce4d27..77832f912 100644 --- a/src/appl/telnet/telnet/main.c +++ b/src/appl/telnet/telnet/main.c @@ -238,7 +238,7 @@ main(argc, argv) #if defined(AUTHENTICATION) && defined(KRB4) { extern char *dest_realm, dst_realm_buf[]; - extern int dst_realm_sz; + extern unsigned int dst_realm_sz; dest_realm = dst_realm_buf; (void)strncpy(dest_realm, optarg, dst_realm_sz); } diff --git a/src/appl/telnet/telnet/network.c b/src/appl/telnet/telnet/network.c index fc7dc5ea7..1282bdb7e 100644 --- a/src/appl/telnet/telnet/network.c +++ b/src/appl/telnet/telnet/network.c @@ -91,7 +91,7 @@ stilloob() if (value < 0) { perror("select"); - (void) quit(); + (void) quit(0, NULL); /* NOTREACHED */ } if (FD_ISSET(net, &excepts)) { diff --git a/src/appl/telnet/telnet/sys_bsd.c b/src/appl/telnet/telnet/sys_bsd.c index 2f9da5b1b..89f9d4b5a 100644 --- a/src/appl/telnet/telnet/sys_bsd.c +++ b/src/appl/telnet/telnet/sys_bsd.c @@ -67,6 +67,12 @@ #define SIG_FUNC_RET int #endif +#ifdef SIGTSTP +static SIG_FUNC_RET susp(int); +#endif /* SIGTSTP */ +#ifdef SIGINFO +SIG_FUNC_RET ayt(int); +#endif #ifdef SIGINFO extern SIG_FUNC_RET ayt_status(); #endif @@ -160,7 +166,7 @@ init_sys() int TerminalWrite(buf, n) - char *buf; + unsigned char *buf; int n; { return write(tout, buf, n); @@ -168,7 +174,7 @@ TerminalWrite(buf, n) int TerminalRead(buf, n) - char *buf; + unsigned char *buf; int n; { return read(tin, buf, n); @@ -249,7 +255,6 @@ TerminalSpecialChars(c) /* * Flush output to the terminal */ - void TerminalFlushOutput() { @@ -636,12 +641,6 @@ TerminalNewMode(f) } if (f != -1) { -#ifdef SIGTSTP - static SIG_FUNC_RET susp(); -#endif /* SIGTSTP */ -#ifdef SIGINFO - SIG_FUNC_RET ayt(); -#endif #ifdef SIGTSTP (void) signal(SIGTSTP, susp); diff --git a/src/appl/telnet/telnet/telnet.c b/src/appl/telnet/telnet/telnet.c index 82eaa00b2..a92bbd5d1 100644 --- a/src/appl/telnet/telnet/telnet.c +++ b/src/appl/telnet/telnet/telnet.c @@ -693,7 +693,9 @@ mklist(buf, name) */ if (n || (cp - cp2 > 41)) ; - else if (name && (strncasecmp(name, cp2, cp-cp2) == 0)) + else if (name && (strncasecmp(name, cp2, + (unsigned) (cp-cp2)) + == 0)) *argv = cp2; else if (is_unique(cp2, argv+1, argvp)) *argvp++ = cp2; @@ -760,7 +762,7 @@ is_unique(name, as, ae) register char *name, **as, **ae; { register char **ap; - register int n; + register unsigned int n; n = strlen(name) + 1; for (ap = as; ap < ae; ap++) @@ -1663,7 +1665,7 @@ env_opt_add(ep) if (opt_replyp + (vp ? strlen((char *)vp) : 0) + strlen((char *)ep) + 6 > opt_replyend) { - register int len; + register unsigned int len; opt_replyend += OPT_REPLY_SIZE; len = opt_replyend - opt_reply; opt_reply = (unsigned char *)realloc(opt_reply, len); @@ -2583,7 +2585,8 @@ xmitEC() int -dosynch() +dosynch(s) + char *s; { netclear(); /* clear the path to the network */ NETADD(IAC); @@ -2596,7 +2599,8 @@ dosynch() int want_status_response = 0; int -get_status() +get_status(s) + char *s; { unsigned char tmp[16]; register unsigned char *cp; @@ -2631,7 +2635,7 @@ intp() doflush(); } if (autosynch) { - dosynch(); + dosynch(NULL); } } @@ -2645,7 +2649,7 @@ sendbrk() doflush(); } if (autosynch) { - dosynch(); + dosynch(NULL); } } @@ -2659,7 +2663,7 @@ sendabort() doflush(); } if (autosynch) { - dosynch(); + dosynch(NULL); } } @@ -2673,7 +2677,7 @@ sendsusp() doflush(); } if (autosynch) { - dosynch(); + dosynch(NULL); } } diff --git a/src/appl/telnet/telnet/utilities.c b/src/appl/telnet/telnet/utilities.c index b4e8d0f01..4b198dabf 100644 --- a/src/appl/telnet/telnet/utilities.c +++ b/src/appl/telnet/telnet/utilities.c @@ -304,7 +304,7 @@ printsub(direction, pointer, length) int length; /* length of suboption data */ { register int i; - char buf[512]; + unsigned char buf[512]; extern int want_status_response; if (showoptions || direction == 0 ||