Skip to content

Commit

Permalink
o Eliminate __P
Browse files Browse the repository at this point in the history
o Use new-style function definitions
o remove some !__STDC__ code
o eliminate register
  • Loading branch information
bsdimp committed Feb 3, 2002
1 parent 63d770d commit e4bc453
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 272 deletions.
6 changes: 3 additions & 3 deletions libexec/atrun/atrun.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static const char rcsid[] =
static debug = 0;

void perr(const char *a);
static void usage __P((void));
static void usage(void);

/* Local functions */
static int
Expand All @@ -98,7 +98,7 @@ write_string(int fd, const char* a)
#undef DEBUG_FORK
#ifdef DEBUG_FORK
static pid_t
myfork()
myfork(void)
{
pid_t res;
res = fork();
Expand Down Expand Up @@ -491,7 +491,7 @@ main(int argc, char *argv[])
}

static void
usage()
usage(void)
{
if (debug)
fprintf(stderr, "usage: atrun [-l load_avg] [-d]\n");
Expand Down
49 changes: 18 additions & 31 deletions libexec/comsat/comsat.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,17 @@ struct utmp *utmp = NULL;
time_t lastmsgtime;
int nutmp, uf;

void jkfprintf __P((FILE *, char[], char[], off_t));
void mailfor __P((char *));
void notify __P((struct utmp *, char[], off_t, int));
void onalrm __P((int));
void reapchildren __P((int));
void jkfprintf(FILE *, char[], char[], off_t);
void mailfor(char *);
void notify(struct utmp *, char[], off_t, int);
void onalrm(int);
void reapchildren(int);

int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
struct sockaddr_in from;
register int cc;
int cc;
int fromlen;
char msgbuf[256];

Expand Down Expand Up @@ -134,15 +132,13 @@ main(argc, argv)
}

void
reapchildren(signo)
int signo;
reapchildren(int signo)
{
while (wait3(NULL, WNOHANG, NULL) > 0);
}

void
onalrm(signo)
int signo;
onalrm(int signo)
{
static u_int utmpsize; /* last malloced size for utmp */
static u_int utmpmtime; /* last modification time for utmp */
Expand All @@ -167,11 +163,10 @@ onalrm(signo)
}

void
mailfor(name)
char *name;
mailfor(char *name)
{
register struct utmp *utp = &utmp[nutmp];
register char *cp;
struct utmp *utp = &utmp[nutmp];
char *cp;
char *file;
off_t offset;
int folder;
Expand Down Expand Up @@ -202,11 +197,7 @@ mailfor(name)
static char *cr;

void
notify(utp, file, offset, folder)
register struct utmp *utp;
char file[];
off_t offset;
int folder;
notify(struct utmp *utp, char file[], off_t offset, int folder)
{
FILE *tp;
struct stat stb;
Expand Down Expand Up @@ -247,16 +238,12 @@ notify(utp, file, offset, folder)
}

void
jkfprintf(tp, user, file, offset)
register FILE *tp;
char user[];
char file[];
off_t offset;
jkfprintf(FILE *tp, char user[], char file[], off_t offset)
{
register unsigned char *cp, ch;
register FILE *fi;
register int linecnt, charcnt, inheader;
register struct passwd *p;
unsigned char *cp, ch;
FILE *fi;
int linecnt, charcnt, inheader;
struct passwd *p;
unsigned char line[BUFSIZ];

/* Set effective uid to user in case mail drop is on nfs */
Expand Down
26 changes: 5 additions & 21 deletions libexec/fingerd/fingerd.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,14 @@ static const char rcsid[] =
#include <strings.h>
#include "pathnames.h"

void logerr __P((const char *, ...));
void logerr(const char *, ...);

int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
register FILE *fp;
register int ch;
register char *lp;
FILE *fp;
int ch;
char *lp;
struct sockaddr_storage ss;
int p[2], logging, secure, sval;
#define ENTRIES 50
Expand Down Expand Up @@ -199,27 +197,13 @@ main(argc, argv)
exit(0);
}

#if __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif

void
#if __STDC__
logerr(const char *fmt, ...)
#else
logerr(fmt, va_alist)
char *fmt;
va_dcl
#endif
{
va_list ap;
#if __STDC__
va_start(ap, fmt);
#else
va_start(ap);
#endif
(void)vsyslog(LOG_ERR, fmt, ap);
va_end(ap);
exit(1);
Expand Down
66 changes: 33 additions & 33 deletions libexec/ftpd/extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,41 +37,41 @@
#include <sys/types.h>
#include <sys/socket.h>

void blkfree __P((char **));
char **copyblk __P((char **));
void cwd __P((char *));
void delete __P((char *));
void dologout __P((int));
void fatalerror __P((char *));
void ftpd_logwtmp __P((char *, char *, struct sockaddr *addr));
int ftpd_pclose __P((FILE *));
FILE *ftpd_popen __P((char *, char *));
char *getline __P((char *, int, FILE *));
void lreply __P((int, const char *, ...));
void makedir __P((char *));
void nack __P((char *));
void pass __P((char *));
void passive __P((void));
void long_passive __P((char *, int));
void perror_reply __P((int, char *));
void pwd __P((void));
void removedir __P((char *));
void renamecmd __P((char *, char *));
char *renamefrom __P((char *));
void reply __P((int, const char *, ...));
void retrieve __P((char *, char *));
void send_file_list __P((char *));
void blkfree(char **);
char **copyblk(char **);
void cwd(char *);
void delete(char *);
void dologout(int);
void fatalerror(char *);
void ftpd_logwtmp(char *, char *, struct sockaddr *addr);
int ftpd_pclose(FILE *);
FILE *ftpd_popen(char *, char *);
char *getline(char *, int, FILE *);
void lreply(int, const char *, ...);
void makedir(char *);
void nack(char *);
void pass(char *);
void passive(void);
void long_passive(char *, int);
void perror_reply(int, char *);
void pwd(void);
void removedir(char *);
void renamecmd(char *, char *);
char *renamefrom(char *);
void reply(int, const char *, ...);
void retrieve(char *, char *);
void send_file_list(char *);
#ifdef OLD_SETPROCTITLE
void setproctitle __P((const char *, ...));
void setproctitle(const char *, ...);
#endif
void statcmd __P((void));
void statfilecmd __P((char *));
void store __P((char *, char *, int));
void upper __P((char *));
void user __P((char *));
void yyerror __P((char *));
int yyparse __P((void));
int ls_main __P((int, char **));
void statcmd(void);
void statfilecmd(char *);
void store(char *, char *, int);
void upper(char *);
void user(char *);
void yyerror(char *);
int yyparse(void);
int ls_main(int, char **);

struct sockaddr_in;
struct sockaddr_in6;
Expand Down
55 changes: 21 additions & 34 deletions libexec/ftpd/ftpcmd.y
Original file line number Diff line number Diff line change
Expand Up @@ -1133,21 +1133,19 @@ struct tab sitetab[] = {
{ NULL, 0, 0, 0, 0 }
};

static char *copy __P((char *));
static void help __P((struct tab *, char *));
static char *copy(char *);
static void help(struct tab *, char *);
static struct tab *
lookup __P((struct tab *, char *));
static int port_check __P((const char *));
static int port_check_v6 __P((const char *));
static void sizecmd __P((char *));
static void toolong __P((int));
static void v4map_data_dest __P((void));
static int yylex __P((void));
lookup(struct tab *, char *);
static int port_check(const char *);
static int port_check_v6(const char *);
static void sizecmd(char *);
static void toolong(int);
static void v4map_data_dest(void);
static int yylex(void);

static struct tab *
lookup(p, cmd)
struct tab *p;
char *cmd;
lookup(struct tab *p, char *cmd)
{

for (; p->name != NULL; p++)
Expand All @@ -1162,10 +1160,7 @@ lookup(p, cmd)
* getline - a hacked up version of fgets to ignore TELNET escape codes.
*/
char *
getline(s, n, iop)
char *s;
int n;
FILE *iop;
getline(char *s, int n, FILE *iop)
{
int c;
register char *cs;
Expand Down Expand Up @@ -1238,8 +1233,7 @@ getline(s, n, iop)
}

static void
toolong(signo)
int signo;
toolong(int signo)
{

reply(421,
Expand All @@ -1251,7 +1245,7 @@ toolong(signo)
}

static int
yylex()
yylex(void)
{
static int cpos;
char *cp, *cp2;
Expand Down Expand Up @@ -1471,8 +1465,7 @@ yylex()
}

void
upper(s)
char *s;
upper(char *s)
{
while (*s != '\0') {
if (islower(*s))
Expand All @@ -1482,8 +1475,7 @@ upper(s)
}

static char *
copy(s)
char *s;
copy(char *s)
{
char *p;

Expand All @@ -1495,9 +1487,7 @@ copy(s)
}

static void
help(ctab, s)
struct tab *ctab;
char *s;
help(struct tab *ctab, char *s)
{
struct tab *c;
int width, NCMDS;
Expand Down Expand Up @@ -1560,8 +1550,7 @@ help(ctab, s)
}

static void
sizecmd(filename)
char *filename;
sizecmd(char *filename)
{
switch (type) {
case TYPE_L:
Expand Down Expand Up @@ -1611,8 +1600,7 @@ sizecmd(filename)

/* Return 1, if port check is done. Return 0, if not yet. */
static int
port_check(pcmd)
const char *pcmd;
port_check(const char *pcmd)
{
if (his_addr.su_family == AF_INET) {
if (data_dest.su_family != AF_INET) {
Expand Down Expand Up @@ -1641,7 +1629,7 @@ port_check(pcmd)
}

static int
check_login1()
check_login1(void)
{
if (logged_in)
return 1;
Expand All @@ -1654,8 +1642,7 @@ check_login1()
#ifdef INET6
/* Return 1, if port check is done. Return 0, if not yet. */
static int
port_check_v6(pcmd)
const char *pcmd;
port_check_v6(const char *pcmd)
{
if (his_addr.su_family == AF_INET6) {
if (IN6_IS_ADDR_V4MAPPED(&his_addr.su_sin6.sin6_addr))
Expand Down Expand Up @@ -1687,7 +1674,7 @@ port_check_v6(pcmd)
}

static void
v4map_data_dest()
v4map_data_dest(void)
{
struct in_addr savedaddr;
int savedport;
Expand Down
Loading

0 comments on commit e4bc453

Please sign in to comment.