1228060Sbapt/* Copyright (C) 1995, 2000-2002 Free Software Foundation, Inc. 2228060Sbapt 3228060SbaptThis program is free software; you can redistribute it and/or modify 4228060Sbaptit under the terms of the GNU General Public License as published by 5228060Sbaptthe Free Software Foundation; either version 2, or (at your option) 6228060Sbaptany later version. 7228060Sbapt 8228060SbaptThis program is distributed in the hope that it will be useful, 9228060Sbaptbut WITHOUT ANY WARRANTY; without even the implied warranty of 10228060SbaptMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11228060SbaptGNU General Public License for more details. 12228060Sbapt 13228060SbaptYou should have received a copy of the GNU General Public License 14228060Sbaptalong with this program; if not, write to the Free Software 15228060SbaptFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 16228060SbaptUSA. */ 17228060Sbapt 18228060Sbapt#ifndef GETLINE_H_ 19228060Sbapt# define GETLINE_H_ 1 20228060Sbapt 21228060Sbapt# include <stddef.h> 22228060Sbapt# include <stdio.h> 23228060Sbapt 24228060Sbapt/* Like the glibc functions get_line and get_delim, except that the result 25228060Sbapt must be freed using delete[], not free(). */ 26228060Sbapt 27228060Sbapt/* Reads up to (and including) a newline from STREAM into *LINEPTR 28228060Sbapt (and null-terminate it). *LINEPTR is a pointer returned from new [] (or 29228060Sbapt NULL), pointing to *N characters of space. It is realloc'd as 30228060Sbapt necessary. Returns the number of characters read (not including the 31228060Sbapt null terminator), or -1 on error or immediate EOF. */ 32228060Sbaptextern int get_line (char **lineptr, size_t *n, FILE *stream); 33228060Sbapt 34228060Sbapt/* Reads up to (and including) a DELIMITER from STREAM into *LINEPTR 35228060Sbapt (and null-terminate it). *LINEPTR is a pointer returned from new [] (or 36228060Sbapt NULL), pointing to *N characters of space. It is realloc'd as 37228060Sbapt necessary. Returns the number of characters read (not including the 38228060Sbapt null terminator), or -1 on error or immediate EOF. */ 39228060Sbaptextern int get_delim (char **lineptr, size_t *n, int delimiter, FILE *stream); 40228060Sbapt 41228060Sbapt#endif /* not GETLINE_H_ */ 42