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