Deleted Added
sdiff udiff text old ( 142109 ) new ( 142262 )
full compact
1/*-
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 30 unchanged lines hidden (view full) ---

39
40#if 0
41#ifndef lint
42static char sccsid[] = "@(#)cap_mkdb.c 8.2 (Berkeley) 4/27/95";
43#endif
44#endif
45
46#include <sys/cdefs.h>
47__FBSDID("$FreeBSD: head/usr.bin/cap_mkdb/cap_mkdb.c 142109 2005-02-19 23:59:49Z ru $");
48
49#include <sys/param.h>
50#include <sys/stat.h>
51
52#include <db.h>
53#include <err.h>
54#include <fcntl.h>
55#include <stdio.h>

--- 23 unchanged lines hidden (view full) ---

79 * records. The database contains 2 types of entries: records and references
80 * marked by the first byte in the data. A record entry contains the actual
81 * capability record whereas a reference contains the name (key) under which
82 * the correct record is stored.
83 */
84int
85main(int argc, char *argv[])
86{
87 int c;
88
89 capname = NULL;
90 while ((c = getopt(argc, argv, "f:v")) != -1) {
91 switch(c) {
92 case 'f':
93 capname = optarg;
94 break;
95 case 'v':
96 verbose = 1;
97 break;
98 case '?':
99 default:
100 usage();
101 }
102 }
103 argc -= optind;
104 argv += optind;
105
106 if (*argv == NULL)
107 usage();
108
109 /*
110 * The database file is the first argument if no name is specified.
111 * Make arrangements to unlink it if exit badly.
112 */
113 (void)snprintf(buf, sizeof(buf), "%s.db", capname ? capname : *argv);
114 if ((capname = strdup(buf)) == NULL)
115 errx(1, "strdup failed");
116 if ((capdbp = dbopen(capname, O_CREAT | O_TRUNC | O_RDWR,

--- 135 unchanged lines hidden (view full) ---

252 if (verbose)
253 (void)printf("cap_mkdb: %d capability records\n", reccnt);
254}
255
256void
257usage(void)
258{
259 (void)fprintf(stderr,
260 "usage: cap_mkdb [-v] [-f outfile] file [file ...]\n");
261 exit(1);
262}