source: asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/stdio/fgetln.c@ 337

Last change on this file since 337 was 337, checked in by coas-nagasima, 6 years ago

ASP3版ECNLを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc;charset=UTF-8
File size: 430 bytes
Line 
1#define _GNU_SOURCE
2#include "stdio_impl.h"
3#include <string.h>
4
5char *fgetln(FILE *f, size_t *plen)
6{
7 char *ret = 0, *z;
8 ssize_t l;
9 FLOCK(f);
10 ungetc(getc_unlocked(f), f);
11 if ((z=memchr(f->rpos, '\n', f->rend - f->rpos))) {
12 ret = (char *)f->rpos;
13 *plen = ++z - ret;
14 f->rpos = (void *)z;
15 } else if ((l = getline(&f->getln_buf, (size_t[]){0}, f)) > 0) {
16 *plen = l;
17 ret = f->getln_buf;
18 }
19 FUNLOCK(f);
20 return ret;
21}
Note: See TracBrowser for help on using the repository browser.