]> git.cameronkatri.com Git - pw-darwin.git/commitdiff
Move the quiet flag into the configuration structure
authorBaptiste Daroussin <bapt@FreeBSD.org>
Sat, 11 Jul 2015 17:01:08 +0000 (17:01 +0000)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Sat, 11 Jul 2015 17:01:08 +0000 (17:01 +0000)
pw/pw.c
pw/pw_group.c
pw/pw_user.c
pw/pwupd.h

diff --git a/pw/pw.c b/pw/pw.c
index 6769738fbe30c2d79f1300427e2d66eb17feef34..951abc6a0b0af5c08fc1e6557b418c9fcf43408e 100644 (file)
--- 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);
 
        /*
index 28a7c94c789d4bca6236c1ad53f075c20396cb2f..61f0a21d90cb8e7c15687b2f2c316a4def7d428c 100644 (file)
@@ -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");
index 298aeab8795114369583793f27ad6636356939d1..dc9827af0e22086249fb3a38605c7e55d349f2e9 100644 (file)
@@ -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
index 37303de4e63d43ed76ef70d6f64ae6c4a8cad317..be126c54a46ffff078e31a78fef1b06393025543 100644 (file)
@@ -87,6 +87,7 @@ struct pwconf {
        char            *config;
        int              fd;
        int              which;
+       bool             quiet;
        bool             dryrun;
        bool             pretty;
        bool             v7;