From f2c84d5a6d35d00f76fd8461fde3f0b1b60da954 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 18 Mar 2008 19:59:37 +0000 Subject: [PATCH] Move version printing, etc. into a separate function. --- sudo.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/sudo.c b/sudo.c index 5a90eb2ba..895e35722 100644 --- a/sudo.c +++ b/sudo.c @@ -116,6 +116,7 @@ static void set_loginclass __P((struct passwd *)); static void set_project __P((struct passwd *)); static void set_runasgr __P((char *)); static void set_runaspw __P((char *)); +static void show_version __P((void)); static void usage __P((int)) __attribute__((__noreturn__)); static void usage_excl __P((int)) @@ -234,22 +235,7 @@ main(argc, argv, envp) else switch (sudo_mode) { case MODE_VERSION: - (void) printf("Sudo version %s\n", version); - if (getuid() == 0) { - putchar('\n'); - (void) printf("Sudoers path: %s\n", _PATH_SUDOERS); -#ifdef HAVE_LDAP -# ifdef _PATH_NSSWITCH_CONF - (void) printf("nsswitch path: %s\n", _PATH_NSSWITCH_CONF); -# endif - (void) printf("ldap.conf path: %s\n", _PATH_LDAP_CONF); - (void) printf("ldap.secret path: %s\n", _PATH_LDAP_SECRET); -#endif - dump_auth_methods(); - dump_defaults(); - dump_interfaces(); - } - exit(0); + show_version(); break; case MODE_HELP: usage(0); @@ -1395,6 +1381,27 @@ cleanup(gotsignal) } } +static void +show_version() +{ + (void) printf("Sudo version %s\n", version); + if (getuid() == 0) { + putchar('\n'); + (void) printf("Sudoers path: %s\n", _PATH_SUDOERS); +#ifdef HAVE_LDAP +# ifdef _PATH_NSSWITCH_CONF + (void) printf("nsswitch path: %s\n", _PATH_NSSWITCH_CONF); +# endif + (void) printf("ldap.conf path: %s\n", _PATH_LDAP_CONF); + (void) printf("ldap.secret path: %s\n", _PATH_LDAP_SECRET); +#endif + dump_auth_methods(); + dump_defaults(); + dump_interfaces(); + } + exit(0); +} + /* * Tell which options are mutually exclusive and exit. */ -- 2.50.1