--- previous/src/cpu/build68k.c 2018/04/24 19:30:16 1.1.1.2 +++ previous/src/cpu/build68k.c 2018/04/24 19:31:52 1.1.1.3 @@ -6,8 +6,10 @@ * Copyright 1995,1996 Bernd Schmidt */ +#include "sysconfig.h" +#include "sysdeps.h" + #include -//#include #include #include #include @@ -15,10 +17,6 @@ #define TCHAR char #define strnicmp strncasecmp -#include "sysconfig.h" -#include "sysdeps.h" - - #include "readcpu.h" static FILE *tablef; @@ -81,7 +79,6 @@ int main(int argc, char **argv) int cpulevel, uncpulevel, plevel, sduse; int i; - char patbits[16]; char opcstr[256]; int bitpos[16]; int flagset[5], flaguse[5]; @@ -130,7 +127,6 @@ int main(int argc, char **argv) bitmask |= 1; if (nextch == '1') bitpattern |= 1; - patbits[i] = nextch; getnextch(); } @@ -229,7 +225,9 @@ int main(int argc, char **argv) if (nextch != ':') abort(); - fgets(opcstr, 250, tablef); + if (fgets(opcstr, 250, tablef) != opcstr) { + abort(); + } getnextch(); if (nextch == '-') { @@ -270,7 +268,9 @@ int main(int argc, char **argv) nextch = fgetc (tablef); } if (nextch == ' ') { - fgets(fm, sizeof fm, tablef); + if (fgets(fm, sizeof fm, tablef) != fm) { + abort(); + } if (!strnicmp(fm, "fea", 3)) fetchmode = 1; if (!strnicmp(fm, "cea", 3)) @@ -292,12 +292,12 @@ int main(int argc, char **argv) int slen = 0; while (isspace(*opstrp)) - opstrp++; + opstrp++; osendp = opstrp; while (*osendp) { - if (!isspace (*osendp)) - slen = osendp - opstrp + 1; + if (!isspace (*osendp)) + slen = osendp - opstrp + 1; osendp++; } opstrp[slen] = 0; @@ -321,7 +321,7 @@ int main(int argc, char **argv) for(i = 0; i < 5; i++) { printf("{%d,%d}%s", flaguse[i], flagset[i], i == 4 ? "" : ","); } - printf("},%2d,_T(\"%s\"),%2d,%2d,%2d,%2d}", sduse, opstrp, head, tail, clocks, fetchmode); + printf("},0x%02x,_T(\"%s\"),%2d,%2d,%2d,%2d}", sduse, opstrp, head, tail, clocks, fetchmode); } printf("};\nint n_defs68k = %d;\n", no_insns); return 0;