FreeBSD Bugzilla – Attachment 12063 Details for
Bug 23509
Augment dev_mkdb to allow different directory and database paths.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 2.46 KB, created by
Seth Kingsley
on 2000-12-12 22:40:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Seth Kingsley
Created:
2000-12-12 22:40:01 UTC
Size:
2.46 KB
patch
obsolete
>Index: dev_mkdb.8 >=================================================================== >RCS file: /ncvs/src/usr.sbin/dev_mkdb/dev_mkdb.8,v >retrieving revision 1.5 >diff -u -r1.5 dev_mkdb.8 >--- dev_mkdb.8 1999/12/27 08:01:11 1.5 >+++ dev_mkdb.8 2000/12/12 22:14:56 >@@ -42,17 +42,22 @@ > database > .Sh SYNOPSIS > .Nm dev_mkdb >+.Op Fl f Ar file >+.Op Ar directory > .Sh DESCRIPTION > The > .Nm > command creates a > .Xr db 3 > hash access method database in >-.Pa /var/run/dev.db >+.Pa file >+.Pf ( Fa /var/run/dev.db >+by default) > which contains the names of all of the character and block special >-files in the >-.Pa /dev >-directory, using the file type and the >+files in >+.Pa directory >+.Pf ( Fa /dev >+by default), using the file type and the > .Fa st_rdev > field as the key. > .Pp >@@ -63,9 +68,9 @@ > .Sh FILES > .Bl -tag -width /var/run/dev.db -compact > .It Pa /dev >-Device directory. >+Default device directory. > .It Pa /var/run/dev.db >-Database file. >+Default database file. > .El > .Sh SEE ALSO > .Xr ps 1 , >Index: dev_mkdb.c >=================================================================== >RCS file: /ncvs/src/usr.sbin/dev_mkdb/dev_mkdb.c,v >retrieving revision 1.4 >diff -u -r1.4 dev_mkdb.c >--- dev_mkdb.c 1999/08/28 01:16:04 1.4 >+++ dev_mkdb.c 2000/12/12 20:42:03 >@@ -76,12 +76,16 @@ > } bkey; > DB *db; > DBT data, key; >- int ch; >+ int ch, ndbname = 0; > u_char buf[MAXNAMLEN + 1]; >- char dbtmp[MAXPATHLEN + 1], dbname[MAXPATHLEN + 1]; >+ char dbtmp[MAXPATHLEN + 1], dbname[MAXPATHLEN + 1], *dirname; > >- while ((ch = getopt(argc, argv, "")) != -1) >+ while ((ch = getopt(argc, argv, "f:")) != -1) > switch((char)ch) { >+ case 'f': >+ strlcpy(dbname, optarg, sizeof(dbname)); >+ ndbname = 1; >+ break; > case '?': > default: > usage(); >@@ -89,16 +93,26 @@ > argc -= optind; > argv += optind; > >- if (argc > 0) >+ if (argc > 1) > usage(); >+ else if (argc == 1) >+ dirname = argv[0]; >+ else >+ dirname = _PATH_DEV; > >- if (chdir(_PATH_DEV)) >- err(1, "%s", _PATH_DEV); >+ if (!ndbname) >+ { >+ (void)snprintf(dbname, sizeof(dbtmp), "%sdev.db", _PATH_VARRUN); >+ (void)snprintf(dbtmp, sizeof(dbtmp), "%sdev.tmp", _PATH_VARRUN); >+ } >+ else >+ (void)snprintf(dbtmp, sizeof(dbtmp), "%s.tmp", dbname); > >+ if (chdir(dirname)) >+ err(1, "%s", dirname); >+ > dirp = opendir("."); > >- (void)snprintf(dbtmp, sizeof(dbtmp), "%sdev.tmp", _PATH_VARRUN); >- (void)snprintf(dbname, sizeof(dbtmp), "%sdev.db", _PATH_VARRUN); > db = dbopen(dbtmp, O_CREAT|O_EXLOCK|O_RDWR|O_TRUNC, > S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH, DB_HASH, NULL); > if (db == NULL)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 23509
: 12063