Make better use of .Ar. Use DIAGNOSTICS instead of incorrect section name.

Add rcsid. Remove unused #includes. Cosmetic in error messages.
This commit is contained in:
Philippe Charnier 1999-11-21 16:16:30 +00:00
parent dd562b0ebb
commit 93d6b9b66d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53508
2 changed files with 17 additions and 17 deletions

View File

@ -38,20 +38,18 @@
.Sh NAME .Sh NAME
.Nm cap_mkdb .Nm cap_mkdb
.Nd create capability database .Nd create capability database
.Pp
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm cap_mkdb .Nm cap_mkdb
.Op Fl v .Op Fl v
.Op Fl f Ar outfile .Op Fl f Ar outfile
.Ar file1 .Ar file
.Op Ar file2 ... .Op Ar
.Pp
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm Cap_mkdb .Nm Cap_mkdb
builds a hashed database out of the builds a hashed database out of the
.Xr getcap 3 .Xr getcap 3
logical database constructed by the concatenation of the specified logical database constructed by the concatenation of the specified
files . files.
.Pp .Pp
The database is named by the basename of the first file argument and The database is named by the basename of the first file argument and
the string the string
@ -64,8 +62,8 @@ than they can the original text file(s).
The ``tc'' capabilities of the records are expanded before the The ``tc'' capabilities of the records are expanded before the
record is stored into the database. record is stored into the database.
.Pp .Pp
The options as follows: The following options are available:
.Bl -tag -width XXXXXX -indent .Bl -tag -width indent
.It Fl f Ar outfile .It Fl f Ar outfile
Specify a different database basename. Specify a different database basename.
.It Fl v .It Fl v
@ -92,10 +90,10 @@ in a key/data pair of the second type.
The data field of this key/data pair is used to look up a key/data The data field of this key/data pair is used to look up a key/data
pair of the first type which has the real data associated with the pair of the first type which has the real data associated with the
name. name.
.Sh RETURN VALUE .Sh DIAGNOSTICS
The The
.Nm cap_mkdb .Nm
utility exits 0 on success and >0 if an error occurs. utility exits 0 on success, and >0 if an error occurs.
.Sh SEE ALSO .Sh SEE ALSO
.Xr dbopen 3 , .Xr dbopen 3 ,
.Xr getcap 3 , .Xr getcap 3 ,

View File

@ -38,7 +38,11 @@ static const char copyright[] =
#endif /* not lint */ #endif /* not lint */
#ifndef lint #ifndef lint
static const char sccsid[] = "@(#)cap_mkdb.c 8.1 (Berkeley) 6/6/93"; #if 0
static char sccsid[] = "@(#)cap_mkdb.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -46,9 +50,7 @@ static const char sccsid[] = "@(#)cap_mkdb.c 8.1 (Berkeley) 6/6/93";
#include <db.h> #include <db.h>
#include <err.h> #include <err.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -102,7 +104,7 @@ main(argc, argv)
*/ */
(void)snprintf(buf, sizeof(buf), "%s.db", capname ? capname : *argv); (void)snprintf(buf, sizeof(buf), "%s.db", capname ? capname : *argv);
if ((capname = strdup(buf)) == NULL) if ((capname = strdup(buf)) == NULL)
err(1, (char *)NULL); errx(1, "strdup failed");
if ((capdbp = dbopen(capname, if ((capdbp = dbopen(capname,
O_CREAT | O_TRUNC | O_RDWR, DEFFILEMODE, DB_HASH, NULL)) == NULL) O_CREAT | O_TRUNC | O_RDWR, DEFFILEMODE, DB_HASH, NULL)) == NULL)
err(1, "%s", buf); err(1, "%s", buf);
@ -159,7 +161,7 @@ db_build(ifiles)
if (bplen <= len + 2) { if (bplen <= len + 2) {
bplen += MAX(256, len + 2); bplen += MAX(256, len + 2);
if ((data.data = realloc(data.data, bplen)) == NULL) if ((data.data = realloc(data.data, bplen)) == NULL)
err(1, (char *)NULL); errx(1, "malloc failed");
} }
/* Find the end of the name field. */ /* Find the end of the name field. */
@ -175,7 +177,7 @@ db_build(ifiles)
break; break;
case 2: case 2:
((char *)(data.data))[0] = TCERR; ((char *)(data.data))[0] = TCERR;
warnx("Record not tc expanded: %.*s", p - bp, bp); warnx("record not tc expanded: %.*s", p - bp, bp);
break; break;
} }
@ -245,6 +247,6 @@ void
usage() usage()
{ {
(void)fprintf(stderr, (void)fprintf(stderr,
"usage: cap_mkdb [-v] [-f outfile] file1 [file2 ...]\n"); "usage: cap_mkdb [-v] [-f outfile] file [file ...]\n");
exit(1); exit(1);
} }