summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--mcwm.c16
2 files changed, 15 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index ce0d71d..460dca3 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/mcwm.c b/mcwm.c
index 4cd773f..6a2e6ce 100644
--- a/mcwm.c
+++ b/mcwm.c
@@ -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);