#include <stdio.h> #include <stdlib.h> int main(int argc, unsigned char **argv) { unsigned char *b = malloc(1024 * 1024); FILE *fp; int s, i, l; char f; if (argc >= 2) { fp = fopen(argv[1], "rb"); if (fp != NULL) { *b++ = 0; s = fread(b, 1, 1024 * 1024 - 2, fp); fclose(fp); f = 0; l = 0; for (i = 0; i < s; i++) { if (b[i] == '\n') f = 0; if (b[i] == '\"' && b[i - 1] != '\\') f ^= 1; if (f != 0 || b[i] > ' ') l++; } free(b - 1); printf("proglen = %d\n", l); } } return 0; }
(This host) = http://osask.net