Implement --version/-v parameter
This commit is contained in:
parent
7bc1e2cd4c
commit
aedbf650ef
11
i3status.c
11
i3status.c
@ -181,6 +181,7 @@ int main(int argc, char *argv[]) {
|
|||||||
struct option long_options[] = {
|
struct option long_options[] = {
|
||||||
{"config", required_argument, 0, 'c'},
|
{"config", required_argument, 0, 'c'},
|
||||||
{"help", no_argument, 0, 'h'},
|
{"help", no_argument, 0, 'h'},
|
||||||
|
{"version", no_argument, 0, 'v'},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -195,15 +196,19 @@ int main(int argc, char *argv[]) {
|
|||||||
if ((configfile = file_exists("~/.i3status.conf")) == NULL)
|
if ((configfile = file_exists("~/.i3status.conf")) == NULL)
|
||||||
configfile = file_exists(PREFIX "/etc/i3status.conf");
|
configfile = file_exists(PREFIX "/etc/i3status.conf");
|
||||||
|
|
||||||
while ((o = getopt_long(argc, argv, "c:h", long_options, &option_index)) != -1)
|
while ((o = getopt_long(argc, argv, "c:hv", long_options, &option_index)) != -1)
|
||||||
if ((char)o == 'c')
|
if ((char)o == 'c')
|
||||||
configfile = optarg;
|
configfile = optarg;
|
||||||
else if ((char)o == 'h') {
|
else if ((char)o == 'h') {
|
||||||
printf("i3status © 2008-2009 Michael Stapelberg\n"
|
printf("i3status " VERSION " © 2008-2010 Michael Stapelberg and contributors\n"
|
||||||
"Syntax: %s [-c <configfile>]\n", argv[0]);
|
"Syntax: %s [-c <configfile>] [-h] [-v]\n", argv[0]);
|
||||||
|
return 0;
|
||||||
|
} else if ((char)o == 'v') {
|
||||||
|
printf("i3status " VERSION " © 2008-2010 Michael Stapelberg and contributors\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (configfile == NULL)
|
if (configfile == NULL)
|
||||||
die("No configuration file found\n");
|
die("No configuration file found\n");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user