fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / libc / stdio / getline.c
blob741a7dc7784361f88b7e212b2615deb544e3a4d5
1 /*
2 FUNCTION
3 <<getline>>---read a line from a file
5 INDEX
6 getline
8 ANSI_SYNOPSIS
9 #include <stdio.h>
10 ssize_t getline(char **<[bufptr]>, size_t *<[n]>, FILE *<[fp]>);
12 TRAD_SYNOPSIS
13 #include <stdio.h>
14 ssize_t getline(<[bufptr]>, <[n]>, <[fp]>)
15 char **<[bufptr]>;
16 size_t *<[n]>;
17 FILE *<[fp]>;
19 DESCRIPTION
20 <<getline>> reads a file <[fp]> up to and possibly including the
21 newline character. The line is read into a buffer pointed to
22 by <[bufptr]> and designated with size *<[n]>. If the buffer is
23 not large enough, it will be dynamically grown by <<getdelim>>.
24 As the buffer is grown, the pointer to the size <[n]> will be
25 updated.
27 <<getline>> is equivalent to getdelim(bufptr, n, '\n', fp);
29 RETURNS
30 <<getline>> returns <<-1>> if no characters were successfully read,
31 otherwise, it returns the number of bytes successfully read.
32 at end of file, the result is nonzero.
34 PORTABILITY
35 <<getline>> is a glibc extension.
37 No supporting OS subroutines are directly required.
40 /* Copyright 2002, Red Hat Inc. - all rights reserved */
42 #include <stdio.h>
44 extern ssize_t __getdelim (char **, size_t *, int, FILE *);
46 ssize_t
47 __getline (lptr, n, fp)
48 char **lptr;
49 size_t *n;
50 FILE *fp;
52 return __getdelim (lptr, n, '\n', fp);