diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-06-07 15:09:53 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-06-07 15:09:53 +0000 |
commit | 577824cadb88a52417c8a551d1aa6b70b2224b22 (patch) | |
tree | c4dd39aa75f88d08e399e7e8126280b83657e59f /pw/pw_user.c | |
parent | e6c20d74e9c630e7116f84d3712c178369b10c96 (diff) | |
download | pw-darwin-577824cadb88a52417c8a551d1aa6b70b2224b22.tar.gz pw-darwin-577824cadb88a52417c8a551d1aa6b70b2224b22.tar.zst pw-darwin-577824cadb88a52417c8a551d1aa6b70b2224b22.zip |
Handle dryrun (-N) via global pwconf
Diffstat (limited to 'pw/pw_user.c')
-rw-r--r-- | pw/pw_user.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/pw/pw_user.c b/pw/pw_user.c index d69f56b..fac4d25 100644 --- a/pw/pw_user.c +++ b/pw/pw_user.c @@ -620,7 +620,7 @@ pw_user(int mode, struct cargs * args) /* * Special case: -N only displays & exits */ - if (getarg(args, 'N') != NULL) + if (conf.dryrun) return print_user(pwd, getarg(args, 'P') != NULL, getarg(args, '7') != NULL); @@ -872,9 +872,7 @@ pw_gidpolicy(struct cargs * args, char *nam, gid_t prefer) snprintf(tmp, sizeof(tmp), "%u", prefer); addarg(&grpargs, 'g', tmp); } - if (getarg(args, 'N')) - { - addarg(&grpargs, 'N', NULL); + if (conf.dryrun) { addarg(&grpargs, 'q', NULL); gid = pw_group(M_NEXT, &grpargs); } @@ -1035,7 +1033,7 @@ pw_password(struct userconf * cnf, struct cargs * args, char const * user) * We give this information back to the user */ if (getarg(args, 'h') == NULL && getarg(args, 'H') == NULL && - getarg(args, 'N') == NULL) { + !conf.dryrun) { if (isatty(STDOUT_FILENO)) printf("Password for '%s' is: ", user); printf("%s\n", pwbuf); |