source: freewrt/tools/paxmirabilis/fgetln.c@ 2c03383

freewrt_1_0 freewrt_2_0
Last change on this file since 2c03383 was 2c03383, checked in by Thorsten Glaser <tg@…>, 19 years ago

fgetln from Debian libbsd

git-svn-id: svn://www.freewrt.org/trunk/freewrt@219 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 401 bytes
Line 
1#include <stdio.h>
2#include <sys/cdefs.h>
3#include <sys/types.h>
4#include <string.h>
5
6#ifdef __GLIBC__
7char *
8fgetln (stream, len)
9 FILE *stream;
10 size_t *len;
11{
12 char *line=NULL;
13 size_t nread = 0;
14
15 while (nread == 1) {
16 nread = getline (&line, len, stream);
17 if (nread == -1)
18 return NULL;
19 }
20
21 (*len)--; /* get rid of the trailing \0, fgetln
22 does not have it */
23
24 return line;
25}
26#endif
Note: See TracBrowser for help on using the repository browser.