summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-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;