1992-11-08 02:50:43 +00:00
|
|
|
|
/* linebuffer.h -- declarations for reading arbitrarily long lines
|
|
|
|
|
|
Copyright (C) 1986, 1991 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
|
along with this program; if not, write to the Free Software
|
1995-06-18 19:33:31 +00:00
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
1992-11-08 02:50:43 +00:00
|
|
|
|
|
|
|
|
|
|
/* A `struct linebuffer' holds a line of text. */
|
|
|
|
|
|
|
|
|
|
|
|
struct linebuffer
|
|
|
|
|
|
{
|
|
|
|
|
|
long size; /* Allocated. */
|
|
|
|
|
|
long length; /* Used. */
|
|
|
|
|
|
char *buffer;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
1995-03-12 18:06:08 +00:00
|
|
|
|
#undef __P
|
1994-11-04 14:04:43 +00:00
|
|
|
|
#if defined (__STDC__) && __STDC__
|
|
|
|
|
|
#define __P(x) x
|
|
|
|
|
|
#else
|
|
|
|
|
|
#define __P(x) ()
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
1992-11-08 02:50:43 +00:00
|
|
|
|
/* Initialize linebuffer LINEBUFFER for use. */
|
1994-11-04 14:04:43 +00:00
|
|
|
|
void initbuffer __P ((struct linebuffer *linebuffer));
|
1992-11-08 02:50:43 +00:00
|
|
|
|
|
|
|
|
|
|
/* Read an arbitrarily long line of text from STREAM into LINEBUFFER.
|
|
|
|
|
|
Remove any newline. Does not null terminate.
|
|
|
|
|
|
Return LINEBUFFER, except at end of file return 0. */
|
1994-11-04 14:04:43 +00:00
|
|
|
|
struct linebuffer *readline __P ((struct linebuffer *linebuffer, FILE *stream));
|
1992-11-08 02:50:43 +00:00
|
|
|
|
|
|
|
|
|
|
/* Free linebuffer LINEBUFFER and its data, all allocated with malloc. */
|
1994-11-04 14:04:43 +00:00
|
|
|
|
void freebuffer __P ((struct linebuffer *));
|