Mercurial > repos > bitlab > gecko
annotate gecko/src/commonFunctions.c @ 11:cf4c0c822ca9 draft
Uploaded
author | bitlab |
---|---|
date | Wed, 18 Nov 2020 08:37:31 +0000 |
parents | 9db88f0f32b7 |
children |
rev | line source |
---|---|
0 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 #include <inttypes.h> | |
4 #include <string.h> | |
5 #include "structs.h" | |
6 | |
7 void terror(char *s) { | |
8 printf("ERR**** %s ****\n", s); | |
9 exit(-1); | |
10 } | |
11 | |
12 char buffered_fgetc(char *buffer, uint64_t *pos, uint64_t *read, FILE *f) { | |
13 if (*pos >= READBUF) { | |
14 *pos = 0; | |
15 memset(buffer, 0, READBUF); | |
16 *read = fread(buffer, 1, READBUF, f); | |
17 } | |
18 *pos = *pos + 1; | |
19 return buffer[*pos-1]; | |
20 } |