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

View File

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