diff --git a/ChangeLog b/ChangeLog index 119a60ee..122c8e83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-04-11 Nicolas François + + * src/usermod.c, src/useraddd.c: Fix the usage string so that it + does not change depending on the configure option. Use a format. + 2009-04-11 Nicolas François * src/gpasswd.c: Fix the usage of the unused macro. diff --git a/src/useradd.c b/src/useradd.c index 89575dbd..25d2908b 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -144,7 +144,8 @@ static bool rflg = false, /* create a system account */ sflg = false, /* shell program for new account */ uflg = false, /* specify user ID for new account */ - Uflg = false; /* create a group having the same name as the user */ + Uflg = false, /* create a group having the same name as the user */ + Zflg = false; /* new selinux user */ static bool home_added = false; @@ -664,7 +665,8 @@ static int get_groups (char *list) */ static void usage (void) { - fputs (_("Usage: useradd [options] LOGIN\n" + fprintf (stderr, + _("Usage: useradd [options] LOGIN\n" "\n" "Options:\n" " -b, --base-dir BASE_DIR base directory for the new user account\n" @@ -698,10 +700,14 @@ static void usage (void) " -s, --shell SHELL the login shell for the new user account\n" " -u, --uid UID force use the UID for the new user account\n" " -U, --user-group create a group with the same name as the user\n" + "%s" + "\n"), #ifdef WITH_SELINUX - " -Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping\n" + _(" -Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping\n") +#else + "" #endif - "\n"), stderr); + ); exit (E_USAGE); } @@ -1173,6 +1179,7 @@ static void process_flags (int argc, char **argv) case 'Z': if (is_selinux_enabled () > 0) { user_selinux = optarg; + Zflg = true; } else { fprintf (stderr, _("%s: -Z requires SELinux enabled kernel\n"), diff --git a/src/usermod.c b/src/usermod.c index 5b337fa3..cec2d1ae 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -300,7 +300,8 @@ static int get_groups (char *list) */ static void usage (void) { - fputs (_("Usage: usermod [options] LOGIN\n" + fprintf (stderr, + _("Usage: usermod [options] LOGIN\n" "\n" "Options:\n" " -c, --comment COMMENT new value of the GECOS field\n" @@ -323,10 +324,14 @@ static void usage (void) " -s, --shell SHELL new login shell for the user account\n" " -u, --uid UID new UID for the user account\n" " -U, --unlock unlock the user account\n" + "%s" + "\n"), #ifdef WITH_SELINUX - " -Z, --selinux-user new SELinux user mapping for the user account\n" + _(" -Z, --selinux-user new SELinux user mapping for the user account\n") +#else + "" #endif - "\n"), stderr); + ); exit (E_USAGE); }