2 Copyright (C) 2009 Andreas Gruenbacher <agruen@suse.de>
4 This program is free software: you can redistribute it and/or modify it
5 under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation, either version 2.1 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #define LINE_SIZE getpagesize()
26 char *next_line(FILE *file)
29 static size_t line_size;
34 if (high_water_alloc((void **)&line, &line_size, LINE_SIZE))
39 if (!fgets(c, line_size - (c - line), file))
42 while (c > line && (*(c-1) == '\n' || *(c-1) == '\r')) {
50 if (high_water_alloc((void **)&line, &line_size,
53 c = strrchr(line, '\0');