]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/gperf/lib/getline.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / gperf / lib / getline.h
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 2, or (at your option)
6 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, write to the Free Software
15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
16 USA.  */
17
18 #ifndef GETLINE_H_
19 # define GETLINE_H_ 1
20
21 # include <stddef.h>
22 # include <stdio.h>
23
24 /* Like the glibc functions get_line and get_delim, except that the result
25    must be freed using delete[], not free().  */
26
27 /* Reads up to (and including) a newline from STREAM into *LINEPTR
28    (and null-terminate it). *LINEPTR is a pointer returned from new [] (or
29    NULL), pointing to *N characters of space.  It is realloc'd as
30    necessary.  Returns the number of characters read (not including the
31    null terminator), or -1 on error or immediate EOF.  */
32 extern int get_line (char **lineptr, size_t *n, FILE *stream);
33
34 /* Reads up to (and including) a DELIMITER from STREAM into *LINEPTR
35    (and null-terminate it). *LINEPTR is a pointer returned from new [] (or
36    NULL), pointing to *N characters of space.  It is realloc'd as
37    necessary.  Returns the number of characters read (not including the
38    null terminator), or -1 on error or immediate EOF.  */
39 extern int get_delim (char **lineptr, size_t *n, int delimiter, FILE *stream);
40
41 #endif /* not GETLINE_H_ */