summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pw/pw.c5
-rw-r--r--pw/pw_group.c2
-rw-r--r--pw/pw_user.c2
-rw-r--r--pw/pwupd.h1
4 files changed, 7 insertions, 3 deletions
diff --git a/pw/pw.c b/pw/pw.c
index 6769738..951abc6 100644
--- a/pw/pw.c
+++ b/pw/pw.c
@@ -314,6 +314,9 @@ main(int argc, char *argv[])
case 'o':
conf.checkduplicate = true;
break;
+ case 'q':
+ conf.quiet = true;
+ break;
default:
addarg(&arglist, ch, optarg);
break;
@@ -334,7 +337,7 @@ main(int argc, char *argv[])
* We should immediately look for the -q 'quiet' switch so that we
* don't bother with extraneous errors
*/
- if (getarg(&arglist, 'q') != NULL)
+ if (conf.quiet)
freopen(_PATH_DEVNULL, "w", stderr);
/*
diff --git a/pw/pw_group.c b/pw/pw_group.c
index 28a7c94..61f0a21 100644
--- a/pw/pw_group.c
+++ b/pw/pw_group.c
@@ -122,7 +122,7 @@ pw_group(int mode, char *name, long id, struct cargs * args)
};
if (mode == M_NEXT)
- return (pw_groupnext(cnf, getarg(args, 'q') != NULL));
+ return (pw_groupnext(cnf, conf.quiet));
if (mode == M_LOCK || mode == M_UNLOCK)
errx(EX_USAGE, "'lock' command is not available for groups");
diff --git a/pw/pw_user.c b/pw/pw_user.c
index 298aeab..dc9827a 100644
--- a/pw/pw_user.c
+++ b/pw/pw_user.c
@@ -231,7 +231,7 @@ pw_user(int mode, char *name, long id, struct cargs * args)
cnf = conf.userconf;
if (mode == M_NEXT)
- return (pw_usernext(cnf, getarg(args, 'q') != NULL));
+ return (pw_usernext(cnf, conf.quiet));
/*
* We can do all of the common legwork here
diff --git a/pw/pwupd.h b/pw/pwupd.h
index 37303de..be126c5 100644
--- a/pw/pwupd.h
+++ b/pw/pwupd.h
@@ -87,6 +87,7 @@ struct pwconf {
char *config;
int fd;
int which;
+ bool quiet;
bool dryrun;
bool pretty;
bool v7;