[hackers] [dmenu] moved main, updated args || Connor Lane Smith

From: <hg_AT_suckless.org>
Date: Wed, 17 Nov 2010 04:33:34 +0000 (UTC)

changeset: 378:17447c90c57e
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Wed Nov 17 04:33:34 2010 +0000
files: dmenu.1 dmenu.c
description:
moved main, updated args

diff -r 63ed86209bdc -r 17447c90c57e dmenu.1
--- a/dmenu.1 Fri Nov 12 00:30:03 2010 +0000
+++ b/dmenu.1 Wed Nov 17 04:33:34 2010 +0000
@@ -7,6 +7,8 @@
 .RB [ \-i ]
 .RB [ \-l
 .IR lines ]
+.RB [ \-m
+.IR monitor ]
 .RB [ \-p
 .IR prompt ]
 .RB [ \-fn
@@ -51,6 +53,9 @@
 .BI \-l " lines"
 dmenu lists items vertically, with the given number of lines.
 .TP
+.BI \-m " monitor"
+dmenu appears on the given Xinerama screen.
+.TP
 .BI \-p " prompt"
 defines the prompt to be displayed to the left of the input field.
 .TP
diff -r 63ed86209bdc -r 17447c90c57e dmenu.c
--- a/dmenu.c Fri Nov 12 00:30:03 2010 +0000
+++ b/dmenu.c Wed Nov 17 04:33:34 2010 +0000
@@ -63,6 +63,52 @@
 
 static int (*fstrncmp)(const char *, const char *, size_t) = strncmp;
 
+int
+main(int argc, char *argv[]) {
+ int i;
+
+ progname = "dmenu";
+ for(i = 1; i < argc; i++)
+ /* single flags */
+ if(!strcmp(argv[i], "-v")) {
+ fputs("dmenu-"VERSION", © 2006-2010 dmenu engineers, see LICENSE for details\n", stdout);
+ exit(EXIT_SUCCESS);
+ }
+ else if(!strcmp(argv[i], "-b"))
+ topbar = False;
+ else if(!strcmp(argv[i], "-i"))
+ fstrncmp = strncasecmp;
+ else if(i == argc-1)
+ usage();
+ /* double flags */
+ else if(!strcmp(argv[i], "-l"))
+ lines = atoi(argv[++i]);
+ else if(!strcmp(argv[i], "-m"))
+ monitor = atoi(argv[++i]);
+ else if(!strcmp(argv[i], "-p"))
+ prompt = argv[++i];
+ else if(!strcmp(argv[i], "-fn"))
+ font = argv[++i];
+ else if(!strcmp(argv[i], "-nb"))
+ normbgcolor = argv[++i];
+ else if(!strcmp(argv[i], "-nf"))
+ normfgcolor = argv[++i];
+ else if(!strcmp(argv[i], "-sb"))
+ selbgcolor = argv[++i];
+ else if(!strcmp(argv[i], "-sf"))
+ selfgcolor = argv[++i];
+ else
+ usage();
+
+ dc = initdc();
+ initfont(dc, font);
+ readstdin();
+ setup();
+ run();
+
+ return EXIT_FAILURE; /* should not reach */
+}
+
 void
 appenditem(Item *item, Item **list, Item **last) {
         if(!*last)
@@ -490,53 +536,7 @@
 
 void
 usage(void) {
- fputs("usage: dmenu [-b] [-i] [-l lines] [-p prompt] [-fn font] [-nb color]\n"
- " [-nf color] [-sb color] [-sf color] [-v]\n", stderr);
+ fputs("usage: dmenu [-b] [-i] [-l lines] [-m monitor] [-p prompt] [-fn font]\n"
+ " [-nb color] [-nf color] [-sb color] [-sf color] [-v]\n", stderr);
         exit(EXIT_FAILURE);
 }
-
-int
-main(int argc, char *argv[]) {
- int i;
-
- progname = "dmenu";
- for(i = 1; i < argc; i++)
- /* single flags */
- if(!strcmp(argv[i], "-v")) {
- fputs("dmenu-"VERSION", © 2006-2010 dmenu engineers, see LICENSE for details\n", stdout);
- exit(EXIT_SUCCESS);
- }
- else if(!strcmp(argv[i], "-b"))
- topbar = False;
- else if(!strcmp(argv[i], "-i"))
- fstrncmp = strncasecmp;
- else if(i == argc-1)
- usage();
- /* double flags */
- else if(!strcmp(argv[i], "-l"))
- lines = atoi(argv[++i]);
- else if(!strcmp(argv[i], "-m"))
- monitor = atoi(argv[++i]);
- else if(!strcmp(argv[i], "-p"))
- prompt = argv[++i];
- else if(!strcmp(argv[i], "-fn"))
- font = argv[++i];
- else if(!strcmp(argv[i], "-nb"))
- normbgcolor = argv[++i];
- else if(!strcmp(argv[i], "-nf"))
- normfgcolor = argv[++i];
- else if(!strcmp(argv[i], "-sb"))
- selbgcolor = argv[++i];
- else if(!strcmp(argv[i], "-sf"))
- selfgcolor = argv[++i];
- else
- usage();
-
- dc = initdc();
- initfont(dc, font);
- readstdin();
- setup();
- run();
-
- return EXIT_FAILURE; /* should not reach */
-}
Received on Wed Nov 17 2010 - 05:33:34 CET

This archive was generated by hypermail 2.2.0 : Wed Nov 17 2010 - 05:36:04 CET