Rewrite parsing subcommands arguments of pw(8)
authorbapt <bapt@FreeBSD.org>
Sun, 2 Aug 2015 12:47:50 +0000 (12:47 +0000)
committerbapt <bapt@FreeBSD.org>
Sun, 2 Aug 2015 12:47:50 +0000 (12:47 +0000)
commit4f6bdcfb5d991cad957a55f5585949b946a630e0
treed5d6ce85a1426eb1e7646c1704429db2f4b92b47
parent55f7ded2fa64774e32d065c22e0d5d433329bb77
Rewrite parsing subcommands arguments of pw(8)

Now each subcommands checks its arguments in a dedicated functions.

This helps improving input validation, code readability/maintainability
While here:
- Add a -y option to pw userdel/usermod so it can maintain NIS servers if
  nispasswd is not defined in pw.conf(5)
- Allow pw -r <rootdir> to remove directory with userdel -r
- Fix bug when renaming a user which was not renaming the user name it groups
  it is a member of.
- Only parse pw.conf(5) when needed.
14 files changed:
usr.sbin/pw/Makefile
usr.sbin/pw/pw.c
usr.sbin/pw/pw.h
usr.sbin/pw/pw_conf.c
usr.sbin/pw/pw_group.c
usr.sbin/pw/pw_nis.c
usr.sbin/pw/pw_user.c
usr.sbin/pw/pw_utils.c [copied from usr.sbin/pw/strtounum.c with 55% similarity]
usr.sbin/pw/pwupd.h
usr.sbin/pw/strtounum.c
usr.sbin/pw/tests/pw_groupdel.sh
usr.sbin/pw/tests/pw_useradd.sh
usr.sbin/pw/tests/pw_userdel.sh
usr.sbin/pw/tests/pw_usermod.sh