mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
Handle "" properly.
This commit is contained in:
parent
b235815831
commit
dd1ebf1b9d
4
CHANGES
4
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
|
||||
|
18
cmd-string.c
18
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user