OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [stdio/] [getline.c] - Blame information for rev 252

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/* Copyright 2002, Red Hat Inc. - all rights reserved */
2
/*
3
FUNCTION
4
<<getline>>---read a line from a file
5
 
6
INDEX
7
        getline
8
 
9
ANSI_SYNOPSIS
10
        #include <stdio.h>
11
        ssize_t getline(char **<[bufptr]>, size_t *<[n]>, FILE *<[fp]>);
12
 
13
TRAD_SYNOPSIS
14
        #include <stdio.h>
15
        ssize_t getline(<[bufptr]>, <[n]>, <[fp]>)
16
        char **<[bufptr]>;
17
        size_t *<[n]>;
18
        FILE *<[fp]>;
19
 
20
DESCRIPTION
21
<<getline>> reads a file <[fp]> up to and possibly including the
22
newline character.  The line is read into a buffer pointed to
23
by <[bufptr]> and designated with size *<[n]>.  If the buffer is
24
not large enough, it will be dynamically grown by <<getdelim>>.
25
As the buffer is grown, the pointer to the size <[n]> will be
26
updated.
27
 
28
<<getline>> is equivalent to getdelim(bufptr, n, '\n', fp);
29
 
30
RETURNS
31
<<getline>> returns <<-1>> if no characters were successfully read,
32
otherwise, it returns the number of bytes successfully read.
33
at end of file, the result is nonzero.
34
 
35
PORTABILITY
36
<<getline>> is a glibc extension.
37
 
38
No supporting OS subroutines are directly required.
39
*/
40
 
41
#include <_ansi.h>
42
#include <stdio.h>
43
 
44
extern ssize_t _EXFUN(__getdelim, (char **, size_t *, int, FILE *));
45
 
46
ssize_t
47
_DEFUN(__getline, (lptr, n, fp),
48
       char **lptr _AND
49
       size_t *n   _AND
50
       FILE *fp)
51
{
52
  return __getdelim (lptr, n, '\n', fp);
53
}
54
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.