-/* $OpenBSD: commands.c,v 1.68 2014/07/20 12:08:55 guenther Exp $ */
+/* $OpenBSD: commands.c,v 1.69 2014/07/22 07:30:24 jsg Exp $ */
/* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */
/*
static char *margv[20];
#ifdef SKEY
- int
-skey_calc(argc, argv)
- int argc;
- char **argv;
+int
+skey_calc(int argc, char **argv)
{
int status;
}
}
#endif
-
-
- static void
-makeargv()
+static void
+makeargv(void)
{
char *cp, *cp2, c;
char **argp = margv;
* Todo: 1. Could take random integers (12, 0x12, 012, 0b1).
*/
- static char
-special(s)
- char *s;
+static char
+special(char *s)
{
char c;
char b;
* Construct a control character sequence
* for a special character.
*/
- static char *
-control(c)
- cc_t c;
+static char *
+control(cc_t c)
{
static char buf[5];
/*
return (buf);
}
-
-
/*
* The following are data structures and routines for
* the "send" command.
#define GETSEND(name) ((struct sendlist *) genget(name, (char **) Sendlist, \
sizeof(struct sendlist)))
- static int
-sendcmd(argc, argv)
- int argc;
- char **argv;
+static int
+sendcmd(int argc, char **argv)
{
int count; /* how many bytes we are going to need to send */
int i;
return (count == success);
}
- static int
-send_tncmd(void (*func)(), char *cmd, char *name);
+static int send_tncmd(void (*func)(int, int), char *cmd, char *name);
- static int
-send_esc()
+static int
+send_esc(void)
{
NETADD(escape);
return 1;
}
- static int
-send_docmd(name)
- char *name;
+static int
+send_docmd(char *name)
{
return(send_tncmd(send_do, "do", name));
}
- static int
-send_dontcmd(name)
- char *name;
+static int
+send_dontcmd(char *name)
{
return(send_tncmd(send_dont, "dont", name));
}
- static int
-send_willcmd(name)
- char *name;
+
+static int
+send_willcmd(char *name)
{
return(send_tncmd(send_will, "will", name));
}
- static int
-send_wontcmd(name)
- char *name;
+
+static int
+send_wontcmd(char *name)
{
return(send_tncmd(send_wont, "wont", name));
}
- int
-send_tncmd(func, cmd, name)
- void (*func)();
- char *cmd, *name;
+int
+send_tncmd(void (*func)(int, int), char *cmd, char *name)
{
char **cpp;
extern char *telopts[];
return 1;
}
- static int
-send_help()
+static int
+send_help(void)
{
struct sendlist *s; /* pointer to current command */
for (s = Sendlist; s->name; s++) {
* to by the arguments to the "toggle" command.
*/
- static int
-lclchars()
+static int
+lclchars(int unused)
{
donelclchars = 1;
return 1;
}
- static int
-togdebug()
+static int
+togdebug(int unused)
{
if (net > 0 &&
(setsockopt(net, SOL_SOCKET, SO_DEBUG, &debug, sizeof(debug))) == -1) {
return 1;
}
-
- static int
-togcrlf()
+static int
+togcrlf(int unused)
{
if (crlf) {
printf("Will send carriage returns as telnet <CR><LF>.\r\n");
int binmode;
- static int
-togbinary(val)
- int val;
+static int
+togbinary(int val)
{
donebinarytoggle = 1;
return 1;
}
- static int
-togrbinary(val)
- int val;
+static int
+togrbinary(int val)
{
donebinarytoggle = 1;
return 1;
}
- static int
-togxbinary(val)
- int val;
+static int
+togxbinary(int val)
{
donebinarytoggle = 1;
{ 0 }
};
- static int
+static int
togglehelp(int unused)
{
struct togglelist *c;
return 0;
}
- static void
-settogglehelp(set)
- int set;
+static void
+settogglehelp(int set)
{
struct togglelist *c;
#define GETTOGGLE(name) (struct togglelist *) \
genget(name, (char **) Togglelist, sizeof(struct togglelist))
- static int
-toggle(argc, argv)
- int argc;
- char *argv[];
+static int
+toggle(int argc, char *argv[])
{
int retval = 1;
char *name;
{ 0 }
};
- static struct setlist *
-getset(name)
- char *name;
+static struct setlist *
+getset(char *name)
{
return (struct setlist *)
genget(name, (char **) Setlist, sizeof(struct setlist));
}
- void
-set_escape_char(s)
- char *s;
+void
+set_escape_char(char *s)
{
if (rlogin != _POSIX_VDISABLE) {
rlogin = (s && *s) ? special(s) : _POSIX_VDISABLE;
}
}
- static int
-setcmd(argc, argv)
- int argc;
- char *argv[];
+static int
+setcmd(int argc, char *argv[])
{
int value;
struct setlist *ct;
return 1;
}
- static int
-unsetcmd(argc, argv)
- int argc;
- char *argv[];
+static int
+unsetcmd(int argc, char *argv[])
{
struct setlist *ct;
struct togglelist *c;
* 'mode' command.
*/
#ifdef KLUDGELINEMODE
- static int
-dokludgemode()
+static int
+dokludgemode(int unused)
{
kludgelinemode = 1;
send_wont(TELOPT_LINEMODE, 1);
}
#endif
- static int
-dolinemode()
+static int
+dolinemode(int unused)
{
#ifdef KLUDGELINEMODE
if (kludgelinemode)
return 1;
}
- static int
-docharmode()
+static int
+docharmode(int unused)
{
#ifdef KLUDGELINEMODE
if (kludgelinemode)
return 1;
}
- static int
-dolmmode(bit, on)
- int bit, on;
+static int
+dolmmode(int bit, int on)
{
unsigned char c;
return 1;
}
- int
-tn_setmode(bit)
+int
+tn_setmode(int bit)
{
return dolmmode(bit, 1);
}
- int
-tn_clearmode(bit)
+int
+tn_clearmode(int bit)
{
return dolmmode(bit, 0);
}
{ 0 },
};
-
- static int
+static int
modehelp(int unused)
{
struct modelist *mt;
#define GETMODECMD(name) (struct modelist *) \
genget(name, (char **) ModeList, sizeof(struct modelist))
- static int
-modecmd(argc, argv)
- int argc;
- char *argv[];
+static int
+modecmd(int argc, char *argv[])
{
struct modelist *mt;
* "display" command.
*/
- static int
-display(argc, argv)
- int argc;
- char *argv[];
+static int
+display(int argc, char *argv[])
{
struct togglelist *tl;
struct setlist *sl;
/*
* Set the escape character.
*/
- static int
-setescape(argc, argv)
- int argc;
- char *argv[];
+static int
+setescape(int argc, char *argv[])
{
char *arg;
char buf[50];
return 1;
}
- static int
-togcrmod()
+static int
+togcrmod(int unused1, char *unused2[])
{
crmod = !crmod;
printf("Deprecated usage - please use 'toggle crmod' in the future.\r\n");
return 1;
}
- int
-telnetsuspend()
+int
+telnetsuspend(int unused1, char *unused2[])
{
setcommandmode();
{
return 1;
}
- int
-shell(argc, argv)
- int argc;
- char *argv[];
+int
+shell(int argc, char *argv[])
{
long oldrows, oldcols, newrows, newcols, err;
}
static int
-bye(argc, argv)
- int argc; /* Number of arguments */
- char *argv[]; /* arguments */
+bye(int argc, char *argv[])
{
close_connection();
longjmp(toplevel, 1);
quit();
}
- static int
-logout()
+static int
+logout(int unused1, char *unused2[])
{
send_do(TELOPT_LOGOUT, 1);
(void) netflush();
{ 0 },
};
- static void
+static void
slc_help(int unused)
{
struct slclist *c;
}
}
- static struct slclist *
-getslc(name)
- char *name;
+static struct slclist *
+getslc(char *name)
{
return (struct slclist *)
genget(name, (char **) SlcList, sizeof(struct slclist));
}
- static int
-slccmd(argc, argv)
- int argc;
- char *argv[];
+static int
+slccmd(int argc, char *argv[])
{
struct slclist *c;
};
static void
-env_help()
+env_help(void)
{
struct envlist *c;
}
static struct envlist *
-getenvcmd(name)
- char *name;
+getenvcmd(char *name)
{
return (struct envlist *)
genget(name, (char **) EnvList, sizeof(struct envlist));
}
static int
-env_cmd(argc, argv)
- int argc;
- char *argv[];
+env_cmd(int argc, char *argv[])
{
struct envlist *c;
struct env_lst envlisthead;
static struct env_lst *
-env_find(var)
- unsigned char *var;
+env_find(unsigned char *var)
{
struct env_lst *ep;
return(NULL);
}
- void
-env_init()
+void
+env_init(void)
{
extern char **environ;
char **epp, *cp;
env_export((unsigned char *)"XAUTHORITY");
}
- struct env_lst *
-env_define(var, value)
- unsigned char *var, *value;
+struct env_lst *
+env_define(unsigned char *var, unsigned char *value)
{
struct env_lst *ep;
}
static void
-env_undefine(var)
- unsigned char *var;
+env_undefine(unsigned char *var)
{
struct env_lst *ep;
}
static void
-env_export(var)
- unsigned char *var;
+env_export(unsigned char *var)
{
struct env_lst *ep;
}
static void
-env_unexport(var)
- unsigned char *var;
+env_unexport(unsigned char *var)
{
struct env_lst *ep;
}
static void
-env_send(var)
- unsigned char *var;
+env_send(unsigned char *var)
{
struct env_lst *ep;
}
static void
-env_list()
+env_list(void)
{
struct env_lst *ep;
}
}
- unsigned char *
-env_default(init, welldefined)
- int init;
+unsigned char *
+env_default(int init, int welldefined)
{
static struct env_lst *nep = NULL;
return(NULL);
}
- unsigned char *
-env_getvalue(var, exported_only)
- unsigned char *var;
- int exported_only;
+unsigned char *
+env_getvalue(unsigned char *var, int exported_only)
{
struct env_lst *ep;
fclose(rcfile);
}
-
- int
-tn(argc, argv)
- int argc;
- char *argv[];
+int
+tn(int argc, char *argv[])
{
struct addrinfo hints, *res, *res0;
int error;
};
- static Command *
-getcmd(name)
- char *name;
+static Command *
+getcmd(char *name)
{
Command *cm;
return (Command *) genget(name, (char **) cmdtab2, sizeof(Command));
}
- void
-command(top, tbuf, cnt)
- int top;
- char *tbuf;
- int cnt;
+void
+command(int top, char *tbuf, int cnt)
{
Command *c;
/*
* Help command.
*/
- static int
-help(argc, argv)
- int argc;
- char *argv[];
+static int
+help(int argc, char *argv[])
{
Command *c;
*/
static unsigned long
-sourceroute(arg, cpp, lenp)
- char *arg;
- char **cpp;
- int *lenp;
+sourceroute(char *arg, char **cpp, int *lenp)
{
static char lsr[44];
char *cp, *cp2, *lsrp, *lsrep;
-/* $OpenBSD: externs.h,v 1.27 2014/07/20 12:08:55 guenther Exp $ */
+/* $OpenBSD: externs.h,v 1.28 2014/07/22 07:30:24 jsg Exp $ */
/* $KTH: externs.h,v 1.16 1997/11/29 02:28:35 joda Exp $ */
/*
void Dump(char direction, unsigned char *buffer, int length);
void printoption(char *direction, int cmd, int option);
void optionstatus(void);
-void printsub(int direction, unsigned char *pointer, int length);
+void printsub(char direction, unsigned char *pointer, int length);
void EmptyTerminal(void);
void SetForExit(void);
__dead void Exit(int returnCode);
-/* $OpenBSD: main.c,v 1.29 2014/07/20 11:20:52 guenther Exp $ */
+/* $OpenBSD: main.c,v 1.30 2014/07/22 07:30:24 jsg Exp $ */
/* $NetBSD: main.c,v 1.5 1996/02/28 21:04:05 thorpej Exp $ */
/*
/*
* Initialize variables.
*/
- void
-tninit()
+void
+tninit(void)
{
init_terminal();
* main. Parse arguments, invoke the protocol or command parser.
*/
- int
-main(argc, argv)
- int argc;
- char *argv[];
+int
+main(int argc, char *argv[])
{
int ch;
char *user, *alias;
-/* $OpenBSD: network.c,v 1.16 2014/07/20 10:55:26 guenther Exp $ */
+/* $OpenBSD: network.c,v 1.17 2014/07/22 07:30:24 jsg Exp $ */
/* $NetBSD: network.c,v 1.5 1996/02/28 21:04:06 thorpej Exp $ */
/*
* Telnet "synch" processing).
*/
- int
-stilloob()
+int
+stilloob(void)
{
struct pollfd pfd[1];
int value;
return 0;
}
-
/*
* setneturg()
*
* Sets "neturg" to the current location.
*/
- void
-setneturg()
+void
+setneturg(void)
{
ring_mark(&netoring);
}
-
/*
* netflush
* Send as much data as possible to the network,
* useful work.
*/
-
- int
-netflush()
+int
+netflush(void)
{
int n, n1;
-/* $OpenBSD: ring.c,v 1.10 2014/07/20 10:32:23 jsg Exp $ */
+/* $OpenBSD: ring.c,v 1.11 2014/07/22 07:30:24 jsg Exp $ */
/* $NetBSD: ring.c,v 1.7 1996/02/28 21:04:07 thorpej Exp $ */
/*
((d)->supplytime > (d)->consumetime))
-
-
-
/* Buffer state transition routines */
void
-ring_init(ring, buffer, count)
- Ring *ring;
- unsigned char *buffer;
- int count;
+ring_init(Ring *ring, unsigned char *buffer, int count)
{
memset(ring, 0, sizeof *ring);
* Mark the most recently supplied byte.
*/
- void
-ring_mark(ring)
- Ring *ring;
+void
+ring_mark(Ring *ring)
{
ring->mark = ring_decrement(ring, ring->supply, 1);
}
* Is the ring pointing to the mark?
*/
- int
-ring_at_mark(ring)
- Ring *ring;
+int
+ring_at_mark(Ring *ring)
{
if (ring->mark == ring->consume) {
return 1;
* Clear any mark set on the ring.
*/
- void
-ring_clear_mark(ring)
- Ring *ring;
+void
+ring_clear_mark(Ring *ring)
{
ring->mark = NULL;
}
/*
* Add characters from current segment to ring buffer.
*/
- void
-ring_supplied(ring, count)
- Ring *ring;
- int count;
+void
+ring_supplied(Ring *ring, int count)
{
ring->supply = ring_increment(ring, ring->supply, count);
ring->supplytime = ++ring_clock;
/*
* We have just consumed "c" bytes.
*/
- void
-ring_consumed(ring, count)
- Ring *ring;
- int count;
+void
+ring_consumed(Ring *ring, int count)
{
if (count == 0) /* don't update anything */
return;
}
-
/* Buffer state query routines */
/* Number of bytes that may be supplied */
- int
-ring_empty_count(ring)
- Ring *ring;
+int
+ring_empty_count(Ring *ring)
{
if (ring_empty(ring)) { /* if empty */
return ring->size;
}
/* number of CONSECUTIVE bytes that may be supplied */
- int
-ring_empty_consecutive(ring)
- Ring *ring;
+int
+ring_empty_consecutive(Ring *ring)
{
if ((ring->consume < ring->supply) || ring_empty(ring)) {
/*
* (but don't give more than enough to get to cross over set mark)
*/
- int
-ring_full_count(ring)
- Ring *ring;
+int
+ring_full_count(Ring *ring)
{
if ((ring->mark == NULL) || (ring->mark == ring->consume)) {
if (ring_full(ring)) {
* Return the number of CONSECUTIVE bytes available for consuming.
* However, don't return more than enough to cross over set mark.
*/
- int
-ring_full_consecutive(ring)
- Ring *ring;
+int
+ring_full_consecutive(Ring *ring)
{
if ((ring->mark == NULL) || (ring->mark == ring->consume)) {
if ((ring->supply < ring->consume) || ring_full(ring)) {
/*
* Move data into the "supply" portion of of the ring buffer.
*/
- void
-ring_supply_data(ring, buffer, count)
- Ring *ring;
- unsigned char *buffer;
- int count;
+void
+ring_supply_data(Ring *ring, unsigned char *buffer, int count)
{
int i;
-/* $OpenBSD: sys_bsd.c,v 1.26 2014/07/20 12:08:55 guenther Exp $ */
+/* $OpenBSD: sys_bsd.c,v 1.27 2014/07/22 07:30:24 jsg Exp $ */
/* $NetBSD: sys_bsd.c,v 1.11 1996/02/28 21:04:10 thorpej Exp $ */
/*
struct termios old_tc = { 0 };
- void
-init_sys()
+void
+init_sys(void)
{
tout = fileno(stdout);
tin = fileno(stdin);
* 1 Do add this character
*/
- int
-TerminalSpecialChars(c)
- int c;
+int
+TerminalSpecialChars(int c)
{
if (c == termIntChar) {
intp();
return 1;
}
- void
-TerminalSaveState()
+void
+TerminalSaveState(void)
{
tcgetattr(0, &old_tc);
#endif
}
- cc_t *
-tcval(func)
- int func;
+cc_t *
+tcval(int func)
{
switch(func) {
case SLC_IP: return(&termIntChar);
}
}
- void
-TerminalDefaultChars()
+void
+TerminalDefaultChars(void)
{
memcpy(new_tc.c_cc, old_tc.c_cc, sizeof(old_tc.c_cc));
# ifndef VDISCARD
static void ayt();
#endif
- void
-TerminalNewMode(f)
- int f;
+void
+TerminalNewMode(int f)
{
static int prevmode = 0;
struct termios tmp_tc;
};
#endif /* DECODE_BAUD */
- void
-TerminalSpeeds(ispeed, ospeed)
- long *ispeed;
- long *ospeed;
+void
+TerminalSpeeds(long *ispeed, long *ospeed)
{
#ifdef DECODE_BAUD
struct termspeeds *tp;
#endif /* DECODE_BAUD */
}
- int
-TerminalWindowSize(rows, cols)
- long *rows, *cols;
+int
+TerminalWindowSize(long *rows, long *cols)
{
#ifdef TIOCGWINSZ
struct winsize ws;
* Various signal handling routines.
*/
- void
-deadpeer(sig)
- int sig;
+void
+deadpeer(int sig)
{
setcommandmode();
longjmp(peerdied, -1);
}
- void
-intr(sig)
- int sig;
+void
+intr(int sig)
{
if (localchars) {
intp();
longjmp(toplevel, -1);
}
- void
-intr2(sig)
- int sig;
+void
+intr2(int sig)
{
if (localchars) {
#ifdef KLUDGELINEMODE
}
}
- void
-susp(sig)
- int sig;
+void
+susp(int sig)
{
if ((rlogin != _POSIX_VDISABLE) && rlogin_susp())
return;
}
#ifdef SIGWINCH
- void
-sendwin(sig)
- int sig;
+void
+sendwin(int sig)
{
if (connected) {
sendnaws();
#endif
#ifdef SIGINFO
- void
-ayt(sig)
- int sig;
+void
+ayt(int sig)
{
if (connected)
sendayt();
#endif
\f
- void
-sys_telnet_init()
+void
+sys_telnet_init(void)
{
int one = 1;
* The return value is 1 if something happened, 0 if not.
*/
- int
-process_rings(netin, netout, netex, ttyin, ttyout, dopoll)
- int dopoll; /* If 0, then block until something to do */
+int
+process_rings(int netin, int netout, int netex, int ttyin, int ttyout,
+ int dopoll) /* If 0, then block until something to do */
{
int c;
/* One wants to be a bit careful about setting returnValue
-/* $OpenBSD: telnet.c,v 1.28 2014/07/20 10:55:26 guenther Exp $ */
+/* $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 $ */
/*
* Initialize telnet environment.
*/
- void
-init_telnet()
+void
+init_telnet(void)
{
env_init();
* is in disagreement as to what the current state should be.
*/
- void
-send_do(c, init)
- int c, init;
+void
+send_do(int c, int init)
{
if (init) {
if (((do_dont_resp[c] == 0) && my_state_is_do(c)) ||
printoption("SENT",DO, c);
}
- void
-send_dont(c, init)
- int c, init;
+void
+send_dont(int c, int init)
{
if (init) {
if (((do_dont_resp[c] == 0) && my_state_is_dont(c)) ||
printoption("SENT", DONT, c);
}
- void
-send_will(c, init)
- int c, init;
+void
+send_will(int c, int init)
{
if (init) {
if (((will_wont_resp[c] == 0) && my_state_is_will(c)) ||
printoption("SENT", WILL, c);
}
- void
-send_wont(c, init)
- int c, init;
+void
+send_wont(int c, int init)
{
if (init) {
if (((will_wont_resp[c] == 0) && my_state_is_wont(c)) ||
printoption("SENT", WONT, c);
}
-
static void
-willoption(option)
- int option;
+willoption(int option)
{
int new_state_ok = 0;
}
static void
-wontoption(option)
- int option;
+wontoption(int option)
{
if (do_dont_resp[option]) {
--do_dont_resp[option];
}
static void
-dooption(option)
- int option;
+dooption(int option)
{
int new_state_ok = 0;
}
static void
-dontoption(option)
- int option;
+dontoption(int option)
{
if (will_wont_resp[option]) {
static char *name_unknown = "UNKNOWN";
static char *unknown[] = { NULL, NULL };
- char **
-mklist(buf, name)
- char *buf, *name;
+char **
+mklist(char *buf, char *name)
{
int n;
char c, *cp, **argvp, *cp2, **argv, **avt;
return(unknown);
}
- int
-is_unique(name, as, ae)
- char *name, **as, **ae;
+int
+is_unique(char *name, char **as, char **ae)
{
char **ap;
int n;
int resettermname = 1;
- char *
-gettermname()
+char *
+gettermname(void)
{
char *tname;
static char **tnamep = NULL;
next = tnamep;
return(*next++);
}
+
/*
* suboption()
*
* Linemode
*/
- static void
-suboption()
+static void
+suboption(void)
{
unsigned char subchar;
static unsigned char str_lm[] = { IAC, SB, TELOPT_LINEMODE, 0, 0, IAC, SE };
static void
-lm_will(cmd, len)
- unsigned char *cmd;
- int len;
+lm_will(unsigned char *cmd, int len)
{
if (len < 1) {
/*@*/ printf("lm_will: no command!!!\n"); /* Should not happen... */
}
static void
-lm_wont(cmd, len)
- unsigned char *cmd;
- int len;
+lm_wont(unsigned char *cmd, int len)
{
if (len < 1) {
/*@*/ printf("lm_wont: no command!!!\n"); /* Should not happen... */
}
static void
-lm_do(cmd, len)
- unsigned char *cmd;
- int len;
+lm_do(unsigned char *cmd, int len)
{
if (len < 1) {
/*@*/ printf("lm_do: no command!!!\n"); /* Should not happen... */
}
static void
-lm_dont(cmd, len)
- unsigned char *cmd;
- int len;
+lm_dont(unsigned char *cmd, int len)
{
if (len < 1) {
/*@*/ printf("lm_dont: no command!!!\n"); /* Should not happen... */
IAC, SB, TELOPT_LINEMODE, LM_MODE, 0, IAC, SE
};
- void
-lm_mode(cmd, len, init)
- unsigned char *cmd;
- int len, init;
+void
+lm_mode(unsigned char *cmd, int len, int init)
{
if (len != 1)
return;
static int slc_mode = SLC_EXPORT;
static void
-slc_init()
+slc_init(void)
{
struct spc *spcp;
}
- void
-slcstate()
+void
+slcstate(void)
{
printf("Special characters are %s values\n",
slc_mode == SLC_IMPORT ? "remote default" :
"remote");
}
- void
+void
slc_mode_export(int unused)
{
slc_mode = SLC_EXPORT;
slc_export();
}
- void
-slc_mode_import(def)
- int def;
+void
+slc_mode_import(int def)
{
slc_mode = def ? SLC_IMPORT : SLC_RVALUE;
if (my_state_is_will(TELOPT_LINEMODE))
};
static void
-slc_import(def)
- int def;
+slc_import(int def)
{
if (NETROOM() > sizeof(slc_import_val)) {
if (def) {
}
static void
-slc_export()
+slc_export(void)
{
struct spc *spcp;
}
static void
-slc(cp, len)
- unsigned char *cp;
- int len;
+slc(unsigned char *cp, int len)
{
struct spc *spcp;
int func,level;
setconnmode(1); /* set the new character values */
}
- void
-slc_check()
+void
+slc_check(void)
{
struct spc *spcp;
static unsigned char slc_reply[2 * SUBBUFSIZE];
static unsigned char *slc_replyp;
- unsigned char
+unsigned char
slc_add(unsigned char ch)
{
if (slc_replyp == slc_reply + sizeof(slc_reply))
}
static void
-slc_start_reply()
+slc_start_reply(void)
{
slc_replyp = slc_reply;
slc_add(IAC);
}
static void
-slc_add_reply(func, flags, value)
- unsigned char func;
- unsigned char flags;
- cc_t value;
+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");
}
static void
-slc_end_reply()
+slc_end_reply(void)
{
int len;
}
static int
-slc_update()
+slc_update(void)
{
struct spc *spcp;
int need_update = 0;
}
static void
-env_opt(buf, len)
- unsigned char *buf;
- int len;
+env_opt(unsigned char *buf, int len)
{
unsigned char *ep = 0, *epc = 0;
int i;
static unsigned char *opt_replyp;
static unsigned char *opt_replyend;
- void
+void
opt_add(unsigned char ch)
{
if (opt_replyp == opt_replyend)
return;
*opt_replyp++ = ch;
}
+
static void
-env_opt_start()
+env_opt_start(void)
{
unsigned char *p;
opt_add(TELQUAL_IS);
}
- void
-env_opt_start_info()
+void
+env_opt_start_info(void)
{
env_opt_start();
if (opt_replyp)
opt_replyp[-1] = TELQUAL_INFO;
}
- void
-env_opt_add(ep)
- unsigned char *ep;
+void
+env_opt_add(unsigned char *ep)
{
unsigned char *vp, c;
}
}
- int
-opt_welldefined(ep)
- char *ep;
+int
+opt_welldefined(char *ep)
{
if ((strcmp(ep, "USER") == 0) ||
(strcmp(ep, "DISPLAY") == 0) ||
return(1);
return(0);
}
- void
-env_opt_end(emptyok)
- int emptyok;
+
+void
+env_opt_end(int emptyok)
{
int len;
\f
- int
-telrcv()
+int
+telrcv(void)
{
int c;
int scc;
static int bol = 1, local = 0;
- int
-rlogin_susp()
+int
+rlogin_susp(void)
{
if (local) {
local = 0;
return(0);
}
- static int
-telsnd()
+static int
+telsnd(void)
{
int tcc;
int count;
*
*/
-
- int
-Scheduler(block)
- int block; /* should we block in the select ? */
+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,
/*
* Select from tty and network...
*/
- void
-telnet(user)
- char *user;
+void
+telnet(char *user)
{
sys_telnet_init();
* character.
*/
- static char *
-nextitem(current)
- char *current;
+static char *
+nextitem(char *current)
{
if ((*current&0xff) != IAC) {
return current+1;
* us in any case.
*/
- static void
-netclear()
+static void
+netclear(void)
{
#if 0 /* XXX */
char *thisitem, *next;
* These routines add various telnet commands to the data stream.
*/
- static void
-doflush()
+static void
+doflush(void)
{
NET2ADD(IAC, DO);
NETADD(TELOPT_TM);
printoption("SENT", DO, TELOPT_TM);
}
- void
-xmitAO()
+void
+xmitAO(void)
{
NET2ADD(IAC, AO);
printoption("SENT", IAC, AO);
}
- void
-xmitEL()
+void
+xmitEL(void)
{
NET2ADD(IAC, EL);
printoption("SENT", IAC, EL);
}
- void
-xmitEC()
+void
+xmitEC(void)
{
NET2ADD(IAC, EC);
printoption("SENT", IAC, EC);
}
- int
-dosynch()
+int
+dosynch(void)
{
netclear(); /* clear the path to the network */
NETADD(IAC);
int want_status_response = 0;
- int
-get_status()
+int
+get_status(void)
{
unsigned char tmp[16];
unsigned char *cp;
return 1;
}
- void
-intp()
+void
+intp(void)
{
NET2ADD(IAC, IP);
printoption("SENT", IAC, IP);
}
}
- void
-sendbrk()
+void
+sendbrk(void)
{
NET2ADD(IAC, BREAK);
printoption("SENT", IAC, BREAK);
}
}
- void
-sendabort()
+void
+sendabort(void)
{
NET2ADD(IAC, ABORT);
printoption("SENT", IAC, ABORT);
}
}
- void
-sendsusp()
+void
+sendsusp(void)
{
NET2ADD(IAC, SUSP);
printoption("SENT", IAC, SUSP);
}
}
- void
-sendeof()
+void
+sendeof(void)
{
NET2ADD(IAC, xEOF);
printoption("SENT", IAC, xEOF);
}
- void
-sendayt()
+void
+sendayt(void)
{
NET2ADD(IAC, AYT);
printoption("SENT", IAC, AYT);
* Send a window size update to the remote system.
*/
- void
-sendnaws()
+void
+sendnaws(void)
{
long rows, cols;
unsigned char tmp[16];
}
}
- void
-tel_enter_binary(rw)
- int rw;
+void
+tel_enter_binary(int rw)
{
if (rw&1)
send_do(TELOPT_BINARY, 1);
send_will(TELOPT_BINARY, 1);
}
- void
-tel_leave_binary(rw)
- int rw;
+void
+tel_leave_binary(int rw)
{
if (rw&1)
send_dont(TELOPT_BINARY, 1);
-/* $OpenBSD: terminal.c,v 1.12 2014/07/20 12:08:55 guenther Exp $ */
+/* $OpenBSD: terminal.c,v 1.13 2014/07/22 07:30:24 jsg Exp $ */
/* $NetBSD: terminal.c,v 1.5 1996/02/28 21:04:17 thorpej Exp $ */
/*
*/
void
-init_terminal()
+init_terminal(void)
{
struct termios tc;
autoflush = (tc.c_lflag & NOFLSH) == 0;
}
-
/*
* Send as much data as possible to the terminal.
*
* n: All data - n was written out.
*/
-
- int
-ttyflush(drop)
- int drop;
+int
+ttyflush(int drop)
{
int n, n0, n1;
* of various global variables).
*/
-
- int
-getconnmode()
+int
+getconnmode(void)
{
int mode = 0;
return(mode);
}
- void
-setconnmode(force)
- int force;
+void
+setconnmode(int force)
{
int newmode;
TerminalNewMode(newmode);
}
-
- void
-setcommandmode()
+void
+setcommandmode(void)
{
TerminalNewMode(-1);
}
-/* $OpenBSD: utilities.c,v 1.19 2014/07/20 12:08:55 guenther Exp $ */
+/* $OpenBSD: utilities.c,v 1.20 2014/07/22 07:30:24 jsg Exp $ */
/* $NetBSD: utilities.c,v 1.5 1996/02/28 21:04:21 thorpej Exp $ */
/*
unsigned char NetTraceFile[PATH_MAX] = "(standard output)";
- void
-SetNetTrace(file)
- char *file;
+void
+SetNetTrace(char *file)
{
if (NetTrace && NetTrace != stdout)
fclose(NetTrace);
strlcpy((char *)NetTraceFile, "(standard output)", sizeof(NetTraceFile));
}
- void
-Dump(direction, buffer, length)
- char direction;
- unsigned char *buffer;
- int length;
+void
+Dump(char direction, unsigned char *buffer, int length)
{
# define BYTES_PER_LINE 32
# define min(x,y) ((x<y)? x:y)
fflush(NetTrace);
}
-
- void
-printoption(direction, cmd, option)
- char *direction;
- int cmd, option;
+void
+printoption(char *direction, int cmd, int option)
{
if (!showoptions)
return;
return;
}
- void
-optionstatus()
+void
+optionstatus(void)
{
int i;
}
- void
-printsub(direction, pointer, length)
- char direction; /* '<' or '>' */
- unsigned char *pointer; /* where suboption data sits */
- int length; /* length of suboption data */
+void
+printsub(char direction, /* '<' or '>' */
+ unsigned char *pointer, /* where suboption data sits */
+ int length) /* length of suboption data */
{
int i;
* way to the kernel (thus the poll).
*/
- void
-EmptyTerminal()
+void
+EmptyTerminal(void)
{
struct pollfd pfd[1];
}
}
- void
-SetForExit()
+void
+SetForExit(void)
{
setconnmode(0);
do {
setcommandmode();
}
- void
-Exit(returnCode)
- int returnCode;
+void
+Exit(int returnCode)
{
SetForExit();
exit(returnCode);
}
- void
-ExitString(string, returnCode)
- char *string;
- int returnCode;
+void
+ExitString(char *string, int returnCode)
{
SetForExit();
fwrite(string, 1, strlen(string), stderr);