1*86d7f5d3SJohn Marino /* getnline - Read a line from a stream, with bounded memory allocation.
2*86d7f5d3SJohn Marino
3*86d7f5d3SJohn Marino Copyright (C) 2003, 2004 Free Software Foundation, Inc.
4*86d7f5d3SJohn Marino
5*86d7f5d3SJohn Marino This program is free software; you can redistribute it and/or modify
6*86d7f5d3SJohn Marino it under the terms of the GNU General Public License as published by
7*86d7f5d3SJohn Marino the Free Software Foundation; either version 2, or (at your option)
8*86d7f5d3SJohn Marino any later version.
9*86d7f5d3SJohn Marino
10*86d7f5d3SJohn Marino This program is distributed in the hope that it will be useful,
11*86d7f5d3SJohn Marino but WITHOUT ANY WARRANTY; without even the implied warranty of
12*86d7f5d3SJohn Marino MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13*86d7f5d3SJohn Marino GNU General Public License for more details.
14*86d7f5d3SJohn Marino
15*86d7f5d3SJohn Marino You should have received a copy of the GNU General Public License
16*86d7f5d3SJohn Marino along with this program; if not, write to the Free Software Foundation,
17*86d7f5d3SJohn Marino Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18*86d7f5d3SJohn Marino
19*86d7f5d3SJohn Marino #ifdef HAVE_CONFIG_H
20*86d7f5d3SJohn Marino # include <config.h>
21*86d7f5d3SJohn Marino #endif
22*86d7f5d3SJohn Marino
23*86d7f5d3SJohn Marino /* Specification. */
24*86d7f5d3SJohn Marino #include "getnline.h"
25*86d7f5d3SJohn Marino
26*86d7f5d3SJohn Marino #include "getndelim2.h"
27*86d7f5d3SJohn Marino
28*86d7f5d3SJohn Marino ssize_t
getndelim(char ** lineptr,size_t * linesize,size_t nmax,int delimiter,FILE * stream)29*86d7f5d3SJohn Marino getndelim (char **lineptr, size_t *linesize, size_t nmax,
30*86d7f5d3SJohn Marino int delimiter, FILE *stream)
31*86d7f5d3SJohn Marino {
32*86d7f5d3SJohn Marino return getndelim2 (lineptr, linesize, 0, nmax, delimiter, EOF, stream);
33*86d7f5d3SJohn Marino }
34*86d7f5d3SJohn Marino
35*86d7f5d3SJohn Marino ssize_t
getnline(char ** lineptr,size_t * linesize,size_t nmax,FILE * stream)36*86d7f5d3SJohn Marino getnline (char **lineptr, size_t *linesize, size_t nmax, FILE *stream)
37*86d7f5d3SJohn Marino {
38*86d7f5d3SJohn Marino return getndelim (lineptr, linesize, nmax, '\n', stream);
39*86d7f5d3SJohn Marino }
40