summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Jones <philj56@gmail.com>2022-07-28 05:38:18 +0100
committerPhil Jones <philj56@gmail.com>2022-07-29 14:32:25 +0100
commitfc0f5a60065384259a31d37d9d2709010ad92910 (patch)
treefca30b635af15a8455a593311d9ff969915d7fde
parent029fa1a3a0e096ce95103e068643c44040bd9d81 (diff)
Fix drun mode when args come after a field code.
-rw-r--r--src/drun.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/drun.c b/src/drun.c
index c4a32e2..3ab42d0 100644
--- a/src/drun.c
+++ b/src/drun.c
@@ -305,10 +305,8 @@ void drun_print(const char *filename)
/* Add the string up to here to our vector. */
search[0] = '\0';
string_vec_add(&pieces, last);
- search++;
- last = search;
- switch (search[0]) {
+ switch (search[1]) {
case 'i':
if (g_key_file_has_key(file, group, "Icon", NULL)) {
string_vec_add(&pieces, "--icon ");
@@ -322,18 +320,15 @@ void drun_print(const char *filename)
string_vec_add(&pieces, filename);
break;
}
+
+ search += 2;
+ last = search;
}
- if (last == exec) {
- /*
- * We didn't find any field codes, so just use the full exec
- * string.
- */
- fputs(exec, stdout);
- } else {
- /* Build the command line from our vector. */
- for (size_t i = 0; i < pieces.count; i++) {
- fputs(pieces.buf[i].string, stdout);
- }
+ string_vec_add(&pieces, last);
+
+ /* Build the command line from our vector. */
+ for (size_t i = 0; i < pieces.count; i++) {
+ fputs(pieces.buf[i].string, stdout);
}
fputc('\n', stdout);