From: Scott Worley Date: Fri, 15 Sep 2023 00:55:47 +0000 (-0700) Subject: Handle blank lines X-Git-Tag: v1.0.0~5 X-Git-Url: http://git.scottworley.com/uniqt/commitdiff_plain/ccaad0202dab92b015ead706ba551b0143fc7d78?ds=sidebyside Handle blank lines --- diff --git a/uniqt.c b/uniqt.c index 2b7d229..b755f4e 100644 --- a/uniqt.c +++ b/uniqt.c @@ -1,4 +1,4 @@ -#define _POSIX_C_SOURCE 199309L +#define _POSIX_C_SOURCE 200809L #include #include @@ -44,6 +44,8 @@ static char *read_line() { int newline = getchar(); if (newline != EOF && newline != (int)'\n') die("Expected newline"); + if (scanf_ret == 0 && newline == (int)'\n') + return strdup("\n"); return line; }