1 |
/* getline.c -- Replacement for GNU C library function getline |
/* getline.c --- Implementation of replacement getline function. |
2 |
|
Copyright (C) 2005 Free Software Foundation, Inc. |
3 |
|
|
4 |
Copyright (C) 1993, 1996, 1997, 1998, 2000, 2003, 2004 Free |
This program is free software; you can redistribute it and/or |
5 |
Software Foundation, Inc. |
modify it under the terms of the GNU General Public License as |
6 |
|
published by the Free Software Foundation; either version 2, or (at |
7 |
This program is free software; you can redistribute it and/or modify |
your option) any later version. |
8 |
it under the terms of the GNU General Public License as published by |
|
9 |
the Free Software Foundation; either version 2, or (at your option) |
This program is distributed in the hope that it will be useful, but |
10 |
any later version. |
WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 |
This program is distributed in the hope that it will be useful, |
General Public License for more details. |
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
GNU General Public License for more details. |
|
13 |
|
|
14 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
15 |
along with this program; if not, write to the Free Software Foundation, |
along with this program; if not, write to the Free Software |
16 |
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
17 |
|
02110-1301, USA. */ |
18 |
|
|
19 |
/* Written by Jan Brittenson, bson@gnu.ai.mit.edu. */ |
/* Written by Simon Josefsson. */ |
20 |
|
|
21 |
#if HAVE_CONFIG_H |
#if HAVE_CONFIG_H |
22 |
# include <config.h> |
# include <config.h> |
23 |
#endif |
#endif |
24 |
|
|
25 |
|
#include "getdelim.h" |
26 |
#include "getline.h" |
#include "getline.h" |
27 |
|
|
|
#if ! (defined __GNU_LIBRARY__ && HAVE_GETDELIM) |
|
|
|
|
|
# include "getndelim2.h" |
|
|
|
|
|
ssize_t |
|
|
getdelim (char **lineptr, size_t *linesize, int delimiter, FILE *stream) |
|
|
{ |
|
|
return getndelim2 (lineptr, linesize, 0, GETNLINE_NO_LIMIT, delimiter, EOF, |
|
|
stream); |
|
|
} |
|
|
#endif |
|
|
|
|
28 |
ssize_t |
ssize_t |
29 |
getline (char **lineptr, size_t *linesize, FILE *stream) |
getline (char **lineptr, size_t *n, FILE *stream) |
30 |
{ |
{ |
31 |
return getdelim (lineptr, linesize, '\n', stream); |
return getdelim (lineptr, n, '\n', stream); |
32 |
} |
} |