don't be so noisy...
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sun, 24 Jan 1993 02:32:20 +0000 (18:32 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sun, 24 Jan 1993 02:32:20 +0000 (18:32 -0800)
SCCS-vsn: usr.bin/cap_mkdb/cap_mkdb.c 5.2

usr/src/usr.bin/cap_mkdb/cap_mkdb.c

index 6038ee2..7f22362 100644 (file)
@@ -12,7 +12,7 @@ static char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)cap_mkdb.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)cap_mkdb.c 5.2 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -32,7 +32,7 @@ static void    err __P((int, const char *, ...));
 static void     getnamefield __P((char **, char *));
 static void     usage __P((void));
 
 static void     getnamefield __P((char **, char *));
 static void     usage __P((void));
 
-int docapdbunlink, printnl;
+int docapdbunlink, printnl, verbose;
 char *capdb, **inputfiles;
 
 /*
 char *capdb, **inputfiles;
 
 /*
@@ -51,11 +51,14 @@ main(argc, argv)
        char *outname, buf[MAXPATHLEN + 1], **f;
 
        outname = NULL;
        char *outname, buf[MAXPATHLEN + 1], **f;
 
        outname = NULL;
-       while ((c = getopt(argc, argv, "f:")) != EOF) {
+       while ((c = getopt(argc, argv, "f:v")) != EOF) {
                switch(c) {
                case 'f':
                        outname = optarg;
                        break;
                switch(c) {
                case 'f':
                        outname = optarg;
                        break;
+               case 'v':
+                       verbose = 1;
+                       break;
                case '?':
                default:
                        usage();
                case '?':
                default:
                        usage();
@@ -85,11 +88,11 @@ main(argc, argv)
         */
        for (f = inputfiles; *f != NULL; f++) {
                (void)sprintf(buf, "%s.db", *f);
         */
        for (f = inputfiles; *f != NULL; f++) {
                (void)sprintf(buf, "%s.db", *f);
-               fd = open(buf, O_RDONLY, 0444);
+               fd = open(buf, O_RDONLY, 0);
                if (fd == -1 && errno != ENOENT)
                        err(1, "%s: %s", buf, strerror(errno));
                if (fd >= 0) {
                if (fd == -1 && errno != ENOENT)
                        err(1, "%s: %s", buf, strerror(errno));
                if (fd >= 0) {
-                       err(0, "Warning -- %s.db will override %s.", *f, *f);
+                       err(0, "%s.db overrides %s.", *f, *f);
                        (void)close(fd);
                }
        }
                        (void)close(fd);
                }
        }
@@ -191,7 +194,8 @@ db_build(inputfiles)
        free(nf);
        free(bp);
 
        free(nf);
        free(bp);
 
-       (void)printf("cap_mkdb: %d capability records\n", reccnt);
+       if (verbose)
+               (void)printf("cap_mkdb: %d capability records\n", reccnt);
 }
 
 void
 }
 
 void