2N/A/* getdelim.c --- Implementation of replacement getdelim function. 2N/A Copyright (C) 1994, 1996, 1997, 1998, 2001, 2003, 2005, 2006, 2007, 2008, 2N/A 2009, 2010 Free Software Foundation, Inc. 2N/A This program is free software; you can redistribute it and/or 2N/A modify it under the terms of the GNU General Public License as 2N/A published by the Free Software Foundation; either version 3, or (at 2N/A your option) any later version. 2N/A This program is distributed in the hope that it will be useful, but 2N/A WITHOUT ANY WARRANTY; without even the implied warranty of 2N/A MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 2N/A General Public License for more details. 2N/A You should have received a copy of the GNU General Public License 2N/A along with this program; if not, write to the Free Software 2N/A Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2N/A/* Ported from glibc by Simon Josefsson. */ 2N/A/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc 2N/A optimizes away the lineptr == NULL || n == NULL || fp == NULL tests below. */ 2N/A/* Read up to (and including) a DELIMITER from FP into *LINEPTR (and 2N/A NUL-terminate it). *LINEPTR is a pointer returned from malloc (or 2N/A NULL), pointing to *N characters of space. It is realloc'ed as 2N/A necessary. Returns the number of characters read (not including 2N/A the null terminator), or -1 on error or EOF. */ 2N/A /* Make enough space for len+1 (for final NUL) bytes. */