scc

A fork of https://git.simple-cc.org/scc/ for Qute

git clone https://git.8pit.net/scc.git

 1#include <stdio.h>
 2
 3#undef fread
 4
 5size_t
 6fread(void * restrict ptr, size_t size, size_t nmemb,
 7      FILE * restrict fp)
 8{
 9	unsigned char *bp = ptr;
10	size_t n, i;
11	int c;
12
13	if (size == 0)
14		return 0;
15
16	for (n = 0; n < nmemb; n++) {
17		i = size;
18		do {
19			if ((c = getc(fp)) == EOF)
20				return n;
21			*bp++ = c;
22		} while (--i);
23	}
24
25	return n;
26}