From 3184bf12563cdf66f158891767a5fe210be73b7d Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 29 Jan 2008 17:20:32 +0100 Subject: [PATCH] Use getopt_long properly Get rid of redundant code and execution time. --- awesome-message.c | 11 +++-------- 1 files changed, 3 insertions(+), 8 deletions(-) diff --git a/awesome-message.c b/awesome-message.c index b476116..7df8fb9 100644 --- a/awesome-message.c +++ b/awesome-message.c @@ -54,9 +54,9 @@ main(int argc, char **argv) XftFont *font = NULL; int option_index = 0; static struct option long_options[] = { - {"help", 0, NULL, 0}, - {"version", 0, NULL, 0}, - {NULL, 0, NULL, 0} + {"help", 0, NULL, 'h'}, + {"version", 0, NULL, 'v'}, + {NULL, 0, NULL, 0} }; if(!(disp = XOpenDisplay(NULL))) @@ -66,11 +66,6 @@ main(int argc, char **argv) long_options, &option_index)) != -1) switch(opt) { - case 0: - if (!a_strcmp("help", long_options[option_index].name)) - exit_help(EXIT_SUCCESS); - else if (!a_strcmp("version", long_options[option_index].name)) - eprint_version("awmessage"); case 'v': eprint_version("awmessage"); break; -- 1.5.3.8