diff options
author | Ian C <ianc@noddybox.co.uk> | 2016-09-01 21:46:03 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2016-09-01 21:46:03 +0000 |
commit | d1b2a8b7d86d8b02f635b112a7f39e7437eac829 (patch) | |
tree | 867c25357777c52bcb420703545adf06dd3a414a | |
parent | e1ce7b5717333e96991c93f70a908d561616ad43 (diff) |
Added line length check.
-rw-r--r-- | ascii2map.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ascii2map.c b/ascii2map.c index 298f742..30a2c44 100644 --- a/ascii2map.c +++ b/ascii2map.c @@ -201,6 +201,8 @@ int main(int argc, char *argv[]) char line[1024]; int f; int in_map = 0; + size_t len = 0; + int warned = 0; f = 1; @@ -302,6 +304,19 @@ int main(int argc, char *argv[]) { char *p; + if (len == 0) + { + len = strlen(line); + } + else + { + if (!warned && len != strlen(line)) + { + fprintf(stderr, "WARNING: Lines of different length\n"); + warned = 1; + } + } + p = line; while(*p) |