--- hatari/src/uae-cpu/build68k.c 2019/04/01 07:10:42 1.1.1.2 +++ hatari/src/uae-cpu/build68k.c 2019/04/09 08:53:27 1.1.1.9 @@ -7,19 +7,22 @@ * * Adaptation to Hatari by Thomas Huth * - * This file is distributed under the GNU Public License, version 2 or at - * your option any later version. Read the file gpl.txt for details. + * This file is distributed under the GNU General Public License, version 2 + * or at your option any later version. Read the file gpl.txt for details. */ -static char rcsid[] = "Hatari $Id: build68k.c,v 1.1.1.2 2019/04/01 07:10:42 root Exp $"; +const char Build68k_fileid[] = "Hatari build68k.c : " __DATE__ " " __TIME__; #include #include +#include #include "readcpu.h" + static FILE *tablef; static int nextch = 0; + static void getnextch(void) { do { @@ -62,7 +65,7 @@ int main(int argc, char **argv) /*printf ("#include \"sysconfig.h\"\n");*/ printf ("#include \"sysdeps.h\"\n"); printf ("#include \"readcpu.h\"\n"); - printf ("struct instr_def defs68k[] = {\n"); + printf ("const struct instr_def defs68k[] = {\n"); #if 0 tablef = fopen("table68k","r"); if (tablef == NULL) { @@ -77,7 +80,6 @@ int main(int argc, char **argv) int cpulevel, plevel, sduse; int i; - char patbits[16]; char opcstr[256]; int bitpos[16]; int flagset[5], flaguse[5]; @@ -124,7 +126,6 @@ int main(int argc, char **argv) bitmask |= 1; if (nextch == '1') bitpattern |= 1; - patbits[i] = nextch; getnextch(); } @@ -207,7 +208,11 @@ int main(int argc, char **argv) if (nextch != ':') abort(); - fgets(opcstr, 250, tablef); + if (fgets(opcstr, 250, tablef) == NULL) { + perror("fgets"); + return -1; + } + getnextch(); { int j; @@ -215,12 +220,12 @@ int main(int argc, char **argv) char *opstrp = opcstr, *osendp; int slen = 0; - while (isspace(*opstrp)) + while (isspace((unsigned)(*opstrp))) opstrp++; osendp = opstrp; while (*osendp) { - if (!isspace (*osendp)) + if (!isspace ((unsigned)(*osendp))) slen = osendp - opstrp + 1; osendp++; }