aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.l7
1 files changed, 7 insertions, 0 deletions
diff --git a/main.l b/main.l
index 3ccae4a..2d26cd0 100644
--- a/main.l
+++ b/main.l
@@ -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 ',':