[hackers] [dmenu] fixed a bug when dmenu is run with -v

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Fri Feb 23 14:40:25 2007

changeset: 175:27843b6669d6
tag: tip
user: Anselm R. Garbe <arg_AT_suckless.org>
date: Fri Feb 23 14:39:54 2007 +0100
summary: fixed a bug when dmenu is run with -v

diff -r 7f737dfe785e -r 27843b6669d6 config.mk
--- a/config.mk Fri Feb 23 13:51:23 2007 +0100
+++ b/config.mk Fri Feb 23 14:39:54 2007 +0100
@@ -1,5 +1,5 @@
 # dmenu version
-VERSION = 2.4.2
+VERSION = 2.5
 
 # Customize below to fit your system
 
diff -r 7f737dfe785e -r 27843b6669d6 main.c
--- a/main.c Fri Feb 23 13:51:23 2007 +0100
+++ b/main.c Fri Feb 23 14:39:54 2007 +0100
@@ -418,7 +418,9 @@ main(int argc, char *argv[]) {
         XModifierKeymap *modmap;
         XSetWindowAttributes wa;
 
- if(isatty(STDIN_FILENO)) {
+ if(argc == 2 && !strncmp("-v", argv[1], 3))
+ eprint("dmenu-"VERSION", (C)opyright MMVI-MMVII Anselm R. Garbe\n");
+ else if(isatty(STDIN_FILENO)) {
                 fputs("error: dmenu can't run in an interactive shell\n", stdout);
                 usage();
         }
@@ -445,8 +447,6 @@ main(int argc, char *argv[]) {
                 else if(!strncmp(argv[i], "-sf", 4)) {
                         if(++i < argc) selfg = argv[i];
                 }
- else if(!strncmp(argv[i], "-v", 3))
- eprint("dmenu-"VERSION", (C)opyright MMVI-MMVII Anselm R. Garbe\n");
                 else
                         usage();
         setlocale(LC_CTYPE, "");
Received on Fri Feb 23 2007 - 14:40:25 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:55:49 UTC