=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/telnet/telnet.c,v retrieving revision 1.28 retrieving revision 1.29 diff -c -r1.28 -r1.29 *** src/usr.bin/telnet/telnet.c 2014/07/20 10:55:26 1.28 --- src/usr.bin/telnet/telnet.c 2014/07/22 07:30:24 1.29 *************** *** 1,4 **** ! /* $OpenBSD: telnet.c,v 1.28 2014/07/20 10:55:26 guenther Exp $ */ /* $NetBSD: telnet.c,v 1.7 1996/02/28 21:04:15 thorpej Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: telnet.c,v 1.29 2014/07/22 07:30:24 jsg Exp $ */ /* $NetBSD: telnet.c,v 1.7 1996/02/28 21:04:15 thorpej Exp $ */ /* *************** *** 149,156 **** * Initialize telnet environment. */ ! void ! init_telnet() { env_init(); --- 149,156 ---- * Initialize telnet environment. */ ! void ! init_telnet(void) { env_init(); *************** *** 181,189 **** * is in disagreement as to what the current state should be. */ ! void ! send_do(c, init) ! int c, init; { if (init) { if (((do_dont_resp[c] == 0) && my_state_is_do(c)) || --- 181,188 ---- * is in disagreement as to what the current state should be. */ ! void ! send_do(int c, int init) { if (init) { if (((do_dont_resp[c] == 0) && my_state_is_do(c)) || *************** *** 197,205 **** printoption("SENT",DO, c); } ! void ! send_dont(c, init) ! int c, init; { if (init) { if (((do_dont_resp[c] == 0) && my_state_is_dont(c)) || --- 196,203 ---- printoption("SENT",DO, c); } ! void ! send_dont(int c, int init) { if (init) { if (((do_dont_resp[c] == 0) && my_state_is_dont(c)) || *************** *** 213,221 **** printoption("SENT", DONT, c); } ! void ! send_will(c, init) ! int c, init; { if (init) { if (((will_wont_resp[c] == 0) && my_state_is_will(c)) || --- 211,218 ---- printoption("SENT", DONT, c); } ! void ! send_will(int c, int init) { if (init) { if (((will_wont_resp[c] == 0) && my_state_is_will(c)) || *************** *** 229,237 **** printoption("SENT", WILL, c); } ! void ! send_wont(c, init) ! int c, init; { if (init) { if (((will_wont_resp[c] == 0) && my_state_is_wont(c)) || --- 226,233 ---- printoption("SENT", WILL, c); } ! void ! send_wont(int c, int init) { if (init) { if (((will_wont_resp[c] == 0) && my_state_is_wont(c)) || *************** *** 245,254 **** printoption("SENT", WONT, c); } - static void ! willoption(option) ! int option; { int new_state_ok = 0; --- 241,248 ---- printoption("SENT", WONT, c); } static void ! willoption(int option) { int new_state_ok = 0; *************** *** 301,308 **** } static void ! wontoption(option) ! int option; { if (do_dont_resp[option]) { --do_dont_resp[option]; --- 295,301 ---- } static void ! wontoption(int option) { if (do_dont_resp[option]) { --do_dont_resp[option]; *************** *** 350,357 **** } static void ! dooption(option) ! int option; { int new_state_ok = 0; --- 343,349 ---- } static void ! dooption(int option) { int new_state_ok = 0; *************** *** 440,447 **** } static void ! dontoption(option) ! int option; { if (will_wont_resp[option]) { --- 432,438 ---- } static void ! dontoption(int option) { if (will_wont_resp[option]) { *************** *** 476,484 **** static char *name_unknown = "UNKNOWN"; static char *unknown[] = { NULL, NULL }; ! char ** ! mklist(buf, name) ! char *buf, *name; { int n; char c, *cp, **argvp, *cp2, **argv, **avt; --- 467,474 ---- static char *name_unknown = "UNKNOWN"; static char *unknown[] = { NULL, NULL }; ! char ** ! mklist(char *buf, char *name) { int n; char c, *cp, **argvp, *cp2, **argv, **avt; *************** *** 588,596 **** return(unknown); } ! int ! is_unique(name, as, ae) ! char *name, **as, **ae; { char **ap; int n; --- 578,585 ---- return(unknown); } ! int ! is_unique(char *name, char **as, char **ae) { char **ap; int n; *************** *** 604,611 **** int resettermname = 1; ! char * ! gettermname() { char *tname; static char **tnamep = NULL; --- 593,600 ---- int resettermname = 1; ! char * ! gettermname(void) { char *tname; static char **tnamep = NULL; *************** *** 633,638 **** --- 622,628 ---- next = tnamep; return(*next++); } + /* * suboption() * *************** *** 647,654 **** * Linemode */ ! static void ! suboption() { unsigned char subchar; --- 637,644 ---- * Linemode */ ! static void ! suboption(void) { unsigned char subchar; *************** *** 812,820 **** static unsigned char str_lm[] = { IAC, SB, TELOPT_LINEMODE, 0, 0, IAC, SE }; static void ! lm_will(cmd, len) ! unsigned char *cmd; ! int len; { if (len < 1) { /*@*/ printf("lm_will: no command!!!\n"); /* Should not happen... */ --- 802,808 ---- static unsigned char str_lm[] = { IAC, SB, TELOPT_LINEMODE, 0, 0, IAC, SE }; static void ! lm_will(unsigned char *cmd, int len) { if (len < 1) { /*@*/ printf("lm_will: no command!!!\n"); /* Should not happen... */ *************** *** 835,843 **** } static void ! lm_wont(cmd, len) ! unsigned char *cmd; ! int len; { if (len < 1) { /*@*/ printf("lm_wont: no command!!!\n"); /* Should not happen... */ --- 823,829 ---- } static void ! lm_wont(unsigned char *cmd, int len) { if (len < 1) { /*@*/ printf("lm_wont: no command!!!\n"); /* Should not happen... */ *************** *** 852,860 **** } static void ! lm_do(cmd, len) ! unsigned char *cmd; ! int len; { if (len < 1) { /*@*/ printf("lm_do: no command!!!\n"); /* Should not happen... */ --- 838,844 ---- } static void ! lm_do(unsigned char *cmd, int len) { if (len < 1) { /*@*/ printf("lm_do: no command!!!\n"); /* Should not happen... */ *************** *** 875,883 **** } static void ! lm_dont(cmd, len) ! unsigned char *cmd; ! int len; { if (len < 1) { /*@*/ printf("lm_dont: no command!!!\n"); /* Should not happen... */ --- 859,865 ---- } static void ! lm_dont(unsigned char *cmd, int len) { if (len < 1) { /*@*/ printf("lm_dont: no command!!!\n"); /* Should not happen... */ *************** *** 895,904 **** IAC, SB, TELOPT_LINEMODE, LM_MODE, 0, IAC, SE }; ! void ! lm_mode(cmd, len, init) ! unsigned char *cmd; ! int len, init; { if (len != 1) return; --- 877,884 ---- IAC, SB, TELOPT_LINEMODE, LM_MODE, 0, IAC, SE }; ! void ! lm_mode(unsigned char *cmd, int len, int init) { if (len != 1) return; *************** *** 938,944 **** static int slc_mode = SLC_EXPORT; static void ! slc_init() { struct spc *spcp; --- 918,924 ---- static int slc_mode = SLC_EXPORT; static void ! slc_init(void) { struct spc *spcp; *************** *** 989,996 **** } ! void ! slcstate() { printf("Special characters are %s values\n", slc_mode == SLC_IMPORT ? "remote default" : --- 969,976 ---- } ! void ! slcstate(void) { printf("Special characters are %s values\n", slc_mode == SLC_IMPORT ? "remote default" : *************** *** 998,1004 **** "remote"); } ! void slc_mode_export(int unused) { slc_mode = SLC_EXPORT; --- 978,984 ---- "remote"); } ! void slc_mode_export(int unused) { slc_mode = SLC_EXPORT; *************** *** 1006,1014 **** slc_export(); } ! void ! slc_mode_import(def) ! int def; { slc_mode = def ? SLC_IMPORT : SLC_RVALUE; if (my_state_is_will(TELOPT_LINEMODE)) --- 986,993 ---- slc_export(); } ! void ! slc_mode_import(int def) { slc_mode = def ? SLC_IMPORT : SLC_RVALUE; if (my_state_is_will(TELOPT_LINEMODE)) *************** *** 1023,1030 **** }; static void ! slc_import(def) ! int def; { if (NETROOM() > sizeof(slc_import_val)) { if (def) { --- 1002,1008 ---- }; static void ! slc_import(int def) { if (NETROOM() > sizeof(slc_import_val)) { if (def) { *************** *** 1039,1045 **** } static void ! slc_export() { struct spc *spcp; --- 1017,1023 ---- } static void ! slc_export(void) { struct spc *spcp; *************** *** 1063,1071 **** } static void ! slc(cp, len) ! unsigned char *cp; ! int len; { struct spc *spcp; int func,level; --- 1041,1047 ---- } static void ! slc(unsigned char *cp, int len) { struct spc *spcp; int func,level; *************** *** 1132,1139 **** setconnmode(1); /* set the new character values */ } ! void ! slc_check() { struct spc *spcp; --- 1108,1115 ---- setconnmode(1); /* set the new character values */ } ! void ! slc_check(void) { struct spc *spcp; *************** *** 1156,1162 **** static unsigned char slc_reply[2 * SUBBUFSIZE]; static unsigned char *slc_replyp; ! unsigned char slc_add(unsigned char ch) { if (slc_replyp == slc_reply + sizeof(slc_reply)) --- 1132,1138 ---- static unsigned char slc_reply[2 * SUBBUFSIZE]; static unsigned char *slc_replyp; ! unsigned char slc_add(unsigned char ch) { if (slc_replyp == slc_reply + sizeof(slc_reply)) *************** *** 1165,1171 **** } static void ! slc_start_reply() { slc_replyp = slc_reply; slc_add(IAC); --- 1141,1147 ---- } static void ! slc_start_reply(void) { slc_replyp = slc_reply; slc_add(IAC); *************** *** 1175,1184 **** } static void ! slc_add_reply(func, flags, value) ! unsigned char func; ! unsigned char flags; ! cc_t value; { if (slc_replyp + 6 >= slc_reply + sizeof(slc_reply)) { printf("slc_add_reply: not enough room\n"); --- 1151,1157 ---- } static void ! slc_add_reply(unsigned char func, unsigned char flags, cc_t value) { if (slc_replyp + 6 >= slc_reply + sizeof(slc_reply)) { printf("slc_add_reply: not enough room\n"); *************** *** 1193,1199 **** } static void ! slc_end_reply() { int len; --- 1166,1172 ---- } static void ! slc_end_reply(void) { int len; *************** *** 1215,1221 **** } static int ! slc_update() { struct spc *spcp; int need_update = 0; --- 1188,1194 ---- } static int ! slc_update(void) { struct spc *spcp; int need_update = 0; *************** *** 1233,1241 **** } static void ! env_opt(buf, len) ! unsigned char *buf; ! int len; { unsigned char *ep = 0, *epc = 0; int i; --- 1206,1212 ---- } static void ! env_opt(unsigned char *buf, int len) { unsigned char *ep = 0, *epc = 0; int i; *************** *** 1286,1300 **** static unsigned char *opt_replyp; static unsigned char *opt_replyend; ! void opt_add(unsigned char ch) { if (opt_replyp == opt_replyend) return; *opt_replyp++ = ch; } static void ! env_opt_start() { unsigned char *p; --- 1257,1272 ---- static unsigned char *opt_replyp; static unsigned char *opt_replyend; ! void opt_add(unsigned char ch) { if (opt_replyp == opt_replyend) return; *opt_replyp++ = ch; } + static void ! env_opt_start(void) { unsigned char *p; *************** *** 1315,1331 **** opt_add(TELQUAL_IS); } ! void ! env_opt_start_info() { env_opt_start(); if (opt_replyp) opt_replyp[-1] = TELQUAL_INFO; } ! void ! env_opt_add(ep) ! unsigned char *ep; { unsigned char *vp, c; --- 1287,1302 ---- opt_add(TELQUAL_IS); } ! void ! env_opt_start_info(void) { env_opt_start(); if (opt_replyp) opt_replyp[-1] = TELQUAL_INFO; } ! void ! env_opt_add(unsigned char *ep) { unsigned char *vp, c; *************** *** 1394,1402 **** } } ! int ! opt_welldefined(ep) ! char *ep; { if ((strcmp(ep, "USER") == 0) || (strcmp(ep, "DISPLAY") == 0) || --- 1365,1372 ---- } } ! int ! opt_welldefined(char *ep) { if ((strcmp(ep, "USER") == 0) || (strcmp(ep, "DISPLAY") == 0) || *************** *** 1407,1415 **** return(1); return(0); } ! void ! env_opt_end(emptyok) ! int emptyok; { int len; --- 1377,1385 ---- return(1); return(0); } ! ! void ! env_opt_end(int emptyok) { int len; *************** *** 1431,1438 **** ! int ! telrcv() { int c; int scc; --- 1401,1408 ---- ! int ! telrcv(void) { int c; int scc; *************** *** 1648,1655 **** static int bol = 1, local = 0; ! int ! rlogin_susp() { if (local) { local = 0; --- 1618,1625 ---- static int bol = 1, local = 0; ! int ! rlogin_susp(void) { if (local) { local = 0; *************** *** 1660,1667 **** return(0); } ! static int ! telsnd() { int tcc; int count; --- 1630,1637 ---- return(0); } ! static int ! telsnd(void) { int tcc; int count; *************** *** 1810,1819 **** * */ ! ! int ! Scheduler(block) ! int block; /* should we block in the select ? */ { /* One wants to be a bit careful about setting returnValue * to one, since a one implies we did some useful work, --- 1780,1787 ---- * */ ! int ! Scheduler(int block) /* should we block in the select ? */ { /* One wants to be a bit careful about setting returnValue * to one, since a one implies we did some useful work, *************** *** 1866,1874 **** /* * Select from tty and network... */ ! void ! telnet(user) ! char *user; { sys_telnet_init(); --- 1834,1841 ---- /* * Select from tty and network... */ ! void ! telnet(char *user) { sys_telnet_init(); *************** *** 1916,1924 **** * character. */ ! static char * ! nextitem(current) ! char *current; { if ((*current&0xff) != IAC) { return current+1; --- 1883,1890 ---- * character. */ ! static char * ! nextitem(char *current) { if ((*current&0xff) != IAC) { return current+1; *************** *** 1964,1971 **** * us in any case. */ ! static void ! netclear() { #if 0 /* XXX */ char *thisitem, *next; --- 1930,1937 ---- * us in any case. */ ! static void ! netclear(void) { #if 0 /* XXX */ char *thisitem, *next; *************** *** 2007,2014 **** * These routines add various telnet commands to the data stream. */ ! static void ! doflush() { NET2ADD(IAC, DO); NETADD(TELOPT_TM); --- 1973,1980 ---- * These routines add various telnet commands to the data stream. */ ! static void ! doflush(void) { NET2ADD(IAC, DO); NETADD(TELOPT_TM); *************** *** 2019,2026 **** printoption("SENT", DO, TELOPT_TM); } ! void ! xmitAO() { NET2ADD(IAC, AO); printoption("SENT", IAC, AO); --- 1985,1992 ---- printoption("SENT", DO, TELOPT_TM); } ! void ! xmitAO(void) { NET2ADD(IAC, AO); printoption("SENT", IAC, AO); *************** *** 2030,2052 **** } ! void ! xmitEL() { NET2ADD(IAC, EL); printoption("SENT", IAC, EL); } ! void ! xmitEC() { NET2ADD(IAC, EC); printoption("SENT", IAC, EC); } ! int ! dosynch() { netclear(); /* clear the path to the network */ NETADD(IAC); --- 1996,2018 ---- } ! void ! xmitEL(void) { NET2ADD(IAC, EL); printoption("SENT", IAC, EL); } ! void ! xmitEC(void) { NET2ADD(IAC, EC); printoption("SENT", IAC, EC); } ! int ! dosynch(void) { netclear(); /* clear the path to the network */ NETADD(IAC); *************** *** 2058,2065 **** int want_status_response = 0; ! int ! get_status() { unsigned char tmp[16]; unsigned char *cp; --- 2024,2031 ---- int want_status_response = 0; ! int ! get_status(void) { unsigned char tmp[16]; unsigned char *cp; *************** *** 2084,2091 **** return 1; } ! void ! intp() { NET2ADD(IAC, IP); printoption("SENT", IAC, IP); --- 2050,2057 ---- return 1; } ! void ! intp(void) { NET2ADD(IAC, IP); printoption("SENT", IAC, IP); *************** *** 2098,2105 **** } } ! void ! sendbrk() { NET2ADD(IAC, BREAK); printoption("SENT", IAC, BREAK); --- 2064,2071 ---- } } ! void ! sendbrk(void) { NET2ADD(IAC, BREAK); printoption("SENT", IAC, BREAK); *************** *** 2112,2119 **** } } ! void ! sendabort() { NET2ADD(IAC, ABORT); printoption("SENT", IAC, ABORT); --- 2078,2085 ---- } } ! void ! sendabort(void) { NET2ADD(IAC, ABORT); printoption("SENT", IAC, ABORT); *************** *** 2126,2133 **** } } ! void ! sendsusp() { NET2ADD(IAC, SUSP); printoption("SENT", IAC, SUSP); --- 2092,2099 ---- } } ! void ! sendsusp(void) { NET2ADD(IAC, SUSP); printoption("SENT", IAC, SUSP); *************** *** 2140,2154 **** } } ! void ! sendeof() { NET2ADD(IAC, xEOF); printoption("SENT", IAC, xEOF); } ! void ! sendayt() { NET2ADD(IAC, AYT); printoption("SENT", IAC, AYT); --- 2106,2120 ---- } } ! void ! sendeof(void) { NET2ADD(IAC, xEOF); printoption("SENT", IAC, xEOF); } ! void ! sendayt(void) { NET2ADD(IAC, AYT); printoption("SENT", IAC, AYT); *************** *** 2158,2165 **** * Send a window size update to the remote system. */ ! void ! sendnaws() { long rows, cols; unsigned char tmp[16]; --- 2124,2131 ---- * Send a window size update to the remote system. */ ! void ! sendnaws(void) { long rows, cols; unsigned char tmp[16]; *************** *** 2190,2198 **** } } ! void ! tel_enter_binary(rw) ! int rw; { if (rw&1) send_do(TELOPT_BINARY, 1); --- 2156,2163 ---- } } ! void ! tel_enter_binary(int rw) { if (rw&1) send_do(TELOPT_BINARY, 1); *************** *** 2200,2208 **** send_will(TELOPT_BINARY, 1); } ! void ! tel_leave_binary(rw) ! int rw; { if (rw&1) send_dont(TELOPT_BINARY, 1); --- 2165,2172 ---- send_will(TELOPT_BINARY, 1); } ! void ! tel_leave_binary(int rw) { if (rw&1) send_dont(TELOPT_BINARY, 1);