3dphotoshoot

view src/assman.c @ 22:d7fe157c402d

fonts
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 13 Jun 2015 05:32:07 +0300
parents
children 3d082c566b53
line source
1 #include "assman.h"
3 int ass_fgetc(ass_file *fp)
4 {
5 char c;
7 if(ass_fread(&c, 1, 1, fp) < 1) {
8 return -1;
9 }
10 return c;
11 }
13 char *ass_fgets(char *s, int size, ass_file *fp)
14 {
15 int i, c;
16 char *ptr = s;
18 if(!size) return 0;
20 for(i=0; i<size - 1; i++) {
21 if((c = ass_fgetc(fp)) == -1) {
22 break;
23 }
24 *ptr++ = c;
26 if(c == '\n') break;
27 }
28 *ptr = 0;
29 return ptr == s ? 0 : s;
30 }