aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-02-08 16:38:19 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-02-08 16:38:19 +0000
commitdd1ebf1b9d2a95a1897a0d3be30883acfba295c0 (patch)
tree2b1abd99f92891f5b15628d527e63d9d2fb5b718
parentb23581583145d31b48e8dc836a943c803033eeec (diff)
downloadrtmux-dd1ebf1b9d2a95a1897a0d3be30883acfba295c0.tar.gz
rtmux-dd1ebf1b9d2a95a1897a0d3be30883acfba295c0.tar.bz2
rtmux-dd1ebf1b9d2a95a1897a0d3be30883acfba295c0.zip
Handle "" properly.
-rw-r--r--CHANGES4
-rw-r--r--cmd-string.c18
2 files changed, 18 insertions, 4 deletions
diff --git a/CHANGES b/CHANGES
index a8c787cd..b15d5b37 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,7 @@
08 February 2009
+* Don't treat empty arguments ("") differently when parsing configuration
+ file/command prompt rather than command line.
* tmux 0.7 released.
03 February 2009
@@ -1083,7 +1085,7 @@
(including mutt, emacs). No status bar yet and no key remapping or other
customisation.
-$Id: CHANGES,v 1.248 2009-02-08 14:11:37 nicm Exp $
+$Id: CHANGES,v 1.249 2009-02-08 16:38:19 nicm Exp $
LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr
LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms
diff --git a/cmd-string.c b/cmd-string.c
index 2d7c5df0..abe9222e 100644
--- a/cmd-string.c
+++ b/cmd-string.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-string.c,v 1.11 2009-01-18 14:40:48 nicm Exp $ */
+/* $Id: cmd-string.c,v 1.12 2009-02-08 16:38:19 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -56,7 +56,7 @@ int
cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
{
size_t p;
- int ch, argc, rval;
+ int ch, argc, rval, have_arg;
char **argv, *buf, *t, *u;
size_t len;
@@ -77,6 +77,8 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
buf = NULL;
len = 0;
+ have_arg = 0;
+
*cause = NULL;
*cmdlist = NULL;
@@ -92,6 +94,8 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
buf = xrealloc(buf, 1, len + strlen(t) + 1);
strlcpy(buf + len, t, strlen(t) + 1);
len += strlen(t);
+
+ have_arg = 1;
break;
case '"':
if ((t = cmd_string_string(s, &p, '"', 1)) == NULL)
@@ -99,6 +103,8 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
buf = xrealloc(buf, 1, len + strlen(t) + 1);
strlcpy(buf + len, t, strlen(t) + 1);
len += strlen(t);
+
+ have_arg = 1;
break;
case '$':
if ((t = cmd_string_variable(s, &p)) == NULL)
@@ -106,6 +112,8 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
buf = xrealloc(buf, 1, len + strlen(t) + 1);
strlcpy(buf + len, t, strlen(t) + 1);
len += strlen(t);
+
+ have_arg = 1;
break;
case '#':
/* Comment: discard rest of line. */
@@ -115,7 +123,7 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
case EOF:
case ' ':
case '\t':
- if (len != 0) {
+ if (have_arg) {
buf = xrealloc(buf, 1, len + 1);
buf[len] = '\0';
@@ -124,6 +132,8 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
buf = NULL;
len = 0;
+
+ have_arg = 0;
}
if (ch != EOF)
@@ -143,6 +153,8 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
buf = xrealloc(buf, 1, len + 1);
buf[len++] = ch;
+
+ have_arg = 1;
break;
}
}