make version option common

This reworks the code for the version option so that it is part of the
parser loop and is a common option to all applets.
This commit is contained in:
William Hubbs
2011-02-12 19:15:29 -06:00
committed by William Hubbs
parent bae0a693a9
commit 73d1a8698e
3 changed files with 27 additions and 17 deletions

View File

@ -837,18 +837,6 @@ main(int argc, char **argv)
if (!applet)
eerrorx("arguments required");
if (argc > 1 && (strcmp(argv[1], "--version") == 0)) {
printf("%s (OpenRC", applet);
if ((bootlevel = rc_sys()))
printf(" [%s]", bootlevel);
printf(") " VERSION
#ifdef BRANDING
" (" BRANDING ")"
#endif
"\n");
exit(EXIT_SUCCESS);
}
/* Run our built in applets. If we ran one, we don't return. */
run_applets(argc, argv);
@ -905,8 +893,8 @@ main(int argc, char **argv)
}
exit(EXIT_SUCCESS);
/* NOTREACHED */
case_RC_COMMON_GETOPT
}
case_RC_COMMON_GETOPT
}
}
newlevel = argv[optind++];