diff --git a/lib/libutil/pw_util.c b/lib/libutil/pw_util.c index ce9eba229afc..2c082e4286f8 100644 --- a/lib/libutil/pw_util.c +++ b/lib/libutil/pw_util.c @@ -66,12 +66,14 @@ static const char rcsid[] = extern char *tempname; static pid_t editpid = -1; static int lockfd; -char *mppath = _PATH_PWD; -char *masterpasswd = _PATH_MASTERPASSWD; +static char _default_editor[] = _PATH_VI; +char mppath[] = _PATH_PWD; +char masterpasswd[] = _PATH_MASTERPASSWD; + +void pw_cont(int); void -pw_cont(sig) - int sig; +pw_cont(int sig) { if (editpid != -1) @@ -79,7 +81,7 @@ pw_cont(sig) } void -pw_init() +pw_init(void) { struct rlimit rlim; @@ -109,7 +111,7 @@ pw_init() } int -pw_lock() +pw_lock(void) { /* * If the master password file doesn't exist, the system is hosed. @@ -142,7 +144,7 @@ pw_lock() } int -pw_tmp() +pw_tmp(void) { static char path[MAXPATHLEN]; int fd; @@ -163,8 +165,7 @@ pw_tmp() } int -pw_mkdb(username) -char *username; +pw_mkdb(const char *username) { int pstat; pid_t pid; @@ -190,14 +191,13 @@ char *username; } void -pw_edit(notsetuid) - int notsetuid; +pw_edit(int notsetuid) { int pstat; char *p, *editor; if (!(editor = getenv("EDITOR"))) - editor = _PATH_VI; + editor = _default_editor; if ((p = strrchr(editor, '/'))) ++p; else @@ -228,7 +228,7 @@ pw_edit(notsetuid) } void -pw_prompt() +pw_prompt(void) { int c, first; @@ -242,14 +242,12 @@ pw_prompt() } void -pw_error(name, err, eval) - char *name; - int err, eval; +pw_error(const char *name, int error, int eval) { #ifdef YP extern int _use_yp; #endif /* YP */ - if (err) { + if (error) { if (name != NULL) warn("%s", name); else diff --git a/usr.sbin/vipw/Makefile b/usr.sbin/vipw/Makefile index 8e3ba6af836b..ca9f2f5ce787 100644 --- a/usr.sbin/vipw/Makefile +++ b/usr.sbin/vipw/Makefile @@ -4,5 +4,6 @@ PROG= vipw MAN= vipw.8 SRCS= pw_util.c vipw.c +WARNS?= 4 .include diff --git a/usr.sbin/vipw/pw_util.c b/usr.sbin/vipw/pw_util.c index ce9eba229afc..2c082e4286f8 100644 --- a/usr.sbin/vipw/pw_util.c +++ b/usr.sbin/vipw/pw_util.c @@ -66,12 +66,14 @@ static const char rcsid[] = extern char *tempname; static pid_t editpid = -1; static int lockfd; -char *mppath = _PATH_PWD; -char *masterpasswd = _PATH_MASTERPASSWD; +static char _default_editor[] = _PATH_VI; +char mppath[] = _PATH_PWD; +char masterpasswd[] = _PATH_MASTERPASSWD; + +void pw_cont(int); void -pw_cont(sig) - int sig; +pw_cont(int sig) { if (editpid != -1) @@ -79,7 +81,7 @@ pw_cont(sig) } void -pw_init() +pw_init(void) { struct rlimit rlim; @@ -109,7 +111,7 @@ pw_init() } int -pw_lock() +pw_lock(void) { /* * If the master password file doesn't exist, the system is hosed. @@ -142,7 +144,7 @@ pw_lock() } int -pw_tmp() +pw_tmp(void) { static char path[MAXPATHLEN]; int fd; @@ -163,8 +165,7 @@ pw_tmp() } int -pw_mkdb(username) -char *username; +pw_mkdb(const char *username) { int pstat; pid_t pid; @@ -190,14 +191,13 @@ char *username; } void -pw_edit(notsetuid) - int notsetuid; +pw_edit(int notsetuid) { int pstat; char *p, *editor; if (!(editor = getenv("EDITOR"))) - editor = _PATH_VI; + editor = _default_editor; if ((p = strrchr(editor, '/'))) ++p; else @@ -228,7 +228,7 @@ pw_edit(notsetuid) } void -pw_prompt() +pw_prompt(void) { int c, first; @@ -242,14 +242,12 @@ pw_prompt() } void -pw_error(name, err, eval) - char *name; - int err, eval; +pw_error(const char *name, int error, int eval) { #ifdef YP extern int _use_yp; #endif /* YP */ - if (err) { + if (error) { if (name != NULL) warn("%s", name); else diff --git a/usr.sbin/vipw/pw_util.h b/usr.sbin/vipw/pw_util.h index c6aab8e6f465..1000a9abdc7f 100644 --- a/usr.sbin/vipw/pw_util.h +++ b/usr.sbin/vipw/pw_util.h @@ -31,12 +31,14 @@ * SUCH DAMAGE. * * @(#)pw_util.h 8.2 (Berkeley) 4/1/94 + * + * $FreeBSD$ */ -void pw_edit __P((int)); -void pw_error __P((char *, int, int)); -void pw_init __P((void)); -int pw_lock __P((void)); -int pw_mkdb __P((char *)); -void pw_prompt __P((void)); -int pw_tmp __P((void)); +void pw_edit(int); +void pw_error(const char *, int, int); +void pw_init(void); +int pw_lock(void); +int pw_mkdb(const char *); +void pw_prompt(void); +int pw_tmp(void); diff --git a/usr.sbin/vipw/vipw.c b/usr.sbin/vipw/vipw.c index 8986ab3bc1bd..6d84990ead1c 100644 --- a/usr.sbin/vipw/vipw.c +++ b/usr.sbin/vipw/vipw.c @@ -61,13 +61,11 @@ extern char *mppath; extern char *masterpasswd; char *tempname; -void copyfile __P((int, int)); -static void usage __P((void)); +static void copyfile(int, int); +static void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int pfd, tfd; struct stat begin, end; @@ -125,9 +123,8 @@ main(argc, argv) exit(0); } -void -copyfile(from, to) - int from, to; +static void +copyfile(int from, int to) { int nr, nw, off; char buf[8*1024]; @@ -141,7 +138,7 @@ copyfile(from, to) } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: vipw [ -d directory ]\n");