From ccaad0202dab92b015ead706ba551b0143fc7d78 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Thu, 14 Sep 2023 17:55:47 -0700 Subject: [PATCH] Handle blank lines --- uniqt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } -- 2.44.1