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:
committed by
William Hubbs
parent
bae0a693a9
commit
73d1a8698e
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@@ -24,6 +24,8 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "version.h"
|
||||
|
||||
#if lint
|
||||
# define _noreturn
|
||||
#endif
|
||||
@@ -33,6 +35,22 @@
|
||||
# define _noreturn
|
||||
#endif
|
||||
|
||||
_noreturn static void
|
||||
show_version(void)
|
||||
{
|
||||
const char *bootlevel = NULL;
|
||||
|
||||
printf("%s (OpenRC", applet);
|
||||
if ((bootlevel = rc_sys()))
|
||||
printf(" [%s]", bootlevel);
|
||||
printf(") %s", VERSION);
|
||||
#ifdef BRANDING
|
||||
printf(" (%s)", BRANDING);
|
||||
#endif
|
||||
printf("\n");
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
_noreturn static void
|
||||
usage(int exit_status)
|
||||
{
|
||||
|
Reference in New Issue
Block a user