summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/arguments.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2020-06-04 07:12:06 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2020-06-04 07:12:06 +0000
commit10646ca6ccc4c522cb1694d2ad975be2cac96f4f (patch)
treef2dde6277a6f5f4dcab38b7af7219a9202d94a00 /usr.bin/tmux/arguments.c
parentb212416942e2f3a1215ec9f47edab7ca780b9e01 (diff)
Instead of using a custom parse function to process {}, treat it as a
set of statements and parse with yacc, then convert back to a string as the last step. This means the rules are consistent inside and outside {}, %if and friends work at the right time, and the final result isn't littered with unnecessary newlines.
Diffstat (limited to 'usr.bin/tmux/arguments.c')
-rw-r--r--usr.bin/tmux/arguments.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/tmux/arguments.c b/usr.bin/tmux/arguments.c
index da92c77efd3..750fcd3ce55 100644
--- a/usr.bin/tmux/arguments.c
+++ b/usr.bin/tmux/arguments.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arguments.c,v 1.33 2020/05/25 18:17:14 nicm Exp $ */
+/* $OpenBSD: arguments.c,v 1.34 2020/06/04 07:12:05 nicm Exp $ */
/*
* Copyright (c) 2010 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -227,6 +227,11 @@ args_escape(const char *s)
return (escaped);
}
+ if (strchr(s, ' ') != NULL && strchr(s, '\'') == NULL) {
+ xasprintf(&escaped, "'%s'", s);
+ return (escaped);
+ }
+
flags = VIS_OCTAL|VIS_CSTYLE|VIS_TAB|VIS_NL;
if (s[strcspn(s, quoted)] != '\0')
flags |= VIS_DQ;