diff options
-rw-r--r-- | main.l | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -12,6 +12,8 @@ const char empty_field[] = "argument to the -p option contains an empty field"; const char invalid_char[] = "argument to the -p option must be a " "comma-seperated list of positive integers"; const char final_comma[] = "argument to the -p option contains trailing comma"; +const char empty_string[] = "argument to the -p option cannot be " + "the empty string"; const char *argv0; unsigned pos; @@ -102,6 +104,11 @@ append_positions(char *raw) usage(); } + if (*raw == '\0') { + warnx(empty_string); + usage(); + } + for (s = raw, positions.len++; *s; s++) { switch (*s) { case ',': |