de-__P, ANSIfy function declarations, remove obsolete "register" declarations.

This commit is contained in:
perry 2005-02-06 05:58:20 +00:00
parent 4fcf86857c
commit 4b90129081
8 changed files with 258 additions and 335 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: authenc.c,v 1.11 2003/08/07 09:46:51 agc Exp $ */
/* $NetBSD: authenc.c,v 1.12 2005/02/06 05:58:20 perry Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)authenc.c 8.2 (Berkeley) 5/30/95";
#else
__RCSID("$NetBSD: authenc.c,v 1.11 2003/08/07 09:46:51 agc Exp $");
__RCSID("$NetBSD: authenc.c,v 1.12 2005/02/06 05:58:20 perry Exp $");
#endif
#endif /* not lint */
@ -43,9 +43,7 @@ __RCSID("$NetBSD: authenc.c,v 1.11 2003/08/07 09:46:51 agc Exp $");
#include <libtelnet/misc.h>
int
telnet_net_write(str, len)
unsigned char *str;
int len;
telnet_net_write(unsigned char *str, int len)
{
if (nfrontp + len < netobuf + BUFSIZ) {
output_datalen((const char *)str, len);
@ -55,7 +53,7 @@ telnet_net_write(str, len)
}
void
net_encrypt()
net_encrypt(void)
{
#ifdef ENCRYPTION
char *s = (nclearto > nbackp) ? nclearto : nbackp;
@ -67,25 +65,20 @@ net_encrypt()
}
int
telnet_spin()
telnet_spin(void)
{
ttloop();
return(0);
}
char *
telnet_getenv(val)
char *val;
telnet_getenv(char *val)
{
return(getenv(val));
}
char *
telnet_gets(prompt, result, length, echo)
char *prompt;
char *result;
int length;
int echo;
telnet_gets(char *prompt, char *result, int length, int echo)
{
return((char *)0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext.h,v 1.18 2003/08/07 09:46:51 agc Exp $ */
/* $NetBSD: ext.h,v 1.19 2005/02/06 05:58:20 perry Exp $ */
/*
* Copyright (c) 1989, 1993
@ -77,99 +77,99 @@ extern int SYNCHing; /* we are in TELNET SYNCH mode */
#include <sys/cdefs.h>
extern void
_termstat __P((void)),
add_slc __P((int, int, int)),
check_slc __P((void)),
change_slc __P((int, int, int)),
cleanup __P((int)),
clientstat __P((int, int, int)),
copy_termbuf __P((char *, int)),
deferslc __P((void)),
defer_terminit __P((void)),
do_opt_slc __P((unsigned char *, int)),
doeof __P((void)),
dooption __P((int)),
dontoption __P((int)),
edithost __P((char *, char *)),
fatal __P((int, const char *)),
fatalperror __P((int, const char *)),
get_slc_defaults __P((void)),
init_env __P((void)),
init_termbuf __P((void)),
interrupt __P((void)),
localstat __P((void)),
flowstat __P((void)),
netclear __P((void)),
netflush __P((void)),
_termstat(void),
add_slc(char, char, cc_t),
check_slc(void),
change_slc(int, int, cc_t),
cleanup(int),
clientstat(int, int, int),
copy_termbuf(char *, int),
deferslc(void),
defer_terminit(void),
do_opt_slc(unsigned char *, int),
doeof(void),
dooption(int),
dontoption(int),
edithost(char *, char *),
fatal(int, const char *),
fatalperror(int, const char *),
get_slc_defaults(void),
init_env(void),
init_termbuf(void),
interrupt(void),
localstat(void),
flowstat(void),
netclear(void),
netflush(void),
#ifdef DIAGNOSTICS
printoption __P((const char *, int)),
printdata __P((char *, char *, int)),
printoption(const char *, int),
printdata(char *, char *, int),
#ifndef ENCRYPTION
printsub __P((int, unsigned char *, int)),
printsub(int, unsigned char *, int),
#endif
#endif
ptyflush __P((void)),
putchr __P((int)),
recv_ayt __P((void)),
send_do __P((int, int)),
send_dont __P((int, int)),
send_slc __P((void)),
send_status __P((void)),
send_will __P((int, int)),
send_wont __P((int, int)),
sendbrk __P((void)),
sendsusp __P((void)),
set_termbuf __P((void)),
start_login __P((char *, int, char *)),
start_slc __P((int)),
startslave __P((char *, int, char *)),
suboption __P((void)),
telrcv __P((void)),
ttloop __P((void)),
tty_binaryin __P((int)),
tty_binaryout __P((int));
ptyflush(void),
putchr(int),
recv_ayt(void),
send_do(int, int),
send_dont(int, int),
send_slc(void),
send_status(void),
send_will(int, int),
send_wont(int, int),
sendbrk(void),
sendsusp(void),
set_termbuf(void),
start_login(char *, int, char *),
start_slc(int),
startslave(char *, int, char *),
suboption(void),
telrcv(void),
ttloop(void),
tty_binaryin(int),
tty_binaryout(int);
extern char *
putf __P((char *, char *));
putf(char *, char *);
extern int
end_slc __P((unsigned char **)),
getnpty __P((void)),
getpty __P((int *)),
spcset __P((int, cc_t *, cc_t **)),
stilloob __P((int)),
terminit __P((void)),
termstat __P((void)),
tty_flowmode __P((void)),
tty_restartany __P((void)),
tty_isbinaryin __P((void)),
tty_isbinaryout __P((void)),
tty_iscrnl __P((void)),
tty_isecho __P((void)),
tty_isediting __P((void)),
tty_islitecho __P((void)),
tty_isnewmap __P((void)),
tty_israw __P((void)),
tty_issofttab __P((void)),
tty_istrapsig __P((void)),
tty_linemode __P((void));
end_slc(unsigned char **),
getnpty(void),
getpty(int *),
spcset(int, cc_t *, cc_t **),
stilloob(int),
terminit(void),
termstat(void),
tty_flowmode(void),
tty_restartany(void),
tty_isbinaryin(void),
tty_isbinaryout(void),
tty_iscrnl(void),
tty_isecho(void),
tty_isediting(void),
tty_islitecho(void),
tty_isnewmap(void),
tty_israw(void),
tty_issofttab(void),
tty_istrapsig(void),
tty_linemode(void);
extern void
tty_rspeed __P((int)),
tty_setecho __P((int)),
tty_setedit __P((int)),
tty_setlinemode __P((int)),
tty_setlitecho __P((int)),
tty_setsig __P((int)),
tty_setsofttab __P((int)),
tty_tspeed __P((int)),
willoption __P((int)),
wontoption __P((int)),
writenet __P((unsigned char *, int));
tty_rspeed(int),
tty_setecho(int),
tty_setedit(int),
tty_setlinemode(int),
tty_setlitecho(int),
tty_setsig(int),
tty_setsofttab(int),
tty_tspeed(int),
willoption(int),
wontoption(int),
writenet(unsigned char *, int);
extern int output_data __P((const char *, ...))
extern int output_data(const char *, ...)
__attribute__((__format__(__printf__, 1, 2)));
extern int output_datalen __P((const char *, size_t));
extern int output_datalen(const char *, size_t);
#ifdef ENCRYPTION
extern char *nclearto;

View File

@ -1,4 +1,4 @@
/* $NetBSD: slc.c,v 1.13 2003/08/07 09:46:51 agc Exp $ */
/* $NetBSD: slc.c,v 1.14 2005/02/06 05:58:20 perry Exp $ */
/*
* Copyright (c) 1989, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)slc.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: slc.c,v 1.13 2003/08/07 09:46:51 agc Exp $");
__RCSID("$NetBSD: slc.c,v 1.14 2005/02/06 05:58:20 perry Exp $");
#endif
#endif /* not lint */
@ -50,8 +50,8 @@ static int slcchange; /* change to slc is requested */
static unsigned char *slcptr; /* pointer into slc buffer */
static unsigned char slcbuf[NSLC*6]; /* buffer for slc negotiation */
void default_slc __P((void));
void process_slc __P((u_int, u_int, cc_t));
void default_slc(void);
void process_slc(u_int, u_int, cc_t);
/*
* send_slc
@ -59,9 +59,9 @@ void process_slc __P((u_int, u_int, cc_t));
* Write out the current special characters to the client.
*/
void
send_slc()
send_slc(void)
{
register int i;
int i;
/*
* Send out list of triplets of special characters
@ -83,9 +83,9 @@ send_slc()
* Set pty special characters to all the defaults.
*/
void
default_slc()
default_slc(void)
{
register int i;
int i;
for (i = 1; i <= NSLC; i++) {
slctab[i].current.val = slctab[i].defset.val;
@ -108,9 +108,9 @@ default_slc()
* Initialize the slc mapping table.
*/
void
get_slc_defaults()
get_slc_defaults(void)
{
register int i;
int i;
init_termbuf();
@ -130,9 +130,7 @@ get_slc_defaults()
* Add an slc triplet to the slc buffer.
*/
void
add_slc(func, flag, val)
register char func, flag;
register cc_t val;
add_slc(char func, char flag, cc_t val)
{
if ((*slcptr++ = (unsigned char)func) == 0xff)
@ -155,8 +153,7 @@ add_slc(func, flag, val)
* of the terminal control structures.
*/
void
start_slc(getit)
register int getit;
start_slc(int getit)
{
slcchange = 0;
@ -174,10 +171,9 @@ start_slc(getit)
* Finish up the slc negotiation. If something to send, then send it.
*/
int
end_slc(bufp)
register unsigned char **bufp;
end_slc(unsigned char **bufp)
{
register int len;
int len;
/*
* If a change has occurred, store the new terminal control
@ -222,9 +218,7 @@ end_slc(bufp)
* Figure out what to do about the client's slc
*/
void
process_slc(func, flag, val)
u_int func, flag;
cc_t val;
process_slc(u_int func, u_int flag, cc_t val)
{
int hislevel, mylevel, ack;
@ -288,9 +282,7 @@ process_slc(func, flag, val)
* Compare client's request with what we are capable of supporting.
*/
void
change_slc(func, flag, val)
int func, flag;
cc_t val;
change_slc(int func, int flag, cc_t val)
{
int hislevel, mylevel;
@ -398,9 +390,9 @@ cc_t oldeofc = '\004';
* and flags up to the defaults.
*/
void
check_slc()
check_slc(void)
{
register int i;
int i;
for (i = 1; i <= NSLC; i++) {
#if VEOF == VMIN
@ -441,13 +433,11 @@ check_slc()
* ptr points to the beginning of the buffer, len is the length.
*/
void
do_opt_slc(ptr, len)
register unsigned char *ptr;
register int len;
do_opt_slc(unsigned char *ptr, int len)
{
register unsigned char func, flag;
unsigned char func, flag;
cc_t val;
register unsigned char *end = ptr + len;
unsigned char *end = ptr + len;
if (terminit()) { /* go ahead */
while (ptr < end) {
@ -482,7 +472,7 @@ do_opt_slc(ptr, len)
* Do slc stuff that was deferred.
*/
void
deferslc()
deferslc(void)
{
if (def_slcbuf) {
start_slc(1);

View File

@ -1,4 +1,4 @@
/* $NetBSD: state.c,v 1.24 2003/08/07 09:46:51 agc Exp $ */
/* $NetBSD: state.c,v 1.25 2005/02/06 05:58:21 perry Exp $ */
/*
* Copyright (c) 1989, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)state.c 8.5 (Berkeley) 5/30/95";
#else
__RCSID("$NetBSD: state.c,v 1.24 2003/08/07 09:46:51 agc Exp $");
__RCSID("$NetBSD: state.c,v 1.25 2005/02/06 05:58:21 perry Exp $");
#endif
#endif /* not lint */
@ -42,7 +42,7 @@ __RCSID("$NetBSD: state.c,v 1.24 2003/08/07 09:46:51 agc Exp $");
#include "telnetd.h"
static int envvarok __P((char *));
static int envvarok(char *);
unsigned const char doopt[] = { IAC, DO, '%', 'c', 0 };
unsigned const char dont[] = { IAC, DONT, '%', 'c', 0 };
@ -86,9 +86,9 @@ unsigned char *subsave;
#define TS_DONT 8 /* dont " */
void
telrcv()
telrcv(void)
{
register int c;
int c;
static int state = TS_DATA;
while (ncc > 0) {
@ -419,8 +419,7 @@ gotiac: switch (c) {
*
*/
void
send_do(option, init)
int option, init;
send_do(int option, int init)
{
if (init) {
if ((do_dont_resp[option] == 0 && his_state_is_will(option)) ||
@ -443,23 +442,22 @@ send_do(option, init)
}
#ifdef LINEMODE
extern void doclientstat __P((void));
extern void doclientstat(void);
#endif
#if 0
#ifdef AUTHENTICATION
extern void auth_request __P((void)); /* libtelnet */
extern void auth_request(void); /* libtelnet */
#endif
#ifdef ENCRYPTION
extern void encrypt_send_support __P((void));
extern void encrypt_send_support(void);
#endif /* ENCRYPTION */
#endif
void
willoption(option)
int option;
willoption(int option)
{
int changeok = 0;
void (*func) __P((void)) = 0;
void (*func)(void) = 0;
/*
* process input from peer.
@ -649,8 +647,7 @@ willoption(option)
} /* end of willoption */
void
send_dont(option, init)
int option, init;
send_dont(int option, int init)
{
if (init) {
if ((do_dont_resp[option] == 0 && his_state_is_wont(option)) ||
@ -665,8 +662,7 @@ send_dont(option, init)
}
void
wontoption(option)
int option;
wontoption(int option)
{
/*
* Process client input.
@ -799,8 +795,7 @@ wontoption(option)
} /* end of wontoption */
void
send_will(option, init)
int option, init;
send_will(int option, int init)
{
if (init) {
if ((will_wont_resp[option] == 0 && my_state_is_will(option))||
@ -826,8 +821,7 @@ int turn_on_sga = 0;
#endif
void
dooption(option)
int option;
dooption(int option)
{
int changeok = 0;
@ -955,8 +949,7 @@ dooption(option)
} /* end of dooption */
void
send_wont(option, init)
int option, init;
send_wont(int option, int init)
{
if (init) {
if ((will_wont_resp[option] == 0 && my_state_is_wont(option)) ||
@ -971,8 +964,7 @@ send_wont(option, init)
}
void
dontoption(option)
int option;
dontoption(int option)
{
/*
* Process client input.
@ -1066,8 +1058,7 @@ int env_ovalue = -1;
/* envvarok(char*) */
/* check that variable is safe to pass to login or shell */
static int
envvarok(varp)
char *varp;
envvarok(char *varp)
{
if (strcmp(varp, "TERMCAP") && /* to prevent a security hole */
@ -1116,16 +1107,16 @@ envvarok(varp)
* Terminal speed
*/
void
suboption()
suboption(void)
{
register int subchar;
int subchar;
DIAG(TD_OPTIONS, {netflush(); printsub('<', subpointer, SB_LEN()+2);});
subchar = SB_GET();
switch (subchar) {
case TELOPT_TSPEED: {
register int xspeed, rspeed;
int xspeed, rspeed;
if (his_state_is_wont(TELOPT_TSPEED)) /* Ignore if option disabled */
break;
@ -1163,7 +1154,7 @@ suboption()
while ((terminaltype < (terminalname + sizeof terminalname-1)) &&
!SB_EOF()) {
register int c;
int c;
c = SB_GET();
if (isupper(c)) {
@ -1177,7 +1168,7 @@ suboption()
} /* end of case TELOPT_TTYPE */
case TELOPT_NAWS: {
register int xwinsize, ywinsize;
int xwinsize, ywinsize;
if (his_state_is_wont(TELOPT_NAWS)) /* Ignore if option disabled */
break;
@ -1202,7 +1193,7 @@ suboption()
#ifdef LINEMODE
case TELOPT_LINEMODE: {
register int request;
int request;
if (his_state_is_wont(TELOPT_LINEMODE)) /* Ignore if option disabled */
break;
@ -1280,8 +1271,8 @@ suboption()
case TELOPT_NEW_ENVIRON:
case TELOPT_OLD_ENVIRON: {
register int c;
register char *cp, *varp, *valp;
int c;
char *cp, *varp, *valp;
if (SB_EOF())
return;
@ -1310,7 +1301,7 @@ suboption()
* reversed.
*/
if (env_ovar < 0) {
register int last = -1; /* invalid value */
int last = -1; /* invalid value */
int empty = 0;
int got_var = 0, got_value = 0, got_uservar = 0;
@ -1537,14 +1528,14 @@ suboption()
#ifdef LINEMODE
void
doclientstat()
doclientstat(void)
{
clientstat(TELOPT_LINEMODE, WILL, 0);
}
#endif /* LINEMODE */
void
send_status()
send_status(void)
{
#define ADD(c) \
do { \
@ -1560,8 +1551,8 @@ send_status()
unsigned char statusbuf[256];
unsigned char *ep;
register unsigned char *ncp;
register unsigned char i;
unsigned char *ncp;
unsigned char i;
ncp = statusbuf;
ep = statusbuf + sizeof(statusbuf);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys_term.c,v 1.41 2004/11/14 18:07:56 christos Exp $ */
/* $NetBSD: sys_term.c,v 1.42 2005/02/06 05:58:21 perry Exp $ */
/*
* Copyright (c) 1989, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95";
#else
__RCSID("$NetBSD: sys_term.c,v 1.41 2004/11/14 18:07:56 christos Exp $");
__RCSID("$NetBSD: sys_term.c,v 1.42 2005/02/06 05:58:21 perry Exp $");
#endif
#endif /* not lint */
@ -54,14 +54,14 @@ struct utmp wtmp;
struct termios termbuf, termbuf2; /* pty control structure */
void getptyslave __P((void));
int cleanopen __P((char *));
char **addarg __P((char **, char *));
void scrub_env __P((void));
int getent __P((char *, char *));
char *getstr __P((const char *, char **));
void getptyslave(void);
int cleanopen(char *);
char **addarg(char **, char *);
void scrub_env(void);
int getent(char *, char *);
char *getstr(const char *, char **);
#ifdef KRB5
extern void kerberos5_cleanup __P((void));
extern void kerberos5_cleanup(void);
#endif
/*
@ -76,7 +76,7 @@ extern void kerberos5_cleanup __P((void));
*/
void
init_termbuf()
init_termbuf(void)
{
(void) tcgetattr(pty, &termbuf);
termbuf2 = termbuf;
@ -84,9 +84,7 @@ init_termbuf()
#if defined(LINEMODE) && defined(TIOCPKT_IOCTL)
void
copy_termbuf(cp, len)
char *cp;
int len;
copy_termbuf(char *cp, int len)
{
if (len > sizeof(termbuf))
len = sizeof(termbuf);
@ -96,7 +94,7 @@ copy_termbuf(cp, len)
#endif /* defined(LINEMODE) && defined(TIOCPKT_IOCTL) */
void
set_termbuf()
set_termbuf(void)
{
/*
* Only make the necessary changes.
@ -119,10 +117,7 @@ set_termbuf()
int
spcset(func, valp, valpp)
int func;
cc_t *valp;
cc_t **valpp;
spcset(int func, cc_t *valp, cc_t **valpp)
{
#define setval(a, b) *valp = termbuf.c_cc[a]; \
@ -194,8 +189,7 @@ char *line = Xline;
static int ptyslavefd; /* for cleanopen() */
int
getpty(ptynum)
int *ptynum;
getpty(int *ptynum)
{
int ptyfd;
@ -230,14 +224,13 @@ int *ptynum;
int
tty_linemode()
tty_linemode(void)
{
return(termbuf.c_lflag & EXTPROC);
}
void
tty_setlinemode(on)
int on;
tty_setlinemode(int on)
{
set_termbuf();
(void) ioctl(pty, TIOCEXT, (char *)&on);
@ -246,26 +239,25 @@ tty_setlinemode(on)
#endif /* LINEMODE */
int
tty_isecho()
tty_isecho(void)
{
return (termbuf.c_lflag & ECHO);
}
int
tty_flowmode()
tty_flowmode(void)
{
return((termbuf.c_iflag & IXON) ? 1 : 0);
}
int
tty_restartany()
tty_restartany(void)
{
return((termbuf.c_iflag & IXANY) ? 1 : 0);
}
void
tty_setecho(on)
int on;
tty_setecho(int on)
{
if (on)
termbuf.c_lflag |= ECHO;
@ -274,14 +266,13 @@ tty_setecho(on)
}
int
tty_israw()
tty_israw(void)
{
return(!(termbuf.c_lflag & ICANON));
}
void
tty_binaryin(on)
int on;
tty_binaryin(int on)
{
if (on) {
termbuf.c_iflag &= ~ISTRIP;
@ -291,8 +282,7 @@ tty_binaryin(on)
}
void
tty_binaryout(on)
int on;
tty_binaryout(int on)
{
if (on) {
termbuf.c_cflag &= ~(CSIZE|PARENB);
@ -306,33 +296,32 @@ tty_binaryout(on)
}
int
tty_isbinaryin()
tty_isbinaryin(void)
{
return(!(termbuf.c_iflag & ISTRIP));
}
int
tty_isbinaryout()
tty_isbinaryout(void)
{
return(!(termbuf.c_oflag&OPOST));
}
#ifdef LINEMODE
int
tty_isediting()
tty_isediting(void)
{
return(termbuf.c_lflag & ICANON);
}
int
tty_istrapsig()
tty_istrapsig(void)
{
return(termbuf.c_lflag & ISIG);
}
void
tty_setedit(on)
int on;
tty_setedit(int on)
{
if (on)
termbuf.c_lflag |= ICANON;
@ -341,8 +330,7 @@ tty_setedit(on)
}
void
tty_setsig(on)
int on;
tty_setsig(int on)
{
if (on)
termbuf.c_lflag |= ISIG;
@ -352,7 +340,7 @@ tty_setsig(on)
#endif /* LINEMODE */
int
tty_issofttab()
tty_issofttab(void)
{
# ifdef OXTABS
return (termbuf.c_oflag & OXTABS);
@ -363,8 +351,7 @@ tty_issofttab()
}
void
tty_setsofttab(on)
int on;
tty_setsofttab(int on)
{
if (on) {
# ifdef OXTABS
@ -386,7 +373,7 @@ tty_setsofttab(on)
}
int
tty_islitecho()
tty_islitecho(void)
{
# ifdef ECHOCTL
return (!(termbuf.c_lflag & ECHOCTL));
@ -400,8 +387,7 @@ tty_islitecho()
}
void
tty_setlitecho(on)
int on;
tty_setlitecho(int on)
{
# ifdef ECHOCTL
if (on)
@ -418,21 +404,19 @@ tty_setlitecho(on)
}
int
tty_iscrnl()
tty_iscrnl(void)
{
return (termbuf.c_iflag & ICRNL);
}
void
tty_tspeed(val)
int val;
tty_tspeed(int val)
{
cfsetospeed(&termbuf, val);
}
void
tty_rspeed(val)
int val;
tty_rspeed(int val)
{
cfsetispeed(&termbuf, val);
}
@ -450,10 +434,10 @@ tty_rspeed(val)
extern int def_tspeed, def_rspeed;
extern int def_row, def_col;
void
getptyslave()
void
getptyslave(void)
{
register int t = -1;
int t = -1;
#ifdef LINEMODE
int waslm;
@ -534,8 +518,7 @@ getptyslave()
* making sure that we have a clean tty.
*/
int
cleanopen(ttyline)
char *ttyline;
cleanopen(char *ttyline)
{
return ptyslavefd;
}
@ -549,12 +532,9 @@ cleanopen(ttyline)
/* ARGSUSED */
void
startslave(host, autologin, autoname)
char *host;
int autologin;
char *autoname;
startslave(char *host, int autologin, char *autoname)
{
register int i;
int i;
#ifdef AUTHENTICATION
if (!autoname || !autoname[0])
@ -580,7 +560,7 @@ startslave(host, autologin, autoname)
char *envinit[3];
void
init_env()
init_env(void)
{
char **envp;
@ -601,12 +581,9 @@ init_env()
extern char *gettyname;
void
start_login(host, autologin, name)
char *host;
int autologin;
char *name;
start_login(char *host, int autologin, char *name)
{
register char **argv;
char **argv;
#define TABBUFSIZ 512
char defent[TABBUFSIZ];
char defstrs[TABBUFSIZ];
@ -701,12 +678,10 @@ start_login(host, autologin, name)
/*NOTREACHED*/
}
char **
addarg(argv, val)
register char **argv;
register char *val;
char **
addarg(char **argv, char *val)
{
register char **cpp;
char **cpp;
char **nargv;
if (argv == NULL) {
@ -746,7 +721,7 @@ addarg(argv, val)
*/
void
scrub_env()
scrub_env(void)
{
static const char *reject[] = {
"TERMCAP=/",
@ -796,8 +771,7 @@ scrub_env()
*/
/* ARGSUSED */
void
cleanup(sig)
int sig;
cleanup(int sig)
{
char *p, c;

View File

@ -1,4 +1,4 @@
/* $NetBSD: telnetd.c,v 1.45 2004/11/30 04:13:43 christos Exp $ */
/* $NetBSD: telnetd.c,v 1.46 2005/02/06 05:58:21 perry Exp $ */
/*
* Copyright (C) 1997 and 1998 WIDE Project.
@ -65,7 +65,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0
static char sccsid[] = "@(#)telnetd.c 8.4 (Berkeley) 5/30/95";
#else
__RCSID("$NetBSD: telnetd.c,v 1.45 2004/11/30 04:13:43 christos Exp $");
__RCSID("$NetBSD: telnetd.c,v 1.46 2005/02/06 05:58:21 perry Exp $");
#endif
#endif /* not lint */
@ -121,14 +121,14 @@ int keepalive = 1;
char *gettyname = "default";
char *progname;
int main __P((int, char *[]));
void usage __P((void));
int getterminaltype __P((char *, size_t));
int getent __P((char *, char *));
void doit __P((struct sockaddr *));
void _gettermname __P((void));
int terminaltypeok __P((char *));
char *getstr __P((const char *, char **));
int main(int, char *[]);
void usage(void);
int getterminaltype(char *, size_t);
int getent(char *, char *);
void doit(struct sockaddr *);
void _gettermname(void);
int terminaltypeok(char *);
char *getstr(const char *, char **);
/*
* The string to pass to getopt(). We do it this way so
@ -163,12 +163,10 @@ int family = AF_INET;
struct sockaddr_storage from;
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
int on = 1, fromlen;
register int ch;
int ch;
#if defined(IPPROTO_IP) && defined(IP_TOS)
int tos = -1;
#endif
@ -444,7 +442,7 @@ main(argc, argv)
} /* end of main */
void
usage()
usage(void)
{
fprintf(stderr, "Usage: telnetd");
#ifdef AUTHENTICATION
@ -488,9 +486,7 @@ static unsigned char ttytype_sbbuf[] = {
};
int
getterminaltype(name, l)
char *name;
size_t l;
getterminaltype(char *name, size_t l)
{
int retval = -1;
@ -631,7 +627,7 @@ getterminaltype(name, l)
} /* end of getterminaltype */
void
_gettermname()
_gettermname(void)
{
/*
* If the client turned off the option,
@ -649,8 +645,7 @@ _gettermname()
}
int
terminaltypeok(s)
char *s;
terminaltypeok(char *s)
{
char buf[1024];
@ -673,14 +668,13 @@ char *hostname;
char host_name[MAXHOSTNAMELEN + 1];
char remote_host_name[MAXHOSTNAMELEN + 1];
extern void telnet __P((int, int));
extern void telnet(int, int);
/*
* Get a pty, scan input lines.
*/
void
doit(who)
struct sockaddr *who;
doit(struct sockaddr *who)
{
char *host;
int error;
@ -744,8 +738,7 @@ doit(who)
* hand data to telnet receiver finite state machine.
*/
void
telnet(f, p)
int f, p;
telnet(int f, int p)
{
int on = 1;
#define TABBUFSIZ 512
@ -889,7 +882,7 @@ telnet(f, p)
{
register int t;
int t;
t = open(_PATH_TTY, O_RDWR);
if (t >= 0) {
(void) ioctl(t, TIOCNOTTY, (char *)0);
@ -927,7 +920,7 @@ telnet(f, p)
if (IF) {
char buf[_POSIX2_LINE_MAX];
FILE *fd;
if ((fd = fopen(IF, "r")) != NULL) {
while (fgets(buf, sizeof(buf) - 1, fd) != NULL)
ptyibuf2ptr = putf(buf, ptyibuf2ptr);
@ -957,7 +950,7 @@ telnet(f, p)
set[0].fd = f;
set[1].fd = p;
for (;;) {
register int c;
int c;
if (ncc < 0 && pcc < 0)
break;
@ -1109,7 +1102,7 @@ telnet(f, p)
* otherwise, write intr char.
*/
void
interrupt()
interrupt(void)
{
ptyflush(); /* half-hearted */
@ -1122,14 +1115,14 @@ interrupt()
* otherwise, write quit char.
*/
void
sendbrk()
sendbrk(void)
{
ptyflush(); /* half-hearted */
(void) ioctl(pty, TIOCSIG, (char *)SIGQUIT);
}
void
sendsusp()
sendsusp(void)
{
ptyflush(); /* half-hearted */
(void) ioctl(pty, TIOCSIG, (char *)SIGTSTP);
@ -1140,7 +1133,7 @@ sendsusp()
* just send back "[Yes]".
*/
void
recv_ayt()
recv_ayt(void)
{
if (slctab[SLC_AYT].sptr && *slctab[SLC_AYT].sptr != _POSIX_VDISABLE) {
(void) ioctl(pty, TIOCSIG, (char *)SIGINFO);
@ -1150,7 +1143,7 @@ recv_ayt()
}
void
doeof()
doeof(void)
{
init_termbuf();

View File

@ -1,4 +1,4 @@
/* $NetBSD: termstat.c,v 1.13 2003/08/07 09:46:52 agc Exp $ */
/* $NetBSD: termstat.c,v 1.14 2005/02/06 05:58:21 perry Exp $ */
/*
* Copyright (c) 1989, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)termstat.c 8.2 (Berkeley) 5/30/95";
#else
__RCSID("$NetBSD: termstat.c,v 1.13 2003/08/07 09:46:52 agc Exp $");
__RCSID("$NetBSD: termstat.c,v 1.14 2005/02/06 05:58:21 perry Exp $");
#endif
#endif /* not lint */
@ -132,7 +132,7 @@ static int _terminit = 0;
* is on.
*/
void
localstat()
localstat(void)
{
int need_will_echo = 0;
@ -348,7 +348,7 @@ done:
* Check for changes to flow control
*/
void
flowstat()
flowstat(void)
{
if (his_state_is_will(TELOPT_LFLOW)) {
if (tty_flowmode() != flowmode) {
@ -378,8 +378,7 @@ flowstat()
* affected.
*/
void
clientstat(code, parm1, parm2)
register int code, parm1, parm2;
clientstat(int code, int parm1, int parm2)
{
/*
@ -454,7 +453,7 @@ clientstat(code, parm1, parm2)
case LM_MODE:
{
register int ack, changed;
int ack, changed;
/*
* Client has sent along a mode mask. If it agrees with
@ -580,7 +579,7 @@ clientstat(code, parm1, parm2)
* It calls other functions that do things that were deferred in each module.
*/
void
defer_terminit()
defer_terminit(void)
{
/*
@ -613,7 +612,7 @@ defer_terminit()
* Returns true if the pty state has been processed yet.
*/
int
terminit()
terminit(void)
{
return(_terminit);

View File

@ -1,4 +1,4 @@
/* $NetBSD: utility.c,v 1.25 2004/11/05 22:02:04 dsl Exp $ */
/* $NetBSD: utility.c,v 1.26 2005/02/06 05:58:21 perry Exp $ */
/*
* Copyright (c) 1989, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)utility.c 8.4 (Berkeley) 5/30/95";
#else
__RCSID("$NetBSD: utility.c,v 1.25 2004/11/05 22:02:04 dsl Exp $");
__RCSID("$NetBSD: utility.c,v 1.26 2005/02/06 05:58:21 perry Exp $");
#endif
#endif /* not lint */
@ -42,8 +42,8 @@ __RCSID("$NetBSD: utility.c,v 1.25 2004/11/05 22:02:04 dsl Exp $");
#define PRINTOPTIONS
#include "telnetd.h"
char *nextitem __P((char *));
void putstr __P((char *));
char *nextitem(char *);
void putstr(char *);
extern int not42;
@ -61,7 +61,7 @@ extern int not42;
*/
void
ttloop()
ttloop(void)
{
DIAG(TD_REPORT, {output_data("td: ttloop\r\n");});
@ -89,8 +89,7 @@ ttloop()
* Check a descriptor to see if out of band data exists on it.
*/
int
stilloob(s)
int s; /* socket number */
stilloob(int s /* socket number */)
{
struct pollfd set[1];
int value;
@ -112,7 +111,7 @@ stilloob(s)
}
void
ptyflush()
ptyflush(void)
{
int n;
@ -143,8 +142,7 @@ ptyflush()
* character.
*/
char *
nextitem(current)
char *current;
nextitem(char *current)
{
if ((*current&0xff) != IAC) {
return current+1;
@ -157,7 +155,7 @@ nextitem(current)
return current+3;
case SB: /* loop forever looking for the SE */
{
register char *look = current+2;
char *look = current+2;
for (;;) {
if ((*look++&0xff) == IAC) {
@ -190,9 +188,9 @@ nextitem(current)
* us in any case.
*/
void
netclear()
netclear(void)
{
register char *thisitem, *next;
char *thisitem, *next;
char *good;
#define wewant(p) ((nfrontp > p) && ((*p&0xff) == IAC) && \
((*(p+1)&0xff) != EC) && ((*(p+1)&0xff) != EL))
@ -243,7 +241,7 @@ netclear()
* handling requests for urgent data.
*/
void
netflush()
netflush(void)
{
int n;
@ -319,9 +317,7 @@ netflush()
* len - How many bytes to write
*/
void
writenet(ptr, len)
register unsigned char *ptr;
register int len;
writenet(unsigned char *ptr, int len)
{
/* flush buffer if no room for new data) */
if ((&netobuf[BUFSIZ] - nfrontp) < len) {
@ -339,9 +335,7 @@ writenet(ptr, len)
* miscellaneous functions doing a variety of little jobs follow ...
*/
void
fatal(f, msg)
int f;
const char *msg;
fatal(int f, const char *msg)
{
char buf[BUFSIZ];
@ -375,11 +369,9 @@ fatalperror(f, msg)
char editedhost[MAXHOSTNAMELEN];
void
edithost(pat, host)
register char *pat;
register char *host;
edithost(char *pat, char *host)
{
register char *res = editedhost;
char *res = editedhost;
if (!pat)
pat = "";
@ -417,8 +409,7 @@ edithost(pat, host)
static char *putlocation;
void
putstr(s)
register char *s;
putstr(char *s)
{
while (*s)
@ -426,8 +417,7 @@ putstr(s)
}
void
putchr(cc)
int cc;
putchr(int cc)
{
*putlocation++ = cc;
}
@ -440,9 +430,7 @@ static char fmtstr[] = { "%l:%M\
%p on %A, %d %B %Y" };
char *
putf(cp, where)
register char *cp;
char *where;
putf(char *cp, char *where)
{
char *slash;
time_t t;
@ -509,9 +497,7 @@ putf(cp, where)
* Print telnet options and commands in plain text, if possible.
*/
void
printoption(fmt, option)
register const char *fmt;
register int option;
printoption(const char *fmt, int option)
{
if (TELOPT_OK(option))
output_data("%s %s\r\n", fmt, TELOPT(option));
@ -523,12 +509,12 @@ printoption(fmt, option)
}
void
printsub(direction, pointer, length)
char direction; /* '<' or '>' */
unsigned char *pointer; /* where suboption data sits */
int length; /* length of suboption data */
printsub(
char direction, /* '<' or '>' */
unsigned char *pointer, /* where suboption data sits */
int length) /* length of suboption data */
{
register int i = 0; /* XXX gcc */
int i = 0;
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
char buf[512];
#endif
@ -540,7 +526,7 @@ printsub(direction, pointer, length)
output_data("td: %s suboption ",
direction == '<' ? "recv" : "send");
if (length >= 3) {
register int j;
int j;
i = pointer[length - 2];
j = pointer[length - 1];
@ -752,8 +738,8 @@ printsub(direction, pointer, length)
break;
case TELOPT_STATUS: {
register char *cp;
register int j, k;
char *cp;
int j, k;
output_data("STATUS");
@ -853,7 +839,7 @@ printsub(direction, pointer, length)
output_data("INFO ");
env_common:
{
register int noquote = 2;
int noquote = 2;
for (i = 2; i < length; i++ ) {
switch (pointer[i]) {
case NEW_ENV_VAR:
@ -1056,12 +1042,9 @@ printsub(direction, pointer, length)
* Dump a data buffer in hex and ascii to the output data stream.
*/
void
printdata(tag, ptr, cnt)
register char *tag;
register char *ptr;
register int cnt;
printdata(char *tag, char *ptr, int cnt)
{
register int i;
int i;
char xbuf[30];
while (cnt) {