summaryrefslogtreecommitdiff
path: root/src/socket-proxy
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-06 18:28:39 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-06 18:28:39 +0100
commiteb9da376d76b48585b3b63b4f91903b54f7abd36 (patch)
treef58957844d6248d2df547727a4bfbd1b81c2ef97 /src/socket-proxy
parent4087cb9e8fb90957d90d577e62e8ba056c2258cf (diff)
clients: unify how we invoke getopt_long()
Among other things this makes sure we always expose a --version command and show it in the help texts.
Diffstat (limited to 'src/socket-proxy')
-rw-r--r--src/socket-proxy/socket-proxyd.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c
index 05ea88ac69..8f60ab88f1 100644
--- a/src/socket-proxy/socket-proxyd.c
+++ b/src/socket-proxy/socket-proxyd.c
@@ -37,6 +37,7 @@
#include "socket-util.h"
#include "util.h"
#include "event-util.h"
+#include "build.h"
#define BUFFER_SIZE 16384
#define _cleanup_freeaddrinfo_ _cleanup_(freeaddrinfop)
@@ -511,10 +512,6 @@ static int help(void) {
return 0;
}
-static void version(void) {
- puts(PACKAGE_STRING " socket-proxyd");
-}
-
static int parse_argv(int argc, char *argv[], struct proxy *p) {
enum {
@@ -526,7 +523,7 @@ static int parse_argv(int argc, char *argv[], struct proxy *p) {
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, ARG_VERSION },
{ "ignore-env", no_argument, NULL, ARG_IGNORE_ENV},
- { NULL, 0, NULL, 0 }
+ {}
};
int c;
@@ -539,23 +536,22 @@ static int parse_argv(int argc, char *argv[], struct proxy *p) {
switch (c) {
case 'h':
- help();
- return 0;
-
- case '?':
- return -EINVAL;
+ return help();
case ARG_VERSION:
- version();
+ puts(PACKAGE_STRING);
+ puts(SYSTEMD_FEATURES);
return 0;
case ARG_IGNORE_ENV:
p->ignore_env = true;
continue;
- default:
- log_error("Unknown option code %c", c);
+ case '?':
return -EINVAL;
+
+ default:
+ assert_not_reached("Unhandled option");
}
}