add "-o database" option to specify alternate database file path.
This commit is contained in:
parent
4a22cb272c
commit
c67cb58b47
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: kvm_mkdb.8,v 1.10 1998/02/06 06:20:26 perry Exp $
|
||||
.\" $NetBSD: kvm_mkdb.8,v 1.11 1999/09/24 20:08:08 msaitoh Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1989, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -41,6 +41,7 @@
|
|||
.Nd create kernel database
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl o Ar database
|
||||
.Op file
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
|
@ -53,6 +54,12 @@ is used by default.
|
|||
The database will only be recreated if its contents
|
||||
do not already describe the running kernel.
|
||||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width indent
|
||||
.It Fl o Ar database
|
||||
Put the output databases in the named file.
|
||||
.El
|
||||
.Pp
|
||||
Various library routines consult this database.
|
||||
The only information currently stored is the kernel namelist, which is
|
||||
used by the
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kvm_mkdb.c,v 1.14 1997/10/18 08:49:30 lukem Exp $ */
|
||||
/* $NetBSD: kvm_mkdb.c,v 1.15 1999/09/24 20:08:08 msaitoh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
||||
|
@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 1993\n\
|
|||
#if 0
|
||||
static char sccsid[] = "from: @(#)kvm_mkdb.c 8.3 (Berkeley) 5/4/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: kvm_mkdb.c,v 1.14 1997/10/18 08:49:30 lukem Exp $");
|
||||
__RCSID("$NetBSD: kvm_mkdb.c,v 1.15 1999/09/24 20:08:08 msaitoh Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -76,6 +76,7 @@ HASHINFO openinfo = {
|
|||
};
|
||||
|
||||
static DB *db;
|
||||
static char *dbname = _PATH_KVMDB;
|
||||
static char dbtemp[MAXPATHLEN];
|
||||
|
||||
int
|
||||
|
@ -84,10 +85,14 @@ main(argc, argv)
|
|||
char *argv[];
|
||||
{
|
||||
int ch;
|
||||
char *p, *nlistpath, *nlistname, dbname[MAXPATHLEN];
|
||||
char *p, *nlistpath, *nlistname;
|
||||
|
||||
while ((ch = getopt(argc, argv, "")) != -1)
|
||||
while ((ch = getopt(argc, argv, "o:")) != -1)
|
||||
switch (ch) {
|
||||
case 'o':
|
||||
dbname = optarg;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
|
@ -106,8 +111,7 @@ main(argc, argv)
|
|||
nlistpath = argc > 0 ? argv[0] : _PATH_UNIX;
|
||||
nlistname = basename(nlistpath);
|
||||
|
||||
(void)snprintf(dbname, sizeof(dbname), "%s", _PATH_KVMDB);
|
||||
(void)snprintf(dbtemp, sizeof(dbtemp), "%s.tmp", _PATH_KVMDB);
|
||||
(void)snprintf(dbtemp, sizeof(dbtemp), "%s.tmp", dbname);
|
||||
(void)umask(0);
|
||||
db = dbopen(dbtemp, O_CREAT | O_EXLOCK | O_TRUNC | O_RDWR,
|
||||
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, DB_HASH, &openinfo);
|
||||
|
@ -130,7 +134,7 @@ main(argc, argv)
|
|||
void
|
||||
usage()
|
||||
{
|
||||
(void)fprintf(stderr, "usage: kvm_mkdb [file]\n");
|
||||
(void)fprintf(stderr, "usage: kvm_mkdb [-o database] [file]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue