summaryrefslogtreecommitdiff
path: root/parser.c
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2017-12-28 20:43:30 +1300
committerDavid Phillips <david@sighup.nz>2017-12-28 20:43:30 +1300
commitb6a3052c3ebde6114ec6166971b3072460c44814 (patch)
tree9a36552c07e6fea22c597616229ffd79e437aef2 /parser.c
parent7823d9c7e4f3c0485e8d96e44e0d94541762c6d1 (diff)
downloadhence-b6a3052c3ebde6114ec6166971b3072460c44814.tar.xz
Add more tests, fix misc bugs found
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/parser.c b/parser.c
index 5b96739..822441c 100644
--- a/parser.c
+++ b/parser.c
@@ -146,9 +146,12 @@ int
parse_input(char *str) {
strtok(str, " ");
str = eat_whitespace(str);
+ if (strlen(str) == 0) {
+ emit_error("input label must not be empty");
+ return 1;
+ }
emit_info("Add input '%s'\n", str);
- gate_input_add(str);
- return 0;
+ return gate_input_add(str);
}
int
@@ -164,6 +167,8 @@ parse_line(char *line) {
char *delim = " ";
int match = 0;
+ line[strcspn(line, "\r\n")] = '\0';
+
if ( strlen(line) == 0
|| (strlen(line) == 1 && isspace(line[0]))) {
return 0;