summaryrefslogtreecommitdiffstats
path: root/src/daemon/abrt-server.c
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2010-10-12 14:39:31 +0200
committerDenys Vlasenko <dvlasenk@redhat.com>2010-10-12 14:39:31 +0200
commit0bf035eaac1106c3eb6daecb277c193c9160d1af (patch)
treeccae87d00f91b9e3e68b3070f5dab3027d1891d4 /src/daemon/abrt-server.c
parent4d68ae093b68bd857165cc249deb3486f81966bf (diff)
Return a bitmask of found options from parse_opts()
This patch makes it easier to analyze "bool" type options - now they are all just bits in a single return value, no need to have an integer variable for each option. The previous behavior is retained too: it is useful for "cumulative" options like -vvv. The patch also removes all OPT_GROUPs. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src/daemon/abrt-server.c')
-rw-r--r--src/daemon/abrt-server.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/daemon/abrt-server.c b/src/daemon/abrt-server.c
index b25d431d..4da0fc58 100644
--- a/src/daemon/abrt-server.c
+++ b/src/daemon/abrt-server.c
@@ -277,15 +277,18 @@ static void process_message(const char *message)
static void dummy_handler(int sig_unused) {}
-static int s_opt;
+enum {
+ OPT_v = 1 << 0,
+ OPT_u = 1 << 1,
+ OPT_s = 1 << 2,
+};
static const char abrt_server_usage[] = "abrt-server [options]";
static struct options abrt_server_options[] = {
OPT__VERBOSE(&g_verbose),
- OPT_GROUP(""),
OPT_INTEGER( 'u' , 0, &client_uid, "Use UID as client uid"),
- OPT_BOOL( 's' , 0, &s_opt, "Log to syslog"),
+ OPT_BOOL( 's' , 0, NULL, "Log to syslog"),
OPT_END()
};
@@ -295,12 +298,12 @@ int main(int argc, char **argv)
if (env_verbose)
g_verbose = atoi(env_verbose);
- parse_opts(argc, argv, abrt_server_options,
+ unsigned opts = parse_opts(argc, argv, abrt_server_options,
abrt_server_usage);
putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose));
msg_prefix = xasprintf("abrt-server[%u]", getpid());
- if (s_opt)
+ if (opts & OPT_s)
{
openlog(msg_prefix, 0, LOG_DAEMON);
logmode = LOGMODE_SYSLOG;