Use getopt_long properly

Get rid of redundant code and execution time.

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Hans Ulrich Niedermann 2008-01-29 17:20:32 +01:00 committed by Julien Danjou
parent 6dd1c20816
commit 28e6abcb34
1 changed files with 3 additions and 8 deletions

View File

@ -54,8 +54,8 @@ main(int argc, char **argv)
XftFont *font = NULL; XftFont *font = NULL;
int option_index = 0; int option_index = 0;
static struct option long_options[] = { static struct option long_options[] = {
{"help", 0, NULL, 0}, {"help", 0, NULL, 'h'},
{"version", 0, NULL, 0}, {"version", 0, NULL, 'v'},
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
@ -66,11 +66,6 @@ main(int argc, char **argv)
long_options, &option_index)) != -1) long_options, &option_index)) != -1)
switch(opt) 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': case 'v':
eprint_version("awmessage"); eprint_version("awmessage");
break; break;