diff options
author | Bruno Haible <bruno@clisp.org> | 2003-01-20 14:16:08 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2003-01-20 14:16:08 +0000 |
commit | 0a3597e6c284ec8235f54c1d2daaf800bf648358 (patch) | |
tree | 9414918452bc8558ebd5f9f008c3ab7fcd46c42f | |
parent | 6bc6a5c4e024759bdf7cbeb0f32c0300942e7c16 (diff) | |
download | gperf-0a3597e6c284ec8235f54c1d2daaf800bf648358.tar.gz |
Comments.
-rw-r--r-- | lib/getline.cc | 10 | ||||
-rw-r--r-- | lib/getline.h | 10 |
2 files changed, 15 insertions, 5 deletions
diff --git a/lib/getline.cc b/lib/getline.cc index 90e027b..8fc1629 100644 --- a/lib/getline.cc +++ b/lib/getline.cc @@ -29,11 +29,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* 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. +/* Reads up to (and including) a TERMINATOR from STREAM into *LINEPTR + OFFSET + (and null-terminate it). *LINEPTR is a pointer returned from new [] (or + NULL), pointing to *N characters of space. It is realloc'd as + necessary. Returns the number of characters read (not including the + null terminator), or -1 on error or immediate EOF. NOTE: There is another getstr() function declared in <curses.h>. */ static int diff --git a/lib/getline.h b/lib/getline.h index 81ddb7d..d213f00 100644 --- a/lib/getline.h +++ b/lib/getline.h @@ -23,8 +23,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Like the glibc functions get_line and get_delim, except that the result must be freed using delete[], not free(). */ +/* Reads up to (and including) a newline from STREAM into *LINEPTR + (and null-terminate it). *LINEPTR is a pointer returned from new [] (or + NULL), pointing to *N characters of space. It is realloc'd as + necessary. Returns the number of characters read (not including the + null terminator), or -1 on error or immediate EOF. */ extern int get_line (char **lineptr, size_t *n, FILE *stream); +/* Reads up to (and including) a DELIMITER from STREAM into *LINEPTR + (and null-terminate it). *LINEPTR is a pointer returned from new [] (or + NULL), pointing to *N characters of space. It is realloc'd as + necessary. Returns the number of characters read (not including the + null terminator), or -1 on error or immediate EOF. */ extern int get_delim (char **lineptr, size_t *n, int delimiter, FILE *stream); #endif /* not GETLINE_H_ */ |