summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/arguments.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2020-04-12 20:54:29 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2020-04-12 20:54:29 +0000
commit9ba88df2c8077065e3029ca1d72ef95720c5dfdf (patch)
treee264f0f4345f1f1cd8b551ec46e4ff32e4e5a062 /usr.bin/tmux/arguments.c
parente764a5c45de5fe4e43f143561283ef025128b681 (diff)
Print empty arguments properly.
Diffstat (limited to 'usr.bin/tmux/arguments.c')
-rw-r--r--usr.bin/tmux/arguments.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/tmux/arguments.c b/usr.bin/tmux/arguments.c
index c59564e86ee..7ae81a45180 100644
--- a/usr.bin/tmux/arguments.c
+++ b/usr.bin/tmux/arguments.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arguments.c,v 1.29 2020/03/21 13:16:15 nicm Exp $ */
+/* $OpenBSD: arguments.c,v 1.30 2020/04/12 20:54:28 nicm Exp $ */
/*
* Copyright (c) 2010 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -216,8 +216,10 @@ args_escape(const char *s)
char *escaped, *result;
int flags;
- if (*s == '\0')
- return (xstrdup(s));
+ if (*s == '\0') {
+ xasprintf(&result, "''");
+ return (result);
+ }
if (s[0] != ' ' &&
(strchr(quoted, s[0]) != NULL || s[0] == '~') &&
s[1] == '\0') {