source: azure_iot_hub/trunk/musl-1.1.18/src/internal/shgetc.c@ 389

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

ビルドが通るよう更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc;charset=UTF-8
File size: 561 bytes
Line 
1#include "shgetc.h"
2
3void __shlim(FILE *f, off_t lim)
4{
5 f->shlim = lim;
6 f->shcnt = f->rend - f->rpos;
7 if (lim && f->shcnt > lim)
8 f->shend = f->rpos + lim;
9 else
10 f->shend = f->rend;
11}
12
13int __shgetc(FILE *f)
14{
15 int c;
16 if (f->shlim && f->shcnt >= f->shlim || (c=__uflow(f)) < 0) {
17 f->shend = 0;
18 return EOF;
19 }
20 if (f->shlim && f->rend - f->rpos > f->shlim - f->shcnt - 1)
21 f->shend = f->rpos + (f->shlim - f->shcnt - 1);
22 else
23 f->shend = f->rend;
24 if (f->rend) f->shcnt += f->rend - f->rpos + 1;
25 if (f->rpos[-1] != c) f->rpos[-1] = c;
26 return c;
27}
Note: See TracBrowser for help on using the repository browser.