Last change
on this file since 388 was 388, checked in by coas-nagasima, 5 years ago |
Azure IoT Hub Device C SDK を使ったサンプルの追加
|
-
Property svn:eol-style
set to
native
-
Property svn:keywords
set to
Id
-
Property svn:mime-type
set to
text/x-csrc
|
File size:
942 bytes
|
Rev | Line | |
---|
[388] | 1 | #include "stdio_impl.h"
|
---|
| 2 |
|
---|
| 3 | /* stdout.c will override this if linked */
|
---|
| 4 | #ifndef __c2__
|
---|
| 5 | static FILE *volatile dummy = 0;
|
---|
| 6 | weak_alias(dummy, __stdout_used);
|
---|
| 7 | #else
|
---|
| 8 | extern FILE *volatile __stdout_used;
|
---|
| 9 | #endif
|
---|
| 10 |
|
---|
| 11 | int fflush(FILE *f)
|
---|
| 12 | {
|
---|
| 13 | if (!f) {
|
---|
| 14 | int r = __stdout_used ? fflush(__stdout_used) : 0;
|
---|
| 15 |
|
---|
| 16 | for (f=*__ofl_lock(); f; f=f->next) {
|
---|
| 17 | FLOCK(f);
|
---|
| 18 | if (f->wpos > f->wbase) r |= fflush(f);
|
---|
| 19 | FUNLOCK(f);
|
---|
| 20 | }
|
---|
| 21 | __ofl_unlock();
|
---|
| 22 |
|
---|
| 23 | return r;
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | FLOCK(f);
|
---|
| 27 |
|
---|
| 28 | /* If writing, flush output */
|
---|
| 29 | if (f->wpos > f->wbase) {
|
---|
| 30 | f->write(f, 0, 0);
|
---|
| 31 | if (!f->wpos) {
|
---|
| 32 | FUNLOCK(f);
|
---|
| 33 | return EOF;
|
---|
| 34 | }
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | /* If reading, sync position, per POSIX */
|
---|
| 38 | if (f->rpos < f->rend) f->seek(f, f->rpos-f->rend, SEEK_CUR);
|
---|
| 39 |
|
---|
| 40 | /* Clear read and write modes */
|
---|
| 41 | f->wpos = f->wbase = f->wend = 0;
|
---|
| 42 | f->rpos = f->rend = 0;
|
---|
| 43 |
|
---|
| 44 | FUNLOCK(f);
|
---|
| 45 | return 0;
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | #ifndef __c2__
|
---|
| 49 | weak_alias(fflush, fflush_unlocked);
|
---|
| 50 | #else
|
---|
| 51 | int fflush_unlocked(FILE *f)
|
---|
| 52 | {
|
---|
| 53 | return fflush_unlocked(f);
|
---|
| 54 | }
|
---|
| 55 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.