o __P removal

o register removal
o use new style prototypes and function definitions
This commit is contained in:
Warner Losh 2002-02-07 23:57:01 +00:00
parent 2b8a08af6b
commit 266ebcd391
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90377
12 changed files with 145 additions and 218 deletions

View File

@ -88,7 +88,7 @@ static u_int8_t *BpfPkt = NULL;
** If an error is encountered, the program terminates here. ** If an error is encountered, the program terminates here.
*/ */
int int
BpfOpen() BpfOpen(void)
{ {
struct ifreq ifr; struct ifreq ifr;
char bpfdev[32]; char bpfdev[32];
@ -217,8 +217,7 @@ BpfOpen()
** None. ** None.
*/ */
char * char *
BpfGetIntfName(errmsg) BpfGetIntfName(char **errmsg)
char **errmsg;
{ {
struct ifreq ibuf[8], *ifrp, *ifend, *mp; struct ifreq ibuf[8], *ifrp, *ifend, *mp;
struct ifconf ifc; struct ifconf ifc;
@ -307,9 +306,7 @@ BpfGetIntfName(errmsg)
** None. ** None.
*/ */
int int
BpfRead(rconn, doread) BpfRead(RMPCONN *rconn, int doread)
RMPCONN *rconn;
int doread;
{ {
int datlen, caplen, hdrlen; int datlen, caplen, hdrlen;
static u_int8_t *bp = NULL, *ep = NULL; static u_int8_t *bp = NULL, *ep = NULL;
@ -373,8 +370,7 @@ BpfRead(rconn, doread)
** None. ** None.
*/ */
int int
BpfWrite(rconn) BpfWrite(RMPCONN *rconn)
RMPCONN *rconn;
{ {
if (write(BpfFd, (char *)&rconn->rmp, rconn->rmplen) < 0) { if (write(BpfFd, (char *)&rconn->rmp, rconn->rmplen) < 0) {
syslog(LOG_ERR, "write: %s: %m", EnetStr(rconn)); syslog(LOG_ERR, "write: %s: %m", EnetStr(rconn));
@ -397,7 +393,7 @@ BpfWrite(rconn)
** None. ** None.
*/ */
void void
BpfClose() BpfClose(void)
{ {
struct ifreq ifr; struct ifreq ifr;

View File

@ -151,36 +151,36 @@ extern RMPCONN *RmpConns; /* list of active connections */
extern u_int8_t RmpMcastAddr[]; /* RMP multicast address */ extern u_int8_t RmpMcastAddr[]; /* RMP multicast address */
void AddConn __P((RMPCONN *)); void AddConn(RMPCONN *);
int BootDone __P((RMPCONN *)); int BootDone(RMPCONN *);
void BpfClose __P((void)); void BpfClose(void);
char *BpfGetIntfName __P((char **)); char *BpfGetIntfName(char **);
int BpfOpen __P((void)); int BpfOpen(void);
int BpfRead __P((RMPCONN *, int)); int BpfRead(RMPCONN *, int);
int BpfWrite __P((RMPCONN *)); int BpfWrite(RMPCONN *);
void DebugOff __P((int)); void DebugOff(int);
void DebugOn __P((int)); void DebugOn(int);
void DispPkt __P((RMPCONN *, int)); void DispPkt(RMPCONN *, int);
void DoTimeout __P((void)); void DoTimeout(void);
void DspFlnm __P((u_int, char *)); void DspFlnm(u_int, char *);
void Exit __P((int)); void Exit(int);
CLIENT *FindClient __P((RMPCONN *)); CLIENT *FindClient(RMPCONN *);
RMPCONN *FindConn __P((RMPCONN *)); RMPCONN *FindConn(RMPCONN *);
void FreeClients __P((void)); void FreeClients(void);
void FreeConn __P((RMPCONN *)); void FreeConn(RMPCONN *);
void FreeConns __P((void)); void FreeConns(void);
int GetBootFiles __P((void)); int GetBootFiles(void);
char *GetEtherAddr __P((u_int8_t *)); char *GetEtherAddr(u_int8_t *);
CLIENT *NewClient __P((u_int8_t *)); CLIENT *NewClient(u_int8_t *);
RMPCONN *NewConn __P((RMPCONN *)); RMPCONN *NewConn(RMPCONN *);
char *NewStr __P((char *)); char *NewStr(char *);
u_int8_t *ParseAddr __P((char *)); u_int8_t *ParseAddr(char *);
int ParseConfig __P((void)); int ParseConfig(void);
void ProcessPacket __P((RMPCONN *, CLIENT *)); void ProcessPacket(RMPCONN *, CLIENT *);
void ReConfig __P((int)); void ReConfig(int);
void RemoveConn __P((RMPCONN *)); void RemoveConn(RMPCONN *);
int SendBootRepl __P((struct rmp_packet *, RMPCONN *, char *[])); int SendBootRepl(struct rmp_packet *, RMPCONN *, char *[]);
int SendFileNo __P((struct rmp_packet *, RMPCONN *, char *[])); int SendFileNo(struct rmp_packet *, RMPCONN *, char *[]);
int SendPacket __P((RMPCONN *)); int SendPacket(RMPCONN *);
int SendReadRepl __P((RMPCONN *)); int SendReadRepl(RMPCONN *);
int SendServerID __P((RMPCONN *)); int SendServerID(RMPCONN *);

View File

@ -83,7 +83,7 @@ static const char rcsid[] =
** to create a linked list of default boot files. ** to create a linked list of default boot files.
*/ */
int int
ParseConfig() ParseConfig(void)
{ {
FILE *fp; FILE *fp;
CLIENT *client; CLIENT *client;
@ -248,8 +248,7 @@ ParseConfig()
** be copied if it's to be saved. ** be copied if it's to be saved.
*/ */
u_int8_t * u_int8_t *
ParseAddr(str) ParseAddr(char *str)
char *str;
{ {
static u_int8_t addr[RMP_ADDRLEN]; static u_int8_t addr[RMP_ADDRLEN];
char *cp; char *cp;
@ -312,7 +311,7 @@ ParseAddr(str)
** called to re-order it's list of boot file pointers. ** called to re-order it's list of boot file pointers.
*/ */
int int
GetBootFiles() GetBootFiles(void)
{ {
DIR *dfd; DIR *dfd;
struct stat statb; struct stat statb;

View File

@ -72,12 +72,10 @@ static const char rcsid[] =
#include <unistd.h> #include <unistd.h>
#include "defs.h" #include "defs.h"
static void usage __P((void)); static void usage(void);
int int
main(argc, argv) main(int argc, char *argv[])
int argc;
char *argv[];
{ {
int c, fd, omask, maxfds; int c, fd, omask, maxfds;
fd_set rset; fd_set rset;
@ -289,7 +287,7 @@ main(argc, argv)
} }
static void static void
usage() usage(void)
{ {
fprintf(stderr, "usage: rbootd [-ad] [-i interface] [config_file]\n"); fprintf(stderr, "usage: rbootd [-ad] [-i interface] [config_file]\n");
exit (1); exit (1);
@ -308,7 +306,7 @@ usage()
** - Timed out connections in `RmpConns' will be freed. ** - Timed out connections in `RmpConns' will be freed.
*/ */
void void
DoTimeout() DoTimeout(void)
{ {
RMPCONN *rtmp; RMPCONN *rtmp;
struct timeval now; struct timeval now;
@ -345,8 +343,7 @@ DoTimeout()
*/ */
CLIENT * CLIENT *
FindClient(rconn) FindClient(RMPCONN *rconn)
RMPCONN *rconn;
{ {
CLIENT *ctmp; CLIENT *ctmp;
@ -371,8 +368,7 @@ FindClient(rconn)
** - This process ceases to exist. ** - This process ceases to exist.
*/ */
void void
Exit(sig) Exit(int sig)
int sig;
{ {
if (sig > 0) if (sig > 0)
syslog(LOG_ERR, "going down on signal %d", sig); syslog(LOG_ERR, "going down on signal %d", sig);
@ -400,8 +396,7 @@ Exit(sig)
** - This routine must be called with SIGHUP blocked. ** - This routine must be called with SIGHUP blocked.
*/ */
void void
ReConfig(signo) ReConfig(int signo)
int signo;
{ {
syslog(LOG_NOTICE, "reconfiguring boot server"); syslog(LOG_NOTICE, "reconfiguring boot server");
@ -427,8 +422,7 @@ ReConfig(signo)
** - Debug file is closed. ** - Debug file is closed.
*/ */
void void
DebugOff(signo) DebugOff(int signo)
int signo;
{ {
if (DbgFp != NULL) if (DbgFp != NULL)
(void) fclose(DbgFp); (void) fclose(DbgFp);
@ -450,8 +444,7 @@ DebugOff(signo)
** otherwise do nothing. ** otherwise do nothing.
*/ */
void void
DebugOn(signo) DebugOn(int signo)
int signo;
{ {
if (DbgFp == NULL) { if (DbgFp == NULL) {
if ((DbgFp = fopen(DbgFile, "w")) == NULL) if ((DbgFp = fopen(DbgFile, "w")) == NULL)

View File

@ -86,9 +86,7 @@ static const char rcsid[] =
** sent to the host that sent the packet. ** sent to the host that sent the packet.
*/ */
void void
ProcessPacket(rconn, client) ProcessPacket(RMPCONN *rconn, CLIENT *client)
RMPCONN *rconn;
CLIENT *client;
{ {
struct rmp_packet *rmp; struct rmp_packet *rmp;
RMPCONN *rconnout; RMPCONN *rconnout;
@ -176,8 +174,7 @@ ProcessPacket(rconn, client)
** none. ** none.
*/ */
int int
SendServerID(rconn) SendServerID(RMPCONN *rconn)
RMPCONN *rconn;
{ {
struct rmp_packet *rpl; struct rmp_packet *rpl;
char *src, *dst; char *src, *dst;
@ -228,10 +225,7 @@ SendServerID(rconn)
** none. ** none.
*/ */
int int
SendFileNo(req, rconn, filelist) SendFileNo(struct rmp_packet *req, RMPCONN *rconn, char *filelist[])
struct rmp_packet *req;
RMPCONN *rconn;
char *filelist[];
{ {
struct rmp_packet *rpl; struct rmp_packet *rpl;
char *src, *dst; char *src, *dst;
@ -291,10 +285,7 @@ SendFileNo(req, rconn, filelist)
** none. ** none.
*/ */
int int
SendBootRepl(req, rconn, filelist) SendBootRepl(struct rmp_packet *req, RMPCONN *rconn, char *filelist[])
struct rmp_packet *req;
RMPCONN *rconn;
char *filelist[];
{ {
int retval; int retval;
char *filename, filepath[RMPBOOTDATA+1]; char *filename, filepath[RMPBOOTDATA+1];
@ -400,8 +391,7 @@ SendBootRepl(req, rconn, filelist)
** none. ** none.
*/ */
int int
SendReadRepl(rconn) SendReadRepl(RMPCONN *rconn)
RMPCONN *rconn;
{ {
int retval = 0; int retval = 0;
RMPCONN *oldconn; RMPCONN *oldconn;
@ -518,8 +508,7 @@ SendReadRepl(rconn)
** none. ** none.
*/ */
int int
BootDone(rconn) BootDone(RMPCONN *rconn)
RMPCONN *rconn;
{ {
RMPCONN *oldconn; RMPCONN *oldconn;
struct rmp_packet *rpl; struct rmp_packet *rpl;
@ -566,8 +555,7 @@ BootDone(rconn)
** none. ** none.
*/ */
int int
SendPacket(rconn) SendPacket(RMPCONN *rconn)
RMPCONN *rconn;
{ {
/* /*
* Set Ethernet Destination address to Source (BPF and the enet * Set Ethernet Destination address to Source (BPF and the enet

View File

@ -79,9 +79,7 @@ static const char rcsid[] =
** None. ** None.
*/ */
void void
DispPkt(rconn, direct) DispPkt(RMPCONN *rconn, int direct)
RMPCONN *rconn;
int direct;
{ {
static const char BootFmt[] = "\t\tRetCode:%u SeqNo:%lx SessID:%x Vers:%u"; static const char BootFmt[] = "\t\tRetCode:%u SeqNo:%lx SessID:%x Vers:%u";
static const char ReadFmt[] = "\t\tRetCode:%u Offset:%lx SessID:%x\n"; static const char ReadFmt[] = "\t\tRetCode:%u Offset:%lx SessID:%x\n";
@ -208,8 +206,7 @@ DispPkt(rconn, direct)
** be copied if it's to be saved. ** be copied if it's to be saved.
*/ */
char * char *
GetEtherAddr(addr) GetEtherAddr(u_int8_t *addr)
u_int8_t *addr;
{ {
static char Hex[] = "0123456789abcdef"; static char Hex[] = "0123456789abcdef";
static char etherstr[RMP_ADDRLEN*3]; static char etherstr[RMP_ADDRLEN*3];
@ -249,9 +246,7 @@ GetEtherAddr(addr)
** - Characters are sent to `DbgFp'. ** - Characters are sent to `DbgFp'.
*/ */
void void
DspFlnm(size, flnm) DspFlnm(u_int size, char *flnm)
u_int size;
char *flnm;
{ {
int i; int i;
@ -276,8 +271,7 @@ DspFlnm(size, flnm)
** - If malloc() fails, a log message will be generated. ** - If malloc() fails, a log message will be generated.
*/ */
CLIENT * CLIENT *
NewClient(addr) NewClient(u_int8_t *addr)
u_int8_t *addr;
{ {
CLIENT *ctmp; CLIENT *ctmp;
@ -309,7 +303,7 @@ NewClient(addr)
** - This routine must be called with SIGHUP blocked. ** - This routine must be called with SIGHUP blocked.
*/ */
void void
FreeClients() FreeClients(void)
{ {
CLIENT *ctmp; CLIENT *ctmp;
@ -334,8 +328,7 @@ FreeClients()
** - If malloc() fails, a log message will be generated. ** - If malloc() fails, a log message will be generated.
*/ */
char * char *
NewStr(str) NewStr(char *str)
char *str;
{ {
char *stmp; char *stmp;
@ -369,8 +362,7 @@ static RMPCONN *LastFree = NULL;
** - If malloc() fails, a log message will be generated. ** - If malloc() fails, a log message will be generated.
*/ */
RMPCONN * RMPCONN *
NewConn(rconn) NewConn(RMPCONN *rconn)
RMPCONN *rconn;
{ {
RMPCONN *rtmp; RMPCONN *rtmp;
@ -410,8 +402,7 @@ NewConn(rconn)
** - File desc associated with `rtmp->bootfd' will be closed. ** - File desc associated with `rtmp->bootfd' will be closed.
*/ */
void void
FreeConn(rtmp) FreeConn(RMPCONN *rtmp)
RMPCONN *rtmp;
{ {
/* /*
* If the file descriptor is in use, close the file. * If the file descriptor is in use, close the file.
@ -445,7 +436,7 @@ FreeConn(rtmp)
** - This routine must be called with SIGHUP blocked. ** - This routine must be called with SIGHUP blocked.
*/ */
void void
FreeConns() FreeConns(void)
{ {
RMPCONN *rtmp; RMPCONN *rtmp;
@ -477,8 +468,7 @@ FreeConns()
** - This routine must be called with SIGHUP blocked. ** - This routine must be called with SIGHUP blocked.
*/ */
void void
AddConn(rconn) AddConn(RMPCONN *rconn)
RMPCONN *rconn;
{ {
if (RmpConns != NULL) if (RmpConns != NULL)
rconn->next = RmpConns; rconn->next = RmpConns;
@ -505,8 +495,7 @@ AddConn(rconn)
** - This routine must be called with SIGHUP blocked. ** - This routine must be called with SIGHUP blocked.
*/ */
RMPCONN * RMPCONN *
FindConn(rconn) FindConn(RMPCONN *rconn)
RMPCONN *rconn;
{ {
RMPCONN *rtmp; RMPCONN *rtmp;
@ -535,8 +524,7 @@ FindConn(rconn)
** - This routine must be called with SIGHUP blocked. ** - This routine must be called with SIGHUP blocked.
*/ */
void void
RemoveConn(rconn) RemoveConn(RMPCONN *rconn)
RMPCONN *rconn;
{ {
RMPCONN *thisrconn, *lastrconn; RMPCONN *thisrconn, *lastrconn;

View File

@ -51,13 +51,11 @@ static const char rcsid[] =
* OZ's original sdbm hash * OZ's original sdbm hash
*/ */
u_int32_t u_int32_t
hash(keyarg, len) hash(const void *keyarg, size_t len)
const void *keyarg;
register size_t len;
{ {
register const u_char *key; const u_char *key;
register size_t loop; size_t loop;
register u_int32_t h; u_int32_t h;
#define HASHC h = *key++ + 65599 * h #define HASHC h = *key++ + 65599 * h
@ -102,8 +100,8 @@ hash(keyarg, len)
* We mask off all but the lower 8 bits since our table array * We mask off all but the lower 8 bits since our table array
* can only hold 256 elements. * can only hold 256 elements.
*/ */
u_int32_t hashkey(key) u_int32_t
char *key; hashkey(char *key)
{ {
if (key == NULL) if (key == NULL)
@ -112,9 +110,8 @@ u_int32_t hashkey(key)
} }
/* Find an entry in the hash table (may be hanging off a linked list). */ /* Find an entry in the hash table (may be hanging off a linked list). */
char *lookup(table, key) char *
struct group_entry *table[]; lookup(struct group_entry *table[], char *key)
char *key;
{ {
struct group_entry *cur; struct group_entry *cur;
@ -146,9 +143,8 @@ char *lookup(table, key)
* *
* That's a lot of comment for such a small piece of code, isn't it. * That's a lot of comment for such a small piece of code, isn't it.
*/ */
void store (table, key, data) void
struct group_entry *table[]; store(struct group_entry *table[], char *key, char *data)
char *key, *data;
{ {
struct group_entry *new; struct group_entry *new;
u_int32_t i; u_int32_t i;
@ -176,9 +172,8 @@ void store (table, key, data)
* an entry in the table, then we just have to do one thing, which is * an entry in the table, then we just have to do one thing, which is
* to update its grouplist. * to update its grouplist.
*/ */
void mstore (table, key, data, domain) void
struct member_entry *table[]; mstore(struct member_entry *table[], char *key, char *data, char *domain)
char *key, *data, *domain;
{ {
struct member_entry *cur, *new; struct member_entry *cur, *new;
struct grouplist *tmp; struct grouplist *tmp;

View File

@ -59,9 +59,9 @@ struct group_entry {
#define LINSIZ 1024 * 10 #define LINSIZ 1024 * 10
extern void store __P(( struct group_entry ** , char *, char * )); extern void store(struct group_entry ** , char *, char *);
extern void mstore __P(( struct member_entry ** , char *, char *, char * )); extern void mstore(struct member_entry ** , char *, char *, char *);
extern char *lookup __P(( struct group_entry **, char * )); extern char *lookup(struct group_entry **, char *);
extern void __endnetgrent __P(( void )); extern void __endnetgrent(void);
extern void __setnetgrent __P(( char * )); extern void __setnetgrent(char *);
extern int __getnetgrent __P(( char **, char **, char ** )); extern int __getnetgrent(char **, char **, char **);

View File

@ -84,10 +84,8 @@ static struct {
(struct netgrp *)0, (struct netgrp *)0,
(char *)0, (char *)0,
}; };
static int parse_netgrp(); static int parse_netgrp(char *group);
static struct linelist *read_for_group(); static struct linelist *read_for_group(char *group);
void __setnetgrent(), __endnetgrent();
int __getnetgrent();
extern struct group_entry *gtable[]; extern struct group_entry *gtable[];
/* /*
@ -97,8 +95,7 @@ extern struct group_entry *gtable[];
* most of the work. * most of the work.
*/ */
void void
__setnetgrent(group) __setnetgrent(char *group)
char *group;
{ {
/* Sanity check */ /* Sanity check */
@ -123,8 +120,7 @@ __setnetgrent(group)
* Get the next netgroup off the list. * Get the next netgroup off the list.
*/ */
int int
__getnetgrent(hostp, userp, domp) __getnetgrent(char **hostp, char **userp, char **domp)
char **hostp, **userp, **domp;
{ {
if (nextgrp) { if (nextgrp) {
*hostp = nextgrp->ng_str[NG_HOST]; *hostp = nextgrp->ng_str[NG_HOST];
@ -140,10 +136,10 @@ __getnetgrent(hostp, userp, domp)
* __endnetgrent() - cleanup * __endnetgrent() - cleanup
*/ */
void void
__endnetgrent() __endnetgrent(void)
{ {
register struct linelist *lp, *olp; struct linelist *lp, *olp;
register struct netgrp *gp, *ogp; struct netgrp *gp, *ogp;
lp = linehead; lp = linehead;
while (lp) { while (lp) {
@ -177,13 +173,12 @@ __endnetgrent()
* Parse the netgroup file setting up the linked lists. * Parse the netgroup file setting up the linked lists.
*/ */
static int static int
parse_netgrp(group) parse_netgrp(char *group)
char *group;
{ {
register char *spos, *epos; char *spos, *epos;
register int len, strpos; int len, strpos;
#ifdef DEBUG #ifdef DEBUG
register int fields; int fields;
#endif #endif
char *pos, *gpos; char *pos, *gpos;
struct netgrp *grp; struct netgrp *grp;
@ -288,11 +283,10 @@ parse_netgrp(group)
* is found. Return 1 if eof is encountered. * is found. Return 1 if eof is encountered.
*/ */
static struct linelist * static struct linelist *
read_for_group(group) read_for_group(char *group)
char *group;
{ {
register char *pos, *spos, *linep = NULL, *olinep = NULL; char *pos, *spos, *linep = NULL, *olinep = NULL;
register int len, olen; int len, olen;
int cont; int cont;
struct linelist *lp; struct linelist *lp;
char line[LINSIZ + 1]; char line[LINSIZ + 1];

View File

@ -61,16 +61,14 @@ struct group_entry *gtable[TABLESIZE];
struct member_entry *mtable[TABLESIZE]; struct member_entry *mtable[TABLESIZE];
static void static void
usage() usage(void)
{ {
fprintf (stderr,"usage: revnetgroup -u|-h [-f netgroup file]\n"); fprintf (stderr,"usage: revnetgroup -u|-h [-f netgroup file]\n");
exit(1); exit(1);
} }
int int
main(argc, argv) main(int argc, char *argv[])
int argc;
char *argv[];
{ {
FILE *fp; FILE *fp;
char readbuf[LINSIZ]; char readbuf[LINSIZ];

View File

@ -60,6 +60,7 @@ static const char rcsid[] =
#include <paths.h> #include <paths.h>
#include <pwd.h> #include <pwd.h>
#include <signal.h> #include <signal.h>
#include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <syslog.h> #include <syslog.h>
@ -76,10 +77,9 @@ char remote[MAXHOSTNAMELEN];
struct sockaddr_in asin = { AF_INET }; struct sockaddr_in asin = { AF_INET };
void doit __P((int, struct sockaddr_in *)); void doit(int, struct sockaddr_in *);
void getstr __P((char *, int, char *)); void getstr(char *, int, char *);
/*VARARGS1*/ void error(const char *fmt, ...);
void error __P(());
int no_uid_0 = 1; int no_uid_0 = 1;
@ -99,9 +99,7 @@ usage(void)
*/ */
/*ARGSUSED*/ /*ARGSUSED*/
int int
main(argc, argv) main(int argc, char *argv[])
int argc;
char **argv;
{ {
struct sockaddr_in from; struct sockaddr_in from;
int fromlen; int fromlen;
@ -110,13 +108,13 @@ main(argc, argv)
openlog("rexecd", LOG_PID, LOG_AUTH); openlog("rexecd", LOG_PID, LOG_AUTH);
while ((ch = getopt(argc, argv, "i")) != -1) while ((ch = getopt(argc, argv, "i")) != -1)
switch (ch) { switch (ch) {
case 'i': case 'i':
no_uid_0 = 0; no_uid_0 = 0;
break; break;
default: default:
usage(); usage();
} }
argc -= optind; argc -= optind;
argv += optind; argv += optind;
@ -131,9 +129,7 @@ main(argc, argv)
} }
void void
doit(f, fromp) doit(int f, struct sockaddr_in *fromp)
int f;
struct sockaddr_in *fromp;
{ {
FILE *fp; FILE *fp;
char cmdbuf[NCARGS+1], *cp; char cmdbuf[NCARGS+1], *cp;
@ -304,24 +300,21 @@ doit(f, fromp)
err(1, "%s", pwd->pw_shell); err(1, "%s", pwd->pw_shell);
} }
/*VARARGS1*/
void void
error(fmt, a1, a2, a3) error(const char *fmt, ...)
char *fmt;
int a1, a2, a3;
{ {
char buf[BUFSIZ]; char buf[BUFSIZ];
va_list ap;
va_start(ap, fmt);
buf[0] = 1; buf[0] = 1;
(void) snprintf(buf+1, sizeof(buf) - 1, fmt, a1, a2, a3); (void)vsnprintf(buf + 1, sizeof(buf) - 1, fmt, ap);
(void) write(STDERR_FILENO, buf, strlen(buf)); (void)write(STDERR_FILENO, buf, strlen(buf));
va_end(ap);
} }
void void
getstr(buf, cnt, err) getstr(char *buf, int cnt, char *err)
char *buf;
int cnt;
char *err;
{ {
char c; char c;

View File

@ -116,22 +116,20 @@ union sockunion {
#define su_family su_si.si_family #define su_family su_si.si_family
#define su_port su_si.si_port #define su_port su_si.si_port
void doit __P((int, union sockunion *)); void doit(int, union sockunion *);
int control __P((int, char *, int)); int control(int, char *, int);
void protocol __P((int, int)); void protocol(int, int);
void cleanup __P((int)); void cleanup(int);
void fatal __P((int, char *, int)); void fatal(int, char *, int);
int do_rlogin __P((union sockunion *)); int do_rlogin(union sockunion *);
void getstr __P((char *, int, char *)); void getstr(char *, int, char *);
void setup_term __P((int)); void setup_term(int);
int do_krb_login __P((struct sockaddr_in *)); int do_krb_login(struct sockaddr_in *);
void usage __P((void)); void usage(void);
int int
main(argc, argv) main(int argc, char *argv[])
int argc;
char *argv[];
{ {
extern int __check_rhosts_file; extern int __check_rhosts_file;
union sockunion from; union sockunion from;
@ -199,9 +197,7 @@ struct winsize win = { 0, 0, 0, 0 };
void void
doit(f, fromp) doit(int f, union sockunion *fromp)
int f;
union sockunion *fromp;
{ {
int master, pid, on = 1; int master, pid, on = 1;
int authenticated = 0; int authenticated = 0;
@ -336,10 +332,7 @@ char oobdata[] = {TIOCPKT_WINDOW};
* window size changes. * window size changes.
*/ */
int int
control(pty, cp, n) control(int pty, char *cp, int n)
int pty;
char *cp;
int n;
{ {
struct winsize w; struct winsize w;
@ -359,8 +352,7 @@ control(pty, cp, n)
* rlogin "protocol" machine. * rlogin "protocol" machine.
*/ */
void void
protocol(f, p) protocol(int f, int p)
register int f, p;
{ {
char pibuf[1024+1], fibuf[1024], *pbp = NULL, *fbp = NULL; char pibuf[1024+1], fibuf[1024], *pbp = NULL, *fbp = NULL;
int pcc = 0, fcc = 0; int pcc = 0, fcc = 0;
@ -435,7 +427,7 @@ protocol(f, p)
if (fcc < 0 && errno == EWOULDBLOCK) if (fcc < 0 && errno == EWOULDBLOCK)
fcc = 0; fcc = 0;
else { else {
register char *cp; char *cp;
int left, n; int left, n;
if (fcc <= 0) if (fcc <= 0)
@ -516,8 +508,7 @@ protocol(f, p)
} }
void void
cleanup(signo) cleanup(int signo)
int signo;
{ {
char *p; char *p;
@ -536,10 +527,7 @@ cleanup(signo)
} }
void void
fatal(f, msg, syserr) fatal(int f, char *msg, int syserr)
int f;
char *msg;
int syserr;
{ {
int len; int len;
char buf[BUFSIZ], *bp = buf; char buf[BUFSIZ], *bp = buf;
@ -562,8 +550,7 @@ fatal(f, msg, syserr)
} }
int int
do_rlogin(dest) do_rlogin(union sockunion *dest)
union sockunion *dest;
{ {
getstr(rusername, sizeof(rusername), "remuser too long"); getstr(rusername, sizeof(rusername), "remuser too long");
@ -580,10 +567,7 @@ do_rlogin(dest)
} }
void void
getstr(buf, cnt, errmsg) getstr(char *buf, int cnt, char *errmsg)
char *buf;
int cnt;
char *errmsg;
{ {
char c; char c;
@ -599,10 +583,9 @@ getstr(buf, cnt, errmsg)
extern char **environ; extern char **environ;
void void
setup_term(fd) setup_term(int fd)
int fd;
{ {
register char *cp = index(term+ENVSIZE, '/'); char *cp = index(term+ENVSIZE, '/');
char *speed; char *speed;
struct termios tt; struct termios tt;
@ -640,7 +623,7 @@ setup_term(fd)
} }
void void
usage() usage(void)
{ {
syslog(LOG_ERR, "usage: rlogind [-" ARGSTR "]"); syslog(LOG_ERR, "usage: rlogind [-" ARGSTR "]");
} }