o __P removal

o remove register
o use strict prototypes
This commit is contained in:
Warner Losh 2002-02-06 16:38:40 +00:00
parent dc84ba3905
commit 95289b278a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90301
5 changed files with 116 additions and 160 deletions

View File

@ -61,17 +61,15 @@ int tocrc;
int intro;
int typeflag;
void doname __P((char *));
void dorefname __P((char *));
void getfrom __P((char *));
void split __P((char *, char *));
void trimln __P((char *));
static void usage __P((void));
void doname(char *);
void dorefname(char *);
void getfrom(char *);
void split(char *, char *);
void trimln(char *);
static void usage(void);
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
int ch;
@ -101,8 +99,7 @@ main(argc, argv)
}
void
getfrom(pathname)
char *pathname;
getfrom(char *pathname)
{
int i = 0;
char *name, *loc;
@ -246,8 +243,7 @@ newman:
}
void
trimln(cp)
register char *cp;
trimln(char *cp)
{
while (*cp)
@ -257,10 +253,9 @@ trimln(cp)
}
void
doname(name)
char *name;
doname(char *name)
{
register char *dp = name, *ep;
char *dp = name, *ep;
again:
while (*dp && *dp != '.')
@ -281,10 +276,9 @@ again:
}
void
split(line, name)
char *line, *name;
split(char *line, char *name)
{
register char *cp, *dp;
char *cp, *dp;
char *sp, *sep;
cp = strchr(line, '-');
@ -299,7 +293,7 @@ split(line, name)
for (sep = "", dp = line; dp && *dp; dp = cp, sep = "\n") {
cp = strchr(dp, ',');
if (cp) {
register char *tp;
char *tp;
for (tp = cp - 1; *tp == ' ' || *tp == '\t'; tp--)
;
@ -314,10 +308,9 @@ split(line, name)
}
void
dorefname(name)
char *name;
dorefname(char *name)
{
register char *dp = name, *ep;
char *dp = name, *ep;
again:
while (*dp && *dp != '.')
@ -336,7 +329,7 @@ again:
}
static void
usage()
usage(void)
{
(void)fprintf(stderr, "usage: getNAME [-itw] file ...\n");
exit(1);

View File

@ -68,15 +68,15 @@ static int chat_alarm = CHAT_DEFAULT_TIMEOUT; /* Default */
static volatile int alarmed = 0;
static void chat_alrm __P((int));
static int chat_unalarm __P((void));
static int getdigit __P((unsigned char **, int, int));
static char **read_chat __P((char **));
static char *cleanchr __P((char **, unsigned char));
static char *cleanstr __P((const unsigned char *, int));
static const char *result __P((int));
static int chat_expect __P((const char *));
static int chat_send __P((char const *));
static void chat_alrm(int);
static int chat_unalarm(void);
static int getdigit(unsigned char **, int, int);
static char **read_chat(char **);
static char *cleanchr(char **, unsigned char);
static char *cleanstr(const unsigned char *, int);
static const char *result(int);
static int chat_expect(const char *);
static int chat_send(char const *);
/*
@ -87,8 +87,7 @@ static int chat_send __P((char const *));
*/
static void
chat_alrm(signo)
int signo;
chat_alrm(int signo)
{
int on = 1;
@ -104,7 +103,7 @@ chat_alrm(signo)
*/
static int
chat_unalarm()
chat_unalarm(void)
{
int off = 0;
return ioctl(STDIN_FILENO, FIONBIO, &off);
@ -116,9 +115,7 @@ chat_unalarm()
*/
static int
getdigit(ptr, base, max)
unsigned char **ptr;
int base, max;
getdigit(unsigned char **ptr, int base, int max)
{
int i, val = 0;
char * q;
@ -145,8 +142,7 @@ getdigit(ptr, base, max)
*/
static char **
read_chat(chatstr)
char **chatstr;
read_chat(char **chatstr)
{
char *str = *chatstr;
char **res = NULL;
@ -252,9 +248,7 @@ read_chat(chatstr)
*/
static char *
cleanchr(buf, ch)
char **buf;
unsigned char ch;
cleanchr(char **buf, unsigned char ch)
{
int l;
static char tmpbuf[5];
@ -288,9 +282,7 @@ cleanchr(buf, ch)
*/
static char *
cleanstr(s, l)
const unsigned char *s;
int l;
cleanstr(const unsigned char *s, int l)
{
static unsigned char * tmp = NULL;
static int tmplen = 0;
@ -319,8 +311,7 @@ cleanstr(s, l)
*/
static const char *
result(r)
int r;
result(int r)
{
static const char * results[] = {
"OK", "MEMERROR", "IOERROR", "TIMEOUT"
@ -335,8 +326,7 @@ result(r)
*/
static int
chat_expect(str)
const char *str;
chat_expect(const char *str)
{
int len, r = 0;
@ -405,8 +395,7 @@ chat_expect(str)
*/
static int
chat_send(str)
char const *str;
chat_send(char const *str)
{
int r = 0;
@ -459,9 +448,7 @@ chat_send(str)
*/
int
getty_chat(scrstr, timeout, debug)
char *scrstr;
int timeout, debug;
getty_chat(char *scrstr, int timeout, int debug)
{
int r = -1;

View File

@ -47,17 +47,17 @@ extern struct gettyflags gettyflags[];
extern struct gettynums gettynums[];
extern struct gettystrs gettystrs[];
int adelay __P((int, struct delayval *));
const char *autobaud __P((void));
int delaybits __P((void));
void edithost __P((const char *));
void gendefaults __P((void));
void gettable __P((const char *, char *));
void makeenv __P((char *[]));
const char *portselector __P((void));
void set_ttydefaults __P((int));
void setchars __P((void));
void setdefaults __P((void));
void set_flags __P((int));
int speed __P((int));
int getty_chat __P((char *, int, int));
int adelay(int, struct delayval *);
const char *autobaud(void);
int delaybits(void);
void edithost(const char *);
void gendefaults(void);
void gettable(const char *, char *);
void makeenv(char *[]);
const char *portselector(void);
void set_ttydefaults(int);
void setchars(void);
void setdefaults(void);
void set_flags(int);
int speed(int);
int getty_chat(char *, int, int);

View File

@ -132,28 +132,25 @@ char partab[] = {
#define puts Gputs
static void dingdong __P((int));
static int getname __P((void));
static void interrupt __P((int));
static void oflush __P((void));
static void prompt __P((void));
static void putchr __P((int));
static void putf __P((const char *));
static void putpad __P((const char *));
static void puts __P((const char *));
static void timeoverrun __P((int));
static char *getline __P((int));
static void setttymode __P((const char *, int));
static void setdefttymode __P((const char *));
static int opentty __P((const char *, int));
int main __P((int, char **));
static void dingdong(int);
static int getname(void);
static void interrupt(int);
static void oflush(void);
static void prompt(void);
static void putchr(int);
static void putf(const char *);
static void putpad(const char *);
static void puts(const char *);
static void timeoverrun(int);
static char *getline(int);
static void setttymode(const char *, int);
static void setdefttymode(const char *);
static int opentty(const char *, int);
jmp_buf timeout;
static void
dingdong(signo)
int signo;
dingdong(int signo)
{
alarm(0);
longjmp(timeout, 1);
@ -162,8 +159,7 @@ dingdong(signo)
jmp_buf intrupt;
static void
interrupt(signo)
int signo;
interrupt(int signo)
{
longjmp(intrupt, 1);
}
@ -172,8 +168,7 @@ interrupt(signo)
* Action to take when getty is running too long.
*/
static void
timeoverrun(signo)
int signo;
timeoverrun(int signo)
{
syslog(LOG_ERR, "getty exiting due to excessive running time");
@ -181,9 +176,7 @@ timeoverrun(signo)
}
int
main(argc, argv)
int argc;
char **argv;
main(int argc, char *argv[])
{
extern char **environ;
const char *tname;
@ -377,7 +370,7 @@ main(argc, argv)
syslog(LOG_ERR, "%s: %m", PP);
exit(1);
} else if (rval || AL) {
register int i;
int i;
oflush();
alarm(0);
@ -461,8 +454,7 @@ opentty(const char *ttyn, int flags)
}
static void
setdefttymode(tname)
const char * tname;
setdefttymode(const char *tname)
{
if (tcgetattr(STDIN_FILENO, &tmode) < 0) {
syslog(LOG_ERR, "tcgetattr %s: %m", ttyn);
@ -477,9 +469,7 @@ setdefttymode(tname)
}
static void
setttymode(tname, raw)
const char * tname;
int raw;
setttymode(const char *tname, int raw)
{
int off = 0;
@ -511,10 +501,10 @@ setttymode(tname, raw)
static int
getname()
getname(void)
{
register int c;
register char *np;
int c;
char *np;
unsigned char cs;
int ppp_state = 0;
int ppp_connection = 0;
@ -622,10 +612,9 @@ getname()
}
static void
putpad(s)
register const char *s;
putpad(const char *s)
{
register pad = 0;
int pad = 0;
speed_t ospeed = cfgetospeed(&tmode);
if (isdigit(*s)) {
@ -660,8 +649,7 @@ putpad(s)
}
static void
puts(s)
register const char *s;
puts(const char *s)
{
while (*s)
putchr(*s++);
@ -671,8 +659,7 @@ char outbuf[OBUFSIZ];
int obufcnt = 0;
static void
putchr(cc)
int cc;
putchr(int cc)
{
char c;
@ -691,7 +678,7 @@ putchr(cc)
}
static void
oflush()
oflush(void)
{
if (obufcnt)
write(STDOUT_FILENO, outbuf, obufcnt);
@ -699,7 +686,7 @@ oflush()
}
static void
prompt()
prompt(void)
{
putf(LM);
@ -709,8 +696,7 @@ prompt()
static char *
getline(fd)
int fd;
getline(int fd)
{
int i = 0;
static char linebuf[512];
@ -734,8 +720,7 @@ getline(fd)
}
static void
putf(cp)
register const char *cp;
putf(const char *cp)
{
extern char editedhost[];
time_t t;

View File

@ -61,20 +61,18 @@ static const char rcsid[] =
#ifdef COMPAT_43
static void compatflags __P((long));
static void compatflags(long);
#endif
/*
* Get a table entry.
*/
void
gettable(name, buf)
const char *name;
char *buf;
gettable(const char *name, char *buf)
{
register struct gettystrs *sp;
register struct gettynums *np;
register struct gettyflags *fp;
struct gettystrs *sp;
struct gettynums *np;
struct gettyflags *fp;
long n;
int l;
char *p;
@ -184,11 +182,11 @@ gettable(name, buf)
}
void
gendefaults()
gendefaults(void)
{
register struct gettystrs *sp;
register struct gettynums *np;
register struct gettyflags *fp;
struct gettystrs *sp;
struct gettynums *np;
struct gettyflags *fp;
for (sp = gettystrs; sp->field; sp++)
if (sp->value)
@ -204,11 +202,11 @@ gendefaults()
}
void
setdefaults()
setdefaults(void)
{
register struct gettystrs *sp;
register struct gettynums *np;
register struct gettyflags *fp;
struct gettystrs *sp;
struct gettynums *np;
struct gettyflags *fp;
for (sp = gettystrs; sp->field; sp++)
if (!sp->value)
@ -238,10 +236,10 @@ charvars[] = {
};
void
setchars()
setchars(void)
{
register int i;
register const char *p;
int i;
const char *p;
for (i = 0; charnames[i]; i++) {
p = *charnames[i];
@ -258,10 +256,9 @@ setchars()
#define ISSET(t, f) ((t) & (f))
void
set_flags(n)
int n;
set_flags(int n)
{
register tcflag_t iflag, oflag, cflag, lflag;
tcflag_t iflag, oflag, cflag, lflag;
#ifdef COMPAT_43
switch (n) {
@ -445,10 +442,9 @@ out:
* Old TTY => termios, snatched from <sys/kern/tty_compat.c>
*/
void
compatflags(flags)
register long flags;
compatflags(long flags)
{
register tcflag_t iflag, oflag, cflag, lflag;
tcflag_t iflag, oflag, cflag, lflag;
iflag = BRKINT|ICRNL|IMAXBEL|IXON|IXANY;
oflag = OPOST|ONLCR|OXTABS;
@ -613,9 +609,9 @@ struct delayval tbdelay[] = {
};
int
delaybits()
delaybits(void)
{
register int f;
int f;
f = adelay(CD, crdelay);
f |= adelay(ND, nldelay);
@ -626,9 +622,7 @@ delaybits()
}
int
adelay(ms, dp)
register ms;
register struct delayval *dp;
adelay(int ms, struct delayval *dp)
{
if (ms == 0)
return (0);
@ -641,11 +635,10 @@ adelay(ms, dp)
char editedhost[MAXHOSTNAMELEN];
void
edithost(pat)
register const char *pat;
edithost(const char *pat)
{
register const char *host = HN;
register char *res = editedhost;
const char *host = HN;
char *res = editedhost;
if (!pat)
pat = "";
@ -709,10 +702,9 @@ static struct speedtab {
};
int
speed(val)
int val;
speed(int val)
{
register struct speedtab *sp;
struct speedtab *sp;
if (val <= B230400)
return (val);
@ -725,12 +717,11 @@ speed(val)
}
void
makeenv(env)
char *env[];
makeenv(char *env[])
{
static char termbuf[128] = "TERM=";
register char *p, *q;
register char **ep;
char *p, *q;
char **ep;
ep = env;
if (TT && *TT) {
@ -774,11 +765,11 @@ struct portselect {
};
const char *
portselector()
portselector(void)
{
char c, baud[20];
const char *type = "default";
register struct portselect *ps;
struct portselect *ps;
int len;
alarm(5*60);
@ -808,7 +799,7 @@ portselector()
* is garbled at the different speeds.
*/
const char *
autobaud()
autobaud(void)
{
int rfds;
struct timeval timeout;