summaryrefslogtreecommitdiffstats
path: root/cmd-string.c
authornicm <nicm>2008-06-19 21:20:24 (GMT)
committer nicm <nicm>2008-06-19 21:20:24 (GMT)
commitb932fabecc500aae94c01f36f58733d9c862a63e (patch) (side-by-side diff)
treedf19f0e3e50d09eae70e268e588fe9c3b6587760 /cmd-string.c
parent2e52ccecc25ceed89995496ebf42c5b5996e1d49 (diff)
downloadtmux-old-b932fabecc500aae94c01f36f58733d9c862a63e.zip
tmux-old-b932fabecc500aae94c01f36f58733d9c862a63e.tar.gz
tmux-old-b932fabecc500aae94c01f36f58733d9c862a63e.tar.bz2
Handle commented lines.
Diffstat (limited to 'cmd-string.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cmd-string.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/cmd-string.c b/cmd-string.c
index d0a87e4..9da8a5a 100644
--- a/cmd-string.c
+++ b/cmd-string.c
@@ -39,6 +39,10 @@ cmd_string_getc(const char *s, size_t *p)
return (s[(*p)++]);
}
+/*
+ * Parse command string. Return command or NULL on error. If returning NULL,
+ * cause is error string, or NULL for empty command.
+ */
struct cmd *
cmd_string_parse(const char *s, char **cause)
{
@@ -56,6 +60,8 @@ cmd_string_parse(const char *s, char **cause)
cmd = NULL;
+ *cause = NULL;
+
p = 0;
for (;;) {
ch = cmd_string_getc(s, &p);
@@ -94,7 +100,7 @@ cmd_string_parse(const char *s, char **cause)
if (ch != EOF)
break;
if (argc == 0)
- goto error;
+ goto out;
cmd = cmd_parse(argc, argv, cause);
goto out;