Last change
on this file since 445 was 444, checked in by coas-nagasima, 4 years ago |
muslのソースコードを追加
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
427 bytes
|
Line | |
---|
1 | #include "stdio_impl.h"
|
---|
2 | #include <wchar.h>
|
---|
3 |
|
---|
4 | wint_t __fgetwc_unlocked(FILE *);
|
---|
5 |
|
---|
6 | wchar_t *fgetws(wchar_t *restrict s, int n, FILE *restrict f)
|
---|
7 | {
|
---|
8 | wchar_t *p = s;
|
---|
9 |
|
---|
10 | if (!n--) return s;
|
---|
11 |
|
---|
12 | FLOCK(f);
|
---|
13 |
|
---|
14 | for (; n; n--) {
|
---|
15 | wint_t c = __fgetwc_unlocked(f);
|
---|
16 | if (c == WEOF) break;
|
---|
17 | *p++ = c;
|
---|
18 | if (c == '\n') break;
|
---|
19 | }
|
---|
20 | *p = 0;
|
---|
21 | if (ferror(f)) p = s;
|
---|
22 |
|
---|
23 | FUNLOCK(f);
|
---|
24 |
|
---|
25 | return (p == s) ? NULL : s;
|
---|
26 | }
|
---|
27 |
|
---|
28 | weak_alias(fgetws, fgetws_unlocked);
|
---|
Note:
See
TracBrowser
for help on using the repository browser.