Staticize usage(). Cosmetics.

This commit is contained in:
Philippe Charnier 1997-10-10 06:27:07 +00:00
parent 1dcc6ec750
commit 8b76e1d7a8
4 changed files with 29 additions and 18 deletions

View File

@ -32,7 +32,11 @@
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)pw_scan.c 8.3 (Berkeley) 4/2/94";
#endif
static const char rcsid[] =
"$Id$";
#endif /* not lint */
/*
@ -45,7 +49,6 @@ static char sccsid[] = "@(#)pw_scan.c 8.3 (Berkeley) 4/2/94";
#include <err.h>
#include <fcntl.h>
#include <pwd.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@ -133,7 +136,7 @@ pw_scan(bp, pw)
}
if(p[0]) pw->pw_fields |= _PWF_SHELL;
if (p = strsep(&bp, ":")) { /* too many */
if ((p = strsep(&bp, ":"))) { /* too many */
fmt: warnx("corrupted entry");
return (0);
}

View File

@ -32,7 +32,11 @@
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)pw_scan.c 8.3 (Berkeley) 4/2/94";
#endif
static const char rcsid[] =
"$Id$";
#endif /* not lint */
/*
@ -45,7 +49,6 @@ static char sccsid[] = "@(#)pw_scan.c 8.3 (Berkeley) 4/2/94";
#include <err.h>
#include <fcntl.h>
#include <pwd.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@ -133,7 +136,7 @@ pw_scan(bp, pw)
}
if(p[0]) pw->pw_fields |= _PWF_SHELL;
if (p = strsep(&bp, ":")) { /* too many */
if ((p = strsep(&bp, ":"))) { /* too many */
fmt: warnx("corrupted entry");
return (0);
}

View File

@ -50,12 +50,12 @@ creates
.Xr db 3
style secure and insecure databases for the specified file.
These databases are then installed into
.Dq Pa /etc/spwd.db
.Pa /etc/spwd.db
and
.Dq Pa /etc/pwd.db
.Pa /etc/pwd.db
respectively.
The file is installed into
.Dq Pa /etc/master.passwd .
.Pa /etc/master.passwd .
The file must be in the correct format (see
.Xr passwd 5 ) .
It is important to note that the format used in this system is
@ -68,10 +68,10 @@ Check if the password file is in the correct format. Do not
change, add, or remove any files.
.It Fl p
Create a Version 7 style password file and install it into
.Dq Pa /etc/passwd .
.Pa /etc/passwd .
.It Fl d Ar directory
Store databases into specified destination directory instead of
.Dq Pa /etc .
.Pa /etc .
.It Fl u Ar username
Only update the record for the specified user. Utilities that
operate on a single user can use this option to avoid the
@ -103,17 +103,17 @@ A Version 7 format password file.
.El
.Sh BUGS
Because of the necessity for atomic update of the password files,
.Nm pwd_mkdb
.Nm
uses
.Xr rename 2
to install them.
This, however, requires that the file specified on the command line live
on the same file system as the
.Dq Pa /etc
.Pa /etc
directory.
.Pp
There are the obvious races with multiple people running
.Nm pwd_mkdb
.Nm
on different password files at the same time.
The front-ends to
.Nm pwd_mkdb ,

View File

@ -32,13 +32,17 @@
*/
#ifndef lint
static char copyright[] =
static const char copyright[] =
"@(#) Copyright (c) 1991, 1993, 1994\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)pwd_mkdb.c 8.5 (Berkeley) 4/20/94";
#endif
static const char rcsid[] =
"$Id$";
#endif /* not lint */
#include <sys/param.h>
@ -85,7 +89,7 @@ void error __P((char *));
void cp __P((char *, char *, mode_t mode));
void mv __P((char *, char *));
int scan __P((FILE *, struct passwd *));
void usage __P((void));
static void usage __P((void));
int
main(argc, argv)
@ -278,7 +282,7 @@ main(argc, argv)
if (!Cflag &&
(pwd.pw_name[0] == '+' || pwd.pw_name[0] == '-'))
yp_enabled = 1;
#define COMPACT(e) t = e; while (*p++ = *t++);
#define COMPACT(e) t = e; while ((*p++ = *t++));
if (!Cflag &&
(!username || (strcmp(username, pwd.pw_name) == 0))) {
/* Create insecure data. */
@ -538,7 +542,7 @@ error(name)
char *name;
{
warn(name);
warn("%s", name);
cleanup();
exit(1);
}
@ -563,10 +567,11 @@ cleanup()
}
}
void
static void
usage()
{
(void)fprintf(stderr, "usage: pwd_mkdb [-c] [-p] [-d <dest dir>] [-u <local username>] file\n");
(void)fprintf(stderr,
"usage: pwd_mkdb [-c] [-p] [-d <dest dir>] [-u <local username>] file\n");
exit(1);
}