1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-06-12 12:36:39 +02:00
Files
coreutils/lib/getline.c
T

60 lines
1.6 KiB
C
Raw Normal View History

1995-09-19 14:30:59 +00:00
/* getline.c -- Replacement for GNU C library function getline
2003-06-17 19:57:27 +00:00
Copyright (C) 1993, 1996, 1997, 1998, 2000, 2003 Free Software
Foundation, Inc.
1995-09-19 14:30:59 +00:00
2003-06-17 19:57:27 +00:00
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.
1995-09-19 14:30:59 +00:00
2003-06-17 19:57:27 +00:00
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.
1995-09-19 14:30:59 +00:00
2003-06-17 19:57:27 +00:00
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
1995-09-19 14:30:59 +00:00
/* Written by Jan Brittenson, bson@gnu.ai.mit.edu. */
1996-07-14 12:32:01 +00:00
#if HAVE_CONFIG_H
1996-04-22 03:02:55 +00:00
# include <config.h>
1995-09-19 14:30:59 +00:00
#endif
2003-06-17 19:57:27 +00:00
#include "getline.h"
#include "getdelim2.h"
2003-06-17 19:57:27 +00:00
1996-07-14 12:32:01 +00:00
/* The `getdelim' function is only declared if the following symbol
1996-06-30 04:24:26 +00:00
is defined. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
2003-06-17 19:57:27 +00:00
#include <stddef.h>
1995-09-19 14:30:59 +00:00
#include <stdio.h>
1996-04-22 03:02:55 +00:00
1996-07-14 12:32:25 +00:00
#if defined __GNU_LIBRARY__ && HAVE_GETDELIM
1996-04-22 03:02:55 +00:00
int
1998-12-07 03:12:10 +00:00
getline (char **lineptr, size_t *n, FILE *stream)
1996-04-22 03:02:55 +00:00
{
return getdelim (lineptr, n, '\n', stream);
}
#else /* ! have getdelim */
1995-09-19 14:30:59 +00:00
int
1998-12-07 03:12:10 +00:00
getline (char **lineptr, size_t *n, FILE *stream)
1995-09-19 14:30:59 +00:00
{
2003-06-17 19:57:27 +00:00
return getdelim2 (lineptr, n, stream, '\n', 0, 0);
1995-09-19 14:30:59 +00:00
}
1996-04-22 03:02:55 +00:00
int
1998-12-07 03:12:10 +00:00
getdelim (char **lineptr, size_t *n, int delimiter, FILE *stream)
1996-04-22 03:02:55 +00:00
{
2003-06-17 19:57:27 +00:00
return getdelim2 (lineptr, n, stream, delimiter, 0, 0);
1996-04-22 03:02:55 +00:00
}
#endif