From a74bb12c9f72e2fd806b64dda79d4538d86e762c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 5 Jan 2005 16:23:03 +0000 Subject: merge patch by peter griess git-svn-id: file:///home/lennart/svn/public/libnewmail/trunk@42 2d4e79f2-dfba-0310-a9f4-9628e67fcdf4 --- src/unix.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/unix.c b/src/unix.c index 181ff7a..b9e652d 100644 --- a/src/unix.c +++ b/src/unix.c @@ -75,6 +75,7 @@ static int _query(struct nm_spool *s, enum nm_query query, struct nm_status *sta while (!feof(f)) { static char ln[128]; + char *eol; if (!fgets(ln, sizeof(ln), f)) break; @@ -88,7 +89,15 @@ static int _query(struct nm_spool *s, enum nm_query query, struct nm_status *sta old++; hdr = 0; } - } + + /* Position the cursor at the next newline */ + do { + if (eol = strchr(ln, '\n')) { + fseek(f, -1 * strlen(eol + 1), SEEK_CUR); + break; + } + } while(fgets(ln, sizeof(ln), f)); + } fclose(f); -- cgit