3 /* The shcnt field stores the number of bytes read so far, offset by
4 * the value of buf-rpos at the last function call (__shlim or __shgetc),
5 * so that between calls the inline shcnt macro can add rpos-buf to get
8 void __shlim(FILE *f
, off_t lim
)
11 f
->shcnt
= f
->buf
- f
->rpos
;
12 /* If lim is nonzero, rend must be a valid pointer. */
13 if (lim
&& f
->rend
- f
->rpos
> lim
)
14 f
->shend
= f
->rpos
+ lim
;
23 if (f
->shlim
&& cnt
>= f
->shlim
|| (c
=__uflow(f
)) < 0) {
24 f
->shcnt
= f
->buf
- f
->rpos
+ cnt
;
29 if (f
->shlim
&& f
->rend
- f
->rpos
> f
->shlim
- cnt
)
30 f
->shend
= f
->rpos
+ (f
->shlim
- cnt
);
33 f
->shcnt
= f
->buf
- f
->rpos
+ cnt
;
34 if (f
->rpos
[-1] != c
) f
->rpos
[-1] = c
;