projects
/
oweals
/
musl.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
yet another ugly legacy syscall rename...
[oweals/musl.git]
/
src
/
stdio
/
fgetws.c
1
#include "stdio_impl.h"
2
3
wint_t __fgetwc_unlocked(FILE *);
4
5
wchar_t *fgetws(wchar_t *s, int n, FILE *f)
6
{
7
wchar_t *p = s;
8
9
if (!n--) return s;
10
11
FLOCK(f);
12
13
for (; n; n--) {
14
wint_t c = __fgetwc_unlocked(f);
15
if (c == WEOF) break;
16
*p++ = c;
17
if (c == '\n') break;
18
}
19
*p = 0;
20
if (ferror(f)) p = s;
21
22
FUNLOCK(f);
23
24
return (p == s) ? NULL : s;
25
}
26
27
weak_alias(fgetws, fgetws_unlocked);