summaryrefslogtreecommitdiffstats
path: root/cmd-string.c
authortcunha <tcunha>2010-02-26 13:27:38 (GMT)
committer tcunha <tcunha>2010-02-26 13:27:38 (GMT)
commitf08ebe19001eee6d7f527499f58ce17189780563 (patch) (side-by-side diff)
tree8fdd4fc04a1c5657b90fd10232c46ed915295d0c /cmd-string.c
parentde79134064885494d76dc81535f15ef8c4169f3e (diff)
downloadtmux-old-f08ebe19001eee6d7f527499f58ce17189780563.zip
tmux-old-f08ebe19001eee6d7f527499f58ce17189780563.tar.gz
tmux-old-f08ebe19001eee6d7f527499f58ce17189780563.tar.bz2
Sync OpenBSD patchset 649:
have_arg matches buf so it is no longer necessary, spotted by Tim van der Molen.
Diffstat (limited to 'cmd-string.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cmd-string.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/cmd-string.c b/cmd-string.c
index 4e49971..533e0dd 100644
--- a/cmd-string.c
+++ b/cmd-string.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-string.c,v 1.30 2010/02/02 23:53:36 tcunha Exp $ */
+/* $Id: cmd-string.c,v 1.31 2010/02/26 13:27:38 tcunha Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <[email protected]>
@@ -61,7 +61,7 @@ int
cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
{
size_t p;
- int ch, i, argc, rval, have_arg;
+ int ch, i, argc, rval;
char **argv, *buf, *t;
const char *whitespace, *equals;
size_t len;
@@ -72,8 +72,6 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
buf = NULL;
len = 0;
- have_arg = 0;
-
*cause = NULL;
*cmdlist = NULL;
@@ -90,8 +88,6 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
strlcpy(buf + len, t, strlen(t) + 1);
len += strlen(t);
xfree(t);
-
- have_arg = 1;
break;
case '"':
if ((t = cmd_string_string(s, &p, '"', 1)) == NULL)
@@ -100,8 +96,6 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
strlcpy(buf + len, t, strlen(t) + 1);
len += strlen(t);
xfree(t);
-
- have_arg = 1;
break;
case '$':
if ((t = cmd_string_variable(s, &p)) == NULL)
@@ -110,8 +104,6 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
strlcpy(buf + len, t, strlen(t) + 1);
len += strlen(t);
xfree(t);
-
- have_arg = 1;
break;
case '#':
/* Comment: discard rest of line. */
@@ -121,7 +113,7 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
case EOF:
case ' ':
case '\t':
- if (have_arg) {
+ if (buf != NULL) {
buf = xrealloc(buf, 1, len + 1);
buf[len] = '\0';
@@ -130,8 +122,6 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
buf = NULL;
len = 0;
-
- have_arg = 0;
}
if (ch != EOF)
@@ -156,7 +146,7 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
rval = 0;
goto out;
case '~':
- if (have_arg == 0) {
+ if (buf == NULL) {
if ((t = cmd_string_expand_tilde(s, &p)) == NULL)
goto error;
buf = xrealloc(buf, 1, len + strlen(t) + 1);
@@ -172,8 +162,6 @@ 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;
}
}