1/* Copyright (C) 1995, 2000-2002 Free Software Foundation, Inc. 2 3This program is free software; you can redistribute it and/or modify 4it under the terms of the GNU General Public License as published by 5the Free Software Foundation; either version 2, or (at your option) 6any later version. 7 8This program is distributed in the hope that it will be useful, 9but WITHOUT ANY WARRANTY; without even the implied warranty of 10MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11GNU General Public License for more details. 12 13You should have received a copy of the GNU General Public License 14along with this program; if not, write to the Free Software 15Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 16USA. */ 17 18#ifndef GETLINE_H_ 19# define GETLINE_H_ 1 20 21# include <stddef.h> 22# include <stdio.h> 23 24/* Like the glibc functions get_line and get_delim, except that the result 25 must be freed using delete[], not free(). */ 26 27/* Reads up to (and including) a newline from STREAM into *LINEPTR 28 (and null-terminate it). *LINEPTR is a pointer returned from new [] (or 29 NULL), pointing to *N characters of space. It is realloc'd as 30 necessary. Returns the number of characters read (not including the 31 null terminator), or -1 on error or immediate EOF. */ 32extern int get_line (char **lineptr, size_t *n, FILE *stream); 33 34/* Reads up to (and including) a DELIMITER from STREAM into *LINEPTR 35 (and null-terminate it). *LINEPTR is a pointer returned from new [] (or 36 NULL), pointing to *N characters of space. It is realloc'd as 37 necessary. Returns the number of characters read (not including the 38 null terminator), or -1 on error or immediate EOF. */ 39extern int get_delim (char **lineptr, size_t *n, int delimiter, FILE *stream); 40 41#endif /* not GETLINE_H_ */ 42