-int
-getline (lineptr, n, stream)
- char **lineptr;
- size_t *n;
- FILE *stream;
-{
- return getdelim (lineptr, n, '\n', stream);
-}
-
-
-#else /* ! have getdelim */
-
-#define NDEBUG
-#include <assert.h>
-
-#if STDC_HEADERS
-# include <stdlib.h>
-#else
-char *malloc (), *realloc ();
-#endif
-
-/* Always add at least this many bytes when extending the buffer. */
-#define MIN_CHUNK 64
-
-/* Read up to (and including) a TERMINATOR from STREAM into *LINEPTR
- + OFFSET (and null-terminate it). *LINEPTR is a pointer returned from
- malloc (or NULL), pointing to *N characters of space. It is realloc'd
- as necessary. Return the number of characters read (not including the
- null terminator), or -1 on error or EOF. */
-
-int
-getstr (lineptr, n, stream, terminator, offset)
- char **lineptr;
- size_t *n;
- FILE *stream;
- char terminator;
- size_t offset;
-{
- int nchars_avail; /* Allocated but unused chars in *LINEPTR. */
- char *read_pos; /* Where we're reading into *LINEPTR. */
- int ret;
-
- if (!lineptr || !n || !stream)
- return -1;
-
- if (!*lineptr)
- {
- *n = MIN_CHUNK;
- *lineptr = malloc (*n);
- if (!*lineptr)
- return -1;
- }