[wiki] [sites] [dmenu][patch][separator] code-style: slight cleanups || NRK
commit 09389ee838d3a39ebac85020d91bd53b75daa34c
Author: NRK <nrk_AT_disroot.org>
Date: Sun Oct 17 21:39:05 2021 +0600
[dmenu][patch][separator] code-style: slight cleanups
diff --git a/tools.suckless.org/dmenu/patches/separator/dmenu-separator-20210904-d78ff08.diff b/tools.suckless.org/dmenu/patches/separator/dmenu-separator-20210904-d78ff08.diff
index 25e1fb3e..be304204 100644
--- a/tools.suckless.org/dmenu/patches/separator/dmenu-separator-20210904-d78ff08.diff
+++ b/tools.suckless.org/dmenu/patches/separator/dmenu-separator-20210904-d78ff08.diff
_AT_@ -1,5 +1,5 @@
diff --git a/dmenu.1 b/dmenu.1
-index f9e0db7..af3a6f5 100644
+index 323f93c..d511148 100644
--- a/dmenu.1
+++ b/dmenu.1
_AT_@ -22,6 +22,10 @@ dmenu \- dynamic menu
_AT_@ -13,7 +13,7 @@ index f9e0db7..af3a6f5 100644
.P
.BR dmenu_run " ..."
.SH DESCRIPTION
-_AT_@ -83,6 +87,14 @@ prints version information to stdout, then exits.
+_AT_@ -80,6 +84,14 @@ prints version information to stdout, then exits.
.TP
.BI \-w " windowid"
embed into windowid.
_AT_@ -29,7 +29,7 @@ index f9e0db7..af3a6f5 100644
dmenu is completely controlled by the keyboard. Items are selected using the
arrow keys, page up, page down, home, and end.
diff --git a/dmenu.c b/dmenu.c
-index 98507d9..2ac2c9a 100644
+index 98507d9..82227c8 100644
--- a/dmenu.c
+++ b/dmenu.c
_AT_@ -30,12 +30,16 @@ enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */
_AT_@ -62,28 +62,26 @@ index 98507d9..2ac2c9a 100644
*p = ' if (!(items[i].text = strdup(buf)))
die("cannot strdup %u bytes:", strlen(buf) + 1);
-+ if (separator && (p = (separator_greedy) ?
-+ strrchr(items[i].text, separator) : strchr(items[i].text, separator))) {
++ if (separator && (p = separator_greedy ?
++ strrchr(items[i].text, separator) : strchr(items[i].text, separator))) {
+ *p = ' + items[i].text_output = ++p;
+ } else {
+ items[i].text_output = items[i].text;
+ }
+ if (separator_reverse) {
-+ char *tmp = items[i].text;
++ p = items[i].text;
+ items[i].text = items[i].text_output;
-+ items[i].text_output = tmp;
++ items[i].text_output = p;
+ }
items[i].out = 0;
drw_font_getexts(drw->fonts, buf, strlen(buf), &tmpmax, NULL);
if (tmpmax > inputw) {
-_AT_@ -700,8 +716,9 @@ setup(void)
- static void
+_AT_@ -701,7 +717,8 @@ static void
usage(void)
{
-- fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]
"
+ fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]
"
- " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]
", stderr);
-+ fputs("usage: dmenu [-bfinv] [-l lines] [-p prompt] [-fn font] [-m monitor]
"
+ " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]
"
+ " [-d separator] [-D separator]
", stderr);
exit(1);
_AT_@ -93,10 +91,10 @@ index 98507d9..2ac2c9a 100644
colors[SchemeSel][ColFg] = argv[++i];
else if (!strcmp(argv[i], "-w")) /* embedding window id */
embed = argv[++i];
-+ else if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "-D")) { /* field separator */
-+ separator_reverse = (*(argv[i+1]+1) == '|');
-+ separator_greedy = !strcmp(argv[i], "-D");
-+ separator = *argv[++i];
++ else if (!strcmp(argv[i], "-d") || /* field separator */
++ (separator_greedy = !strcmp(argv[i], "-D"))) {
++ separator = argv[++i][0];
++ separator_reverse = argv[i][1] == '|';
+ }
else
usage();
Received on Sun Oct 17 2021 - 17:40:56 CEST
This archive was generated by hypermail 2.3.0
: Sun Oct 17 2021 - 17:48:43 CEST