diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 1999-03-05 04:47:47 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 1999-03-05 04:47:47 +0000 |
commit | b28bfeb89a71361e0d701fc926db0cfaeb6d2a78 (patch) | |
tree | eb91b37ef22ab464733a0d66d76051f5fbb57278 | |
parent | aaa14edd7ee527002686b0260ce5ffe1ab567fc8 (diff) |
Merge cap_mkdb(1) and info_mkdb(1)
-rw-r--r-- | share/termtypes/Makefile | 4 | ||||
-rw-r--r-- | usr.bin/Makefile | 5 | ||||
-rw-r--r-- | usr.bin/cap_mkdb/Makefile | 3 | ||||
-rw-r--r-- | usr.bin/cap_mkdb/cap_mkdb.1 | 12 | ||||
-rw-r--r-- | usr.bin/cap_mkdb/cap_mkdb.c | 52 | ||||
-rw-r--r-- | usr.bin/cap_mkdb/getinfo.c (renamed from usr.bin/info_mkdb/getinfo.c) | 6 | ||||
-rw-r--r-- | usr.bin/info_mkdb/Makefile | 7 | ||||
-rw-r--r-- | usr.bin/info_mkdb/info_mkdb.1 | 103 | ||||
-rw-r--r-- | usr.bin/info_mkdb/info_mkdb.c | 279 |
9 files changed, 55 insertions, 416 deletions
diff --git a/share/termtypes/Makefile b/share/termtypes/Makefile index e133edd713e..10a5b93f2b4 100644 --- a/share/termtypes/Makefile +++ b/share/termtypes/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.6 1998/12/20 18:58:41 millert Exp $ +# $OpenBSD: Makefile,v 1.7 1999/03/05 04:47:44 tholo Exp $ # # Take termcap/terminfo master file and generate termcap/terminfo .db files # master: http://www.tuxedo.org/~esr/terminfo/termtypes.master.gz @@ -15,7 +15,7 @@ terminfo.src: termtypes.master > terminfo.src terminfo.db: terminfo.src - info_mkdb -f terminfo terminfo.src + cap_mkdb -i -f terminfo terminfo.src termcap.src: termtypes.master tic -C ${.ALLSRC} | sed \ diff --git a/usr.bin/Makefile b/usr.bin/Makefile index fbeefbd1443..eb6445635b3 100644 --- a/usr.bin/Makefile +++ b/usr.bin/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.54 1999/01/10 23:20:29 niklas Exp $ +# $OpenBSD: Makefile,v 1.55 1999/03/05 04:47:44 tholo Exp $ .include <bsd.own.mk> @@ -7,8 +7,7 @@ SUBDIR= apply apropos arch asa at aucat audioctl awk banner basename bdes biff \ colrm column comm compile_et compress cpp crontab ctags cut dirname \ du elf2olf encrypt env error expand false file file2c find finger fmt \ fold from fsplit fstat ftp gencat getconf getopt gprof head hexdump \ - id indent \ - info_mkdb ipcrm ipcs join jot kdump ktrace lam last lastcomm leave \ + id indent ipcrm ipcs join jot kdump ktrace lam last lastcomm leave \ less lex lndir locate lock logger login logname look lorder m4 \ machine mail make man mesg midiplay mixerctl mkdep mkfifo mkstr \ mktemp modstat msgs nc netstat newsyslog \ diff --git a/usr.bin/cap_mkdb/Makefile b/usr.bin/cap_mkdb/Makefile index d1d341283f8..55b86c5c7f8 100644 --- a/usr.bin/cap_mkdb/Makefile +++ b/usr.bin/cap_mkdb/Makefile @@ -1,5 +1,6 @@ -# $OpenBSD: Makefile,v 1.3 1997/09/21 11:48:33 deraadt Exp $ +# $OpenBSD: Makefile,v 1.4 1999/03/05 04:47:45 tholo Exp $ PROG= cap_mkdb +SRCS= cap_mkdb.c getinfo.c .include <bsd.prog.mk> diff --git a/usr.bin/cap_mkdb/cap_mkdb.1 b/usr.bin/cap_mkdb/cap_mkdb.1 index 99300c4c930..5443d45e67b 100644 --- a/usr.bin/cap_mkdb/cap_mkdb.1 +++ b/usr.bin/cap_mkdb/cap_mkdb.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: cap_mkdb.1,v 1.6 1998/09/23 04:32:36 aaron Exp $ +.\" $OpenBSD: cap_mkdb.1,v 1.7 1999/03/05 04:47:45 tholo Exp $ .\" $NetBSD: cap_mkdb.1,v 1.4 1995/03/26 03:59:36 glass Exp $ .\" .\" Copyright (c) 1992, 1993 @@ -43,6 +43,7 @@ .Pp .Sh SYNOPSIS .Nm cap_mkdb +.Op Fl i .Op Fl v .Op Fl f Ar outfile .Ar file1 @@ -52,6 +53,8 @@ .Nm cap_mkdb builds a hashed database out of the .Xr getcap 3 +or +.Xr terminfo 5 logical database constructed by the concatenation of the specified files. .Pp @@ -70,6 +73,10 @@ The options are as follows: .Bl -tag -width XXXXXX -indent .It Fl f Ar outfile Specify a different database basename. +.It Fl i +Expect the capability records to be parsed to be in +.Xr terminfo 5 +format. .It Fl v Print out the number of capability records in the database. .El @@ -103,4 +110,5 @@ utility exits 0 on success or >0 if an error occurred. .Sh SEE ALSO .Xr dbopen 3 , .Xr getcap 3 , -.Xr termcap 5 +.Xr termcap 5 , +.Xr terminfo 5 diff --git a/usr.bin/cap_mkdb/cap_mkdb.c b/usr.bin/cap_mkdb/cap_mkdb.c index ed340c9b3e2..b12a199bbd3 100644 --- a/usr.bin/cap_mkdb/cap_mkdb.c +++ b/usr.bin/cap_mkdb/cap_mkdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cap_mkdb.c,v 1.3 1997/01/15 23:42:17 millert Exp $ */ +/* $OpenBSD: cap_mkdb.c,v 1.4 1999/03/05 04:47:45 tholo Exp $ */ /* $NetBSD: cap_mkdb.c,v 1.5 1995/09/02 05:47:12 jtc Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)cap_mkdb.c 8.2 (Berkeley) 4/27/95"; #endif -static char rcsid[] = "$OpenBSD: cap_mkdb.c,v 1.3 1997/01/15 23:42:17 millert Exp $"; +static char rcsid[] = "$OpenBSD: cap_mkdb.c,v 1.4 1999/03/05 04:47:45 tholo Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -58,15 +58,18 @@ static char rcsid[] = "$OpenBSD: cap_mkdb.c,v 1.3 1997/01/15 23:42:17 millert Ex #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <ctype.h> #include <unistd.h> void db_build __P((char **)); void dounlink __P((void)); void usage __P((void)); +int igetnext __P((char **, char **)); +int main __P((int, char *[])); DB *capdbp; -int verbose; -char *capdb, *capname, buf[8 * 1024]; +int info, verbose; +char *capname, buf[8 * 1024]; HASHINFO openinfo = { 4096, /* bsize */ @@ -78,7 +81,7 @@ HASHINFO openinfo = { }; /* - * Mkcapdb creates a capability hash database for quick retrieval of capability + * cap_mkdb creates a capability hash database for quick retrieval of capability * records. The database contains 2 types of entries: records and references * marked by the first byte in the data. A record entry contains the actual * capability record whereas a reference contains the name (key) under which @@ -92,7 +95,7 @@ main(argc, argv) int c; capname = NULL; - while ((c = getopt(argc, argv, "f:v")) != -1) { + while ((c = getopt(argc, argv, "f:iv")) != -1) { switch(c) { case 'f': capname = optarg; @@ -100,6 +103,9 @@ main(argc, argv) case 'v': verbose = 1; break; + case 'i': + info = 1; + break; case '?': default: usage(); @@ -149,7 +155,7 @@ dounlink() #define SHADOW (char)2 /* - * Db_build() builds the name and capabilty databases according to the + * db_build() builds the name and capabilty databases according to the * details above. */ void @@ -164,7 +170,8 @@ db_build(ifiles) data.data = NULL; key.data = NULL; - for (reccnt = 0, bplen = 0; (st = cgetnext(&bp, ifiles)) > 0;) { + for (reccnt = 0, bplen = 0; + (st = (info ? igetnext(&bp, ifiles) : cgetnext(&bp, ifiles))) > 0;) { /* * Allocate enough memory to store record, terminating @@ -178,7 +185,7 @@ db_build(ifiles) } /* Find the end of the name field. */ - if ((p = strchr(bp, ':')) == NULL) { + if ((p = strchr(bp, info ? ',' : ':')) == NULL) { warnx("no name field: %.*s", MIN(len, 20), bp); continue; } @@ -190,13 +197,24 @@ 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", (int)(p - bp), bp); break; } /* Create the stored record. */ - memmove(&((u_char *)(data.data))[1], bp, len + 1); + (void) memmove(&((u_char *)(data.data))[1], bp, len + 1); data.size = len + 2; + if (info) { + for (t = memchr((char *)data.data + 1, ',', data.size - 1); + t; + t = memchr(t, ',', data.size - (t - (char *)data.data))) + *t++ = ':'; + + if (memchr((char *)data.data + 1, '\0', data.size - 2)) { + warnx("NUL in entry: %.*s", (int)MIN(len, 20), bp); + continue; + } + } /* Store the record under the name field. */ key.data = bp; @@ -208,7 +226,7 @@ db_build(ifiles) /* NOTREACHED */ case 1: warnx("ignored duplicate: %.*s", - key.size, (char *)key.data); + (int)key.size, (char *)key.data); continue; } ++reccnt; @@ -219,12 +237,12 @@ db_build(ifiles) /* The rest of the names reference the entire name. */ ((char *)(data.data))[0] = SHADOW; - memmove(&((u_char *)(data.data))[1], key.data, key.size); + (void) memmove(&((u_char *)(data.data))[1], key.data, key.size); data.size = key.size + 1; /* Store references for other names. */ for (p = t = bp;; ++p) { - if (p > t && (*p == ':' || *p == '|')) { + if (p > t && (*p == (info ? ',' : ':') || *p == '|')) { key.size = p - t; key.data = t; switch(capdbp->put(capdbp, @@ -234,11 +252,11 @@ db_build(ifiles) /* NOTREACHED */ case 1: warnx("ignored duplicate: %.*s", - key.size, (char *)key.data); + (int)key.size, (char *)key.data); } t = p + 1; } - if (*p == ':') + if (*p == (info ? ',' : ':')) break; } } @@ -260,6 +278,6 @@ void usage() { (void)fprintf(stderr, - "usage: cap_mkdb [-v] [-f outfile] file1 [file2 ...]\n"); + "usage: cap_mkdb [-iv] [-f outfile] file1 [file2 ...]\n"); exit(1); } diff --git a/usr.bin/info_mkdb/getinfo.c b/usr.bin/cap_mkdb/getinfo.c index 8a98b91aa6c..9214525f694 100644 --- a/usr.bin/info_mkdb/getinfo.c +++ b/usr.bin/cap_mkdb/getinfo.c @@ -1,6 +1,8 @@ -/* $OpenBSD: getinfo.c,v 1.4 1998/07/13 02:11:32 millert Exp $ */ +/* $OpenBSD: getinfo.c,v 1.1 1999/03/05 04:47:45 tholo Exp $ */ /*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. * Copyright (c) 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com> * All rights reserved. * @@ -31,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: getinfo.c,v 1.4 1998/07/13 02:11:32 millert Exp $"; +static char rcsid[] = "$OpenBSD: getinfo.c,v 1.1 1999/03/05 04:47:45 tholo Exp $"; #endif /* not lint */ #include <sys/types.h> diff --git a/usr.bin/info_mkdb/Makefile b/usr.bin/info_mkdb/Makefile deleted file mode 100644 index 0e4c6b8a1d8..00000000000 --- a/usr.bin/info_mkdb/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# $OpenBSD: Makefile,v 1.1 1996/07/22 03:16:29 tholo Exp $ - -PROG= info_mkdb -SRCS= getinfo.c info_mkdb.c -CFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes - -.include <bsd.prog.mk> diff --git a/usr.bin/info_mkdb/info_mkdb.1 b/usr.bin/info_mkdb/info_mkdb.1 deleted file mode 100644 index 68f601d2af0..00000000000 --- a/usr.bin/info_mkdb/info_mkdb.1 +++ /dev/null @@ -1,103 +0,0 @@ -.\" $OpenBSD: info_mkdb.1,v 1.6 1999/01/23 18:40:54 millert Exp $ -.\" -.\" Copyright (c) 1996 SigmaSoft, Th. Lockert -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by SigmaSoft, Th. Lockert. -.\" 4. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd July, 21, 1996 -.Dt INFO_MKDB 1 -.Os -.Sh NAME -.Nm info_mkdb -.Nd create capability database -.Pp -.Sh SYNOPSIS -.Nm info_mkdb -.Op Fl v -.Op Fl f Ar outfile -.Ar file1 -.Op Ar file2 ... -.Pp -.Sh DESCRIPTION -.Nm info_mkdb -builds a hashed database out of the -.Xr terminfo 5 -logical database constructed by the concatenation of the specified -files. -.Pp -The database is named by the basename of the first file argument and -the string -.Dq .db . -The -.Xr getcap 3 -routines can access the database in this form much more quickly -than they can the original text file(s). -.Pp -The ``tc'' capabilities of the records are expanded before the -record is stored into the database. -.Pp -The options are as follows: -.Bl -tag -width XXXXXX -indent -.It Fl f Ar outfile -Specify a different database basename. -.It Fl v -Print out the number of capability records in the database. -.El -.Pp -.Sh FORMAT -Each record is stored in the database using two different types of keys. -.Pp -The first type is a key which consists of the first capability of -the record (not including the trailing colon (``:'')) with a data -field consisting of a special byte followed by the rest of the record. -The special byte is either a 0 or 1, where a 0 means that the record -is okay, and a 1 means that there was a ``tc'' capability in the record -that couldn't be expanded. -.Pp -The second type is a key which consists of one of the names from the -first capability of the record with a data field consisting a special -byte followed by the first capability of the record. -The special byte is a 2. -.Pp -In normal operation names are looked up in the database, resulting -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 -The -.Nm info_mkdb -utility exits 0 on success or >0 if an error occurred. -.Sh SEE ALSO -.Xr dbopen 3 , -.Xr getcap 3 , -.Xr terminfo 5 -.Sh HISTORY -The -.Nm info_mkdb -utility appeared in -.Ox 2.0 . diff --git a/usr.bin/info_mkdb/info_mkdb.c b/usr.bin/info_mkdb/info_mkdb.c deleted file mode 100644 index 023dad80415..00000000000 --- a/usr.bin/info_mkdb/info_mkdb.c +++ /dev/null @@ -1,279 +0,0 @@ -/* $OpenBSD: info_mkdb.c,v 1.2 1997/01/15 23:42:36 millert Exp $ */ - -/*- - * Copyright (c) 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by SigmaSoft, Th. Lockert. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef lint -static char rcsid[] = "$OpenBSD: info_mkdb.c,v 1.2 1997/01/15 23:42:36 millert Exp $"; -#endif /* not lint */ - -#include <sys/param.h> -#include <sys/stat.h> - -#include <db.h> -#include <err.h> -#include <errno.h> -#include <fcntl.h> -#include <limits.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> -#include <unistd.h> - -void db_build __P((char **)); -void dounlink __P((void)); -void usage __P((void)); -int igetnext __P((char **, char **)); -int main __P((int, char *[])); - -DB *infodbp; -int verbose; -char *infoname, buf[8 * 1024]; - -HASHINFO openinfo = { - 4096, /* bsize */ - 16, /* ffactor */ - 256, /* nelem */ - 2048 * 1024, /* cachesize */ - NULL, /* hash() */ - 0 /* lorder */ -}; - -/* - * info_mkdb creates a capability hash database for quick retrieval of capability - * records. The database contains 2 types of entries: records and references - * marked by the first byte in the data. A record entry contains the actual - * capability record whereas a reference contains the name (key) under which - * the correct record is stored. - */ -int -main(argc, argv) - int argc; - char *argv[]; -{ - int c; - - infoname = NULL; - while ((c = getopt(argc, argv, "f:v")) != -1) { - switch(c) { - case 'f': - infoname = optarg; - break; - case 'v': - verbose = 1; - break; - case '?': - default: - usage(); - } - } - argc -= optind; - argv += optind; - - if (*argv == NULL) - usage(); - - /* - * The database file is the first argument if no name is specified. - * Make arrangements to unlink it if exit badly. - */ - (void)snprintf(buf, sizeof(buf), "%s.db", infoname ? infoname : *argv); - if ((infoname = strdup(buf)) == NULL) { - err(1, "strdup"); - /* NOTREACHED */ - } - if ((infodbp = dbopen(infoname, O_CREAT | O_TRUNC | O_RDWR, - DEFFILEMODE, DB_HASH, &openinfo)) == NULL) { - err(1, "%s", buf); - /* NOTREACHED */ - } - - if (atexit(dounlink)) { - err(1, "atexit"); - /* NOTREACHED */ - } - - db_build(argv); - - if (infodbp->close(infodbp) < 0) { - err(1, "%s", infoname); - /* NOTREACHED */ - } - infoname = NULL; - exit(0); - /* NOTREACHED */ -} - -void -dounlink() -{ - if (infoname != NULL) - (void)unlink(infoname); -} - -/* - * Any changes to these definitions should be made also in the getcap(3) - * library routines. - */ -#define RECOK (char)0 -#define TCERR (char)1 -#define SHADOW (char)2 - -/* - * db_build() builds the name and capability databases according to the - * details above. - */ -void -db_build(ifiles) - char **ifiles; -{ - DBT key, data; - recno_t reccnt; - size_t len, bplen; - int st; - char *bp, *p, *t; - - data.data = NULL; - key.data = NULL; - for (reccnt = 0, bplen = 0; (st = igetnext(&bp, ifiles)) > 0;) { - - /* - * Allocate enough memory to store record, terminating - * NULL and one extra byte. - */ - len = strlen(bp); - if (bplen <= len + 2) { - bplen += MAX(256, len + 2); - if ((data.data = realloc(data.data, bplen)) == NULL) { - err(1, "realloc"); - /* NOTREACHED */ - } - } - - /* Find the end of the name field. */ - if ((p = strchr(bp, ',')) == NULL) { - warnx("no name field: %.*s", (int)MIN(len, 20), bp); - continue; - } - - if (isspace(*bp)) { - warnx("bad name field: %.*s", (int)MIN(len, 20), bp); - continue; - } - - /* First byte of stored record indicates status. */ - switch(st) { - case 1: - ((char *)(data.data))[0] = RECOK; - break; - case 2: - ((char *)(data.data))[0] = TCERR; - warnx("Record not use expanded: %.*s", (int)(p - bp), bp); - break; - } - - /* Create the stored record. */ - (void) memmove(&((u_char *)(data.data))[1], bp, len + 1); - data.size = len + 2; - for (t = memchr((char *)data.data + 1, ',', data.size - 1) ; t ; t = memchr(t, ',', data.size - (t - (char *)data.data))) - *t++ = ':'; - - if (memchr((char *)data.data + 1, '\0', data.size - 2)) { - warnx("NUL in entry: %.*s", (int)MIN(len, 20), bp); - continue; - } - - /* Store the record under the name field. */ - key.data = bp; - key.size = p - bp; - - switch(infodbp->put(infodbp, &key, &data, R_NOOVERWRITE)) { - case -1: - err(1, "put"); - /* NOTREACHED */ - case 1: - warnx("ignored duplicate: %.*s", - (int)key.size, (char *)key.data); - continue; - } - ++reccnt; - - /* If only one name, ignore the rest. */ - if ((p = strchr(bp, '|')) == NULL) - continue; - - /* The rest of the names reference the entire name. */ - ((char *)(data.data))[0] = SHADOW; - (void) memmove(&((u_char *)(data.data))[1], key.data, key.size); - data.size = key.size + 1; - - /* Store references for other names. */ - for (p = t = bp;; ++p) { - if (p > t && (*p == ',' || *p == '|')) { - key.size = p - t; - key.data = t; - - switch(infodbp->put(infodbp, - &key, &data, R_NOOVERWRITE)) { - case -1: - err(1, "put"); - /* NOTREACHED */ - case 1: - warnx("ignored duplicate: %.*s", - (int)key.size, (char *)key.data); - } - t = p + 1; - } - if (*p == ',') - break; - } - } - - switch(st) { - case -1: - err(1, "file argument"); - /* NOTREACHED */ - case -2: - errx(1, "potential reference loop detected"); - /* NOTREACHED */ - } - - if (verbose) - (void)printf("info_mkdb: %d capability records\n", reccnt); -} - -void -usage() -{ - (void)fprintf(stderr, - "usage: info_mkdb [-v] [-f outfile] file1 [file2 ...]\n"); - exit(1); -} |