summaryrefslogtreecommitdiffstats
path: root/usr.sbin/setfmac/setfmac.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-02-18 05:40:15 +0000
committerrwatson <rwatson@FreeBSD.org>2004-02-18 05:40:15 +0000
commitace4c0498573b056a34f3298a83e4c476883760c (patch)
tree51fd8b5efeda6b38995bed1de9a01a3655f3448a /usr.sbin/setfmac/setfmac.c
parenta586e42a8cc7bf770ab458b56cad1e07e315b1a7 (diff)
downloadFreeBSD-src-ace4c0498573b056a34f3298a83e4c476883760c.zip
FreeBSD-src-ace4c0498573b056a34f3298a83e4c476883760c.tar.gz
Add "-q" argument to setfmac and setfsmac to allow the patient but
exhausted reader not to see non-fatal warnings.
Diffstat (limited to 'usr.sbin/setfmac/setfmac.c')
-rw-r--r--usr.sbin/setfmac/setfmac.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/usr.sbin/setfmac/setfmac.c b/usr.sbin/setfmac/setfmac.c
index aee0905..d5f5a61 100644
--- a/usr.sbin/setfmac/setfmac.c
+++ b/usr.sbin/setfmac/setfmac.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2002 Networks Associates Technology, Inc.
+ * Copyright (c) 2002, 2004 Networks Associates Technology, Inc.
* All rights reserved.
*
* This software was developed for the FreeBSD Project by NAI Labs, the
@@ -77,6 +77,8 @@ void add_spec_line(const char *, int, struct label_spec_entry *, char *);
int apply_specs(struct label_specs *, FTSENT *, int, int);
int specs_empty(struct label_specs *);
+static int qflag;
+
int
main(int argc, char **argv)
{
@@ -93,7 +95,8 @@ main(int argc, char **argv)
is_setfmac = strcmp(bn, "setfmac") == 0;
hflag = is_setfmac ? FTS_LOGICAL : FTS_PHYSICAL;
specs = new_specs();
- while ((ch = getopt(argc, argv, is_setfmac ? "Rh" : "ef:s:vx")) != -1) {
+ while ((ch = getopt(argc, argv, is_setfmac ? "Rhq" : "ef:qs:vx")) !=
+ -1) {
switch (ch) {
case 'R':
Rflag = 1;
@@ -107,6 +110,9 @@ main(int argc, char **argv)
case 'h':
hflag = FTS_PHYSICAL;
break;
+ case 'q':
+ qflag = 1;
+ break;
case 's':
add_specs(specs, optarg, 1);
break;
@@ -156,8 +162,10 @@ main(int argc, char **argv)
"%.*s", ftsent->fts_pathlen,
ftsent->fts_path);
}
- warnx("labeling not supported in %.*s",
- ftsent->fts_pathlen, ftsent->fts_path);
+ if (!qflag)
+ warnx("labeling not supported in %.*s",
+ ftsent->fts_pathlen,
+ ftsent->fts_path);
fts_set(fts, ftsent, FTS_SKIP);
}
break;
@@ -181,9 +189,9 @@ usage(int is_setfmac)
{
if (is_setfmac)
- fprintf(stderr, "usage: setfmac [-Rh] label file ...\n");
+ fprintf(stderr, "usage: setfmac [-Rhq] label file ...\n");
else
- fprintf(stderr, "usage: setfsmac [-ehvx] [-f specfile [...]] [-s specfile [...]] file ...\n");
+ fprintf(stderr, "usage: setfsmac [-ehqvx] [-f specfile [...]] [-s specfile [...]] file ...\n");
exit(1);
}
@@ -270,7 +278,9 @@ add_specs(struct label_specs *specs, const char *file, int is_sebsd)
free(line);
}
fclose(fp);
- warnx("%s: read %lu specifications", file, (long)spec->nentries);
+ if (!qflag)
+ warnx("%s: read %lu specifications", file,
+ (long)spec->nentries);
STAILQ_INSERT_TAIL(&specs->head, spec, link);
}
OpenPOWER on IntegriCloud