3dphotoshoot

annotate 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
rev   line source
nuclear@22 1 #include "assman.h"
nuclear@22 2
nuclear@22 3 int ass_fgetc(ass_file *fp)
nuclear@22 4 {
nuclear@22 5 char c;
nuclear@22 6
nuclear@22 7 if(ass_fread(&c, 1, 1, fp) < 1) {
nuclear@22 8 return -1;
nuclear@22 9 }
nuclear@22 10 return c;
nuclear@22 11 }
nuclear@22 12
nuclear@22 13 char *ass_fgets(char *s, int size, ass_file *fp)
nuclear@22 14 {
nuclear@22 15 int i, c;
nuclear@22 16 char *ptr = s;
nuclear@22 17
nuclear@22 18 if(!size) return 0;
nuclear@22 19
nuclear@22 20 for(i=0; i<size - 1; i++) {
nuclear@22 21 if((c = ass_fgetc(fp)) == -1) {
nuclear@22 22 break;
nuclear@22 23 }
nuclear@22 24 *ptr++ = c;
nuclear@22 25
nuclear@22 26 if(c == '\n') break;
nuclear@22 27 }
nuclear@22 28 *ptr = 0;
nuclear@22 29 return ptr == s ? 0 : s;
nuclear@22 30 }