1 | /* Copyright (C) 1995, 2000-2002 Free Software Foundation, Inc. |
2 | |
3 | This program is free software: you can redistribute it and/or modify |
4 | it under the terms of the GNU General Public License as published by |
5 | the Free Software Foundation; either version 3 of the License, or |
6 | (at your option) any later version. |
7 | |
8 | This program is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | GNU General Public License for more details. |
12 | |
13 | You should have received a copy of the GNU General Public License |
14 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
15 | |
16 | #ifndef GETLINE_H_ |
17 | # define GETLINE_H_ 1 |
18 | |
19 | # include <stddef.h> |
20 | # include <stdio.h> |
21 | |
22 | /* Like the glibc functions get_line and get_delim, except that the result |
23 | must be freed using delete[], not free(). */ |
24 | |
25 | /* Reads up to (and including) a newline from STREAM into *LINEPTR |
26 | (and null-terminate it). *LINEPTR is a pointer returned from new [] (or |
27 | NULL), pointing to *N characters of space. It is realloc'd as |
28 | necessary. Returns the number of characters read (not including the |
29 | null terminator), or -1 on error or immediate EOF. */ |
30 | extern int get_line (char **lineptr, size_t *n, FILE *stream); |
31 | |
32 | /* Reads up to (and including) a DELIMITER from STREAM into *LINEPTR |
33 | (and null-terminate it). *LINEPTR is a pointer returned from new [] (or |
34 | NULL), pointing to *N characters of space. It is realloc'd as |
35 | necessary. Returns the number of characters read (not including the |
36 | null terminator), or -1 on error or immediate EOF. */ |
37 | extern int get_delim (char **lineptr, size_t *n, int delimiter, FILE *stream); |
38 | |
39 | #endif /* not GETLINE_H_ */ |
40 | |