projects
/
shapestoy
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
NO_AUDIO option
[shapestoy]
/
src
/
assfile.c
1
#include <stdio.h>
2
#include "assfile.h"
3
4
int ass_fgetc(ass_file *fp)
5
{
6
unsigned char c;
7
8
if(ass_fread(&c, 1, 1, fp) < 1) {
9
return -1;
10
}
11
return (int)c;
12
}
13
14
char *ass_fgets(char *s, int size, ass_file *fp)
15
{
16
int i, c;
17
char *ptr = s;
18
19
if(!size) return 0;
20
21
for(i=0; i<size - 1; i++) {
22
if((c = ass_fgetc(fp)) == -1) {
23
break;
24
}
25
*ptr++ = c;
26
27
if(c == '\n') break;
28
}
29
*ptr = 0;
30
return ptr == s ? 0 : s;
31
}