diff options
Diffstat (limited to 'src/unix.c')
-rw-r--r-- | src/unix.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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); |