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:
parent
6dd1c20816
commit
28e6abcb34
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue