summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--notemap.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/notemap.c b/notemap.c
index 963cd0a..2b0fe3b 100644
--- a/notemap.c
+++ b/notemap.c
@@ -394,9 +394,13 @@ int main(int argc, char *argv[]) {
 			break; case Next: {
 				ssize_t len;
 next:
-				// FIXME: Handle EOF.
 				len = getline(&entry, &entryCap, map);
-				if (len < 0) err(EX_IOERR, "%s", path);
+				if (ferror(map)) err(EX_IOERR, "%s", path);
+				if (len < 1) {
+					fprintf(imap, "ayy LOGOUT\r\n");
+					fclose(imap);
+					return EX_OK;
+				}
 				if (entry[len - 1] == '\n') entry[len - 1] = '\0';
 
 				note = entry;
roe 2019-12-18Bail from hi if input is binaryJune McEnroe NULs in the input cause an infinite loop in htmlEscape, not to mention regexes obviously not working, etc. 2019-12-16Post "cgit setup"June McEnroe