mirror of
https://github.com/koenkooi/foo2zjs.git
synced 2026-01-23 04:04:49 +08:00
Merge 36442ffa719d4bc9a767925f38f18e4a4a79002a into e04290de6b7a30d588f3411fd9834618e09f7b9b
This commit is contained in:
commit
96a53e690f
23
xqxdecode.c
23
xqxdecode.c
@ -142,6 +142,27 @@ proff(int curOff)
|
||||
printf("%6x: ", curOff);
|
||||
}
|
||||
|
||||
char*
|
||||
fgetsn(char* str, int n, FILE* stream)
|
||||
{
|
||||
register int c;
|
||||
register char ch;
|
||||
register char* cs;
|
||||
cs = str;
|
||||
|
||||
while (--n > 0 && (c = getc(stream)) != EOF) {
|
||||
ch = (*cs++ = c);
|
||||
if (ch == '\n') {
|
||||
*cs = '\0';
|
||||
break;
|
||||
}
|
||||
else if (ch == '\0')
|
||||
break;
|
||||
}
|
||||
|
||||
return (c == EOF && cs == str) ? NULL : str;
|
||||
}
|
||||
|
||||
void
|
||||
decode(FILE *fp)
|
||||
{
|
||||
@ -178,7 +199,7 @@ decode(FILE *fp)
|
||||
{
|
||||
char buf[1024];
|
||||
|
||||
while (fgets(buf, sizeof(buf), fp))
|
||||
while (fgetsn(buf, sizeof(buf), fp))
|
||||
{
|
||||
proff(curOff);
|
||||
if (buf[0] == '\033')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user