OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [stdio/] [getline.c] - Diff between revs 148 and 158

Only display areas with differences | Details | Blame | View Log

Rev 148 Rev 158
/* Copyright 2002, Red Hat Inc. - all rights reserved */
/* Copyright 2002, Red Hat Inc. - all rights reserved */
/*
/*
FUNCTION
FUNCTION
<<getline>>---read a line from a file
<<getline>>---read a line from a file
 
 
INDEX
INDEX
        getline
        getline
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
        #include <stdio.h>
        #include <stdio.h>
        ssize_t getline(char **<[bufptr]>, size_t *<[n]>, FILE *<[fp]>);
        ssize_t getline(char **<[bufptr]>, size_t *<[n]>, FILE *<[fp]>);
 
 
TRAD_SYNOPSIS
TRAD_SYNOPSIS
        #include <stdio.h>
        #include <stdio.h>
        ssize_t getline(<[bufptr]>, <[n]>, <[fp]>)
        ssize_t getline(<[bufptr]>, <[n]>, <[fp]>)
        char **<[bufptr]>;
        char **<[bufptr]>;
        size_t *<[n]>;
        size_t *<[n]>;
        FILE *<[fp]>;
        FILE *<[fp]>;
 
 
DESCRIPTION
DESCRIPTION
<<getline>> reads a file <[fp]> up to and possibly including the
<<getline>> reads a file <[fp]> up to and possibly including the
newline character.  The line is read into a buffer pointed to
newline character.  The line is read into a buffer pointed to
by <[bufptr]> and designated with size *<[n]>.  If the buffer is
by <[bufptr]> and designated with size *<[n]>.  If the buffer is
not large enough, it will be dynamically grown by <<getdelim>>.
not large enough, it will be dynamically grown by <<getdelim>>.
As the buffer is grown, the pointer to the size <[n]> will be
As the buffer is grown, the pointer to the size <[n]> will be
updated.
updated.
 
 
<<getline>> is equivalent to getdelim(bufptr, n, '\n', fp);
<<getline>> is equivalent to getdelim(bufptr, n, '\n', fp);
 
 
RETURNS
RETURNS
<<getline>> returns <<-1>> if no characters were successfully read,
<<getline>> returns <<-1>> if no characters were successfully read,
otherwise, it returns the number of bytes successfully read.
otherwise, it returns the number of bytes successfully read.
at end of file, the result is nonzero.
at end of file, the result is nonzero.
 
 
PORTABILITY
PORTABILITY
<<getline>> is a glibc extension.
<<getline>> is a glibc extension.
 
 
No supporting OS subroutines are directly required.
No supporting OS subroutines are directly required.
*/
*/
 
 
#include <_ansi.h>
#include <_ansi.h>
#include <stdio.h>
#include <stdio.h>
 
 
extern ssize_t _EXFUN(__getdelim, (char **, size_t *, int, FILE *));
extern ssize_t _EXFUN(__getdelim, (char **, size_t *, int, FILE *));
 
 
ssize_t
ssize_t
_DEFUN(__getline, (lptr, n, fp),
_DEFUN(__getline, (lptr, n, fp),
       char **lptr _AND
       char **lptr _AND
       size_t *n   _AND
       size_t *n   _AND
       FILE *fp)
       FILE *fp)
{
{
  return __getdelim (lptr, n, '\n', fp);
  return __getdelim (lptr, n, '\n', fp);
}
}
 
 
 
 

powered by: WebSVN 2.1.0

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