/*--------- "dtvkcmp" Compare two kernals and create a binary 'diff' type file Input files for "dtvkpatch" By Doug Garmon, (c) 2006 GPL licence Format: addr byte1 byte2 Only the second byte is used by the dtvkpatch prog, first byte retained as reference ----------*/ #include int main(int argc, char *argv[]) { int count = 0; int cmp1, cmp2; FILE *kernal1, *kernal2; if (argc == 3 || argc == 4) { if (kernal1 = fopen(argv[1], "r")) { if (kernal2 = fopen(argv[2], "r")) { /* files better be the same size, or there will be problems-- no size check here */ while ((cmp1 = fgetc(kernal1))!=EOF) { cmp2 = fgetc(kernal2); if (cmp1 != cmp2) { printf("%d %d %d\n", count, cmp1, cmp2); } count++; } } else printf("Error: couldn't open file 2\n"); } else printf("Error: couldn't open file 1\n"); } else printf("Error: Wrong number of arguments\nInput: 'dtvkcmp kernal1 kernal2' or 'dtvkcmp kernal1 kernal2 >savefile'\n"); return(0); }