source: trunk/libs/newlib/src/newlib/libc/stdio/getline.c @ 620

Last change on this file since 620 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

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