pwd_mkdb: Sort options and update usage message.

Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D39266
This commit is contained in:
Dag-Erling Smørgrav 2023-03-25 14:15:40 +00:00
parent 138a5dafba
commit 508aee9681
2 changed files with 24 additions and 24 deletions

View File

@ -28,7 +28,7 @@
.\" @(#)pwd_mkdb.8 8.1 (Berkeley) 6/6/93 .\" @(#)pwd_mkdb.8 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd October 20, 2018 .Dd March 25, 2023
.Dt PWD_MKDB 8 .Dt PWD_MKDB 8
.Os .Os
.Sh NAME .Sh NAME
@ -65,6 +65,19 @@ The options are as follows:
Check if the password file is in the correct format. Check if the password file is in the correct format.
Do not Do not
change, add, or remove any files. change, add, or remove any files.
.It Fl d Ar directory
Store databases into specified destination directory instead of
.Pa /etc .
.It Fl i
Ignore locking failure of the
.Pa master.passwd
file.
This option is intended to be used to build password files in
the release process over NFS where no contention can happen.
A non-default directory must also be specified with the
.Fl d
option for locking to be ignored.
Other use of this option is strongly discouraged.
.It Fl N .It Fl N
Tell Tell
.Nm .Nm
@ -76,24 +89,6 @@ the rebuilding of the database.
.It Fl p .It Fl p
Create a Version 7 style password file and install it into Create a Version 7 style password file and install it into
.Pa /etc/passwd . .Pa /etc/passwd .
.It Fl i
Ignore locking failure of the
.Pa master.passwd
file.
This option is intended to be used to build password files in
the release process over NFS where no contention can happen.
A non-default directory must also be specified with the
.Fl d
option for locking to be ignored.
Other use of this option is strongly discouraged.
.It Fl d Ar directory
Store databases into specified destination directory instead of
.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
overhead of rebuilding the entire database.
.It Fl s Ar cachesize .It Fl s Ar cachesize
Specify in megabytes the size of the memory cache used by the Specify in megabytes the size of the memory cache used by the
hashing library. hashing library.
@ -104,6 +99,11 @@ As a rough guide, the memory usage of
in megabytes will be a little bit more than twice the figure in megabytes will be a little bit more than twice the figure
specified here. specified here.
The default is 2 megabytes. The default is 2 megabytes.
.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
overhead of rebuilding the entire database.
.El .El
.Pp .Pp
The two databases differ in that the secure version contains the user's The two databases differ in that the secure version contains the user's

View File

@ -123,14 +123,11 @@ main(int argc, char *argv[])
makeold = 0; makeold = 0;
username = NULL; username = NULL;
oldfp = NULL; oldfp = NULL;
while ((ch = getopt(argc, argv, "CNd:ips:u:v")) != -1) while ((ch = getopt(argc, argv, "Cd:iNps:u:v")) != -1)
switch(ch) { switch(ch) {
case 'C': /* verify only */ case 'C': /* verify only */
Cflag = 1; Cflag = 1;
break; break;
case 'N': /* do not wait for lock */
nblock = LOCK_NB; /* will fail if locked */
break;
case 'd': case 'd':
dflag++; dflag++;
strlcpy(prefix, optarg, sizeof(prefix)); strlcpy(prefix, optarg, sizeof(prefix));
@ -138,6 +135,9 @@ main(int argc, char *argv[])
case 'i': case 'i':
iflag++; iflag++;
break; break;
case 'N': /* do not wait for lock */
nblock = LOCK_NB; /* will fail if locked */
break;
case 'p': /* create V7 "file.orig" */ case 'p': /* create V7 "file.orig" */
makeold = 1; makeold = 1;
break; break;
@ -675,6 +675,6 @@ usage(void)
{ {
(void)fprintf(stderr, (void)fprintf(stderr,
"usage: pwd_mkdb [-BCiLNp] [-d directory] [-s cachesize] [-u username] file\n"); "usage: pwd_mkdb [-CiNp] [-d directory] [-s cachesize] [-u username] file\n");
exit(1); exit(1);
} }