diff options
author | cos <cos> | 2024-06-08 09:08:56 +0200 |
---|---|---|
committer | cos <cos> | 2024-06-08 09:14:12 +0200 |
commit | 9a96a1628b3e8689953f6f4db9d544c732af5916 (patch) | |
tree | b7ead14e7b26d777679b0aaece29c1005c724ebc | |
parent | e4b558fa9e063be7e1a48d4d90d3f69f4ad3df71 (diff) | |
download | mcwm-topic/version.zip |
Add -V option to output version numbertopic/version
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | mcwm.c | 16 |
2 files changed, 15 insertions, 3 deletions
@@ -3,7 +3,7 @@ DIST=mcwm-$(VERSION) SRC=mcwm.c list.c config.h events.h list.h hidden.c DISTFILES=LICENSE Makefile NEWS README TODO WISHLIST mcwm.man hidden.man scripts $(SRC) -CFLAGS+=-g -std=c99 -Wall -Wextra -I/usr/local/include #-DDEBUG #-DDMALLOC +CFLAGS+=-g -std=c99 -Wall -Wextra -I/usr/local/include -DVERSION='"$(VERSION)"' #-DDEBUG #-DDMALLOC LDFLAGS+=-L/usr/local/lib -lxcb -lxcb-randr -lxcb-keysyms -lxcb-icccm \ -lxcb-util #-ldmalloc @@ -371,6 +371,7 @@ static void configwin(xcb_window_t win, uint16_t mask, struct winconf wc); static void configurerequest(xcb_configure_request_event_t *e); static void events(void); static void printhelp(void); +static void printversion(void); static void sigcatch(int sig); static xcb_atom_t getatom(char *atom_name); @@ -4264,7 +4265,7 @@ void events(void) void printhelp(void) { printf("mcwm: Usage: mcwm [-b] [-s snapmargin] [-t terminal-program] " - "[-f colour] [-u colour] [-x colour] \n"); + "[-f colour] [-u colour] [-x colour] -V\n"); printf(" -b means draw no borders\n"); printf(" -s snapmargin in pixels\n"); printf(" -t urxvt will start urxvt when MODKEY + Return is pressed\n"); @@ -4272,6 +4273,12 @@ void printhelp(void) "to a named color.\n"); printf(" -u colour sets colour for unfocused window borders.\n"); printf(" -x color sets colour for fixed window borders.\n"); + printf(" -V merely prints mcwm's version string and exits immediatly.\n"); +} + +void printversion(void) +{ + printf("mcwm version: %s\n", VERSION); } void sigcatch(int sig) @@ -4351,7 +4358,7 @@ int main(int argc, char **argv) while (1) { - ch = getopt(argc, argv, "b:s:it:f:u:x:"); + ch = getopt(argc, argv, "b:s:it:f:u:x:V"); if (-1 == ch) { @@ -4391,6 +4398,11 @@ int main(int argc, char **argv) fixedcol = optarg; break; + case 'V': + printversion(); + exit(0); + break; + default: printhelp(); exit(0); |