blob: 171ee58bd54c150930d5857e7c97de375e65fe64 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include "stdio.h"
int __StringRead(void* isc, int ch, int Action) {
char ret;
__InStrCtrl* iscp = (__InStrCtrl*)isc;
switch (Action) {
case __GetChar:
ret = *(iscp->NextChar);
if (ret == '\0') {
iscp->NullCharDetected = 1;
return (EOF);
} else {
iscp->NextChar++;
return ((unsigned char)ret);
}
case __UngetChar:
if (!iscp->NullCharDetected)
iscp->NextChar--;
else
iscp->NullCharDetected = 0;
return (ch);
case __CheckForError:
return (iscp->NullCharDetected);
}
return 0;
}
|