diff options
author | William Hubbs <williamh@gentoo.org> | 2011-02-12 19:15:29 -0600 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2011-02-14 18:40:05 -0600 |
commit | 73d1a8698e101b1dcf589b27b35ac9b09ea6d02c (patch) | |
tree | c1ab7cbb6370d43c20f87ca0480f18731ecc0ed1 /src/rc/_usage.c | |
parent | bae0a693a9271b3ed0f723fdafc22efe5f07b70e (diff) |
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.
Diffstat (limited to 'src/rc/_usage.c')
-rw-r--r-- | src/rc/_usage.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/rc/_usage.c b/src/rc/_usage.c index ec1ce1d3..175634af 100644 --- a/src/rc/_usage.c +++ b/src/rc/_usage.c @@ -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 @@ -34,6 +36,22 @@ #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) { const char * const has_arg[] = { "", "<arg>", "[arg]" }; |