diff options
author | June McEnroe <june@causal.agency> | 2020-01-26 19:04:14 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-01-26 19:04:14 -0500 |
commit | dc77a612c1655fd59cba11a6a8e9472f488f20c4 (patch) | |
tree | 8f428cdb6a6422d966adb939c625e158797ec7b7 | |
parent | Reference MIME part 1 standard (diff) | |
download | notemap-dc77a612c1655fd59cba11a6a8e9472f488f20c4.tar.gz notemap-dc77a612c1655fd59cba11a6a8e9472f488f20c4.zip |
Log out after reading all notes
-rw-r--r-- | notemap.c | 8 |
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; |