From ed0b28a831c32680faa94f2ffaee0bee21623c25 Mon Sep 17 00:00:00 2001 From: Thierry Supplisson Date: Thu, 30 Sep 2021 15:16:58 +0100 Subject: [PATCH] use __STDC__ flag --- Makefile.cpm86 | 2 +- Makefile.dos | 2 +- bin2cmd.c | 8 ++++---- build.sub | 6 +++--- cmdinfo.c | 18 +++++++++--------- exe2cmd.c | 32 ++++++++++++++++---------------- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Makefile.cpm86 b/Makefile.cpm86 index e411704..1ec9c62 100644 --- a/Makefile.cpm86 +++ b/Makefile.cpm86 @@ -1,5 +1,5 @@ CC=aztec_cc -CFLAGS=-D__CPM86__ -D__LEGACY__ +CFLAGS=-D__CPM86__ STRIP=aztec_sqz LDFLAGS=-lm -lc86 LD=aztec_link diff --git a/Makefile.dos b/Makefile.dos index 8e102f8..8d6aa39 100644 --- a/Makefile.dos +++ b/Makefile.dos @@ -1,5 +1,5 @@ CC=aztec34_cc -CFLAGS=-D__MSDOS__ -D__LEGACY__ +CFLAGS=-D__MSDOS__ STRIP=aztec34_sqz LDFLAGS=-lm -lc LD=aztec34_link diff --git a/bin2cmd.c b/bin2cmd.c index 2767d4c..4f21aab 100644 --- a/bin2cmd.c +++ b/bin2cmd.c @@ -15,14 +15,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#ifndef __LEGACY__ +#ifdef __STDC__ #include #include #endif #include #include -#ifndef __LEGACY__ +#ifdef __STDC__ #if defined(__APPLE__) || defined(__gnu_linux__) #include #define BINARY_READ "rb" @@ -40,7 +40,7 @@ unsigned char header[384]; -#ifndef __LEGACY__ +#ifdef __STDC__ int main_alt(int argc, char **argv) { #else int main_alt(argc, argv) @@ -138,7 +138,7 @@ int main_alt(argc, argv) return 0; } -#ifndef __LEGACY__ +#ifdef __STDC__ int main(int argc, char **argv) { #else int main(argc, argv) diff --git a/build.sub b/build.sub index 0d3f89f..3879524 100644 --- a/build.sub +++ b/build.sub @@ -1,10 +1,10 @@ -cc -D__CPM86__ -D__LEGACY__ -ic: cmdinfo.c +cc -D__CPM86__ -ic: cmdinfo.c sqz cmdinfo.o ln -o cmdinfo.cmd cmdinfo.o c:m.lib -lc -cc -D__CPM86__ -D__LEGACY__ -ic: bin2cmd.c +cc -D__CPM86__ -ic: bin2cmd.c sqz bin2cmd.o ln -o bin2cmd.cmd bin2cmd.o -lm -lc -cc -D__CPM86__ -D__LEGACY__ -ic: exe2cmd.c +cc -D__CPM86__ -ic: exe2cmd.c sqz exe2cmd.o ln -o exe2cmd.cmd exe2cmd.o c:m.lib -lc era cmdinfo.o diff --git a/cmdinfo.c b/cmdinfo.c index d03fe46..16ee150 100644 --- a/cmdinfo.c +++ b/cmdinfo.c @@ -15,19 +15,19 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#ifndef __LEGACY__ +#ifdef __STDC__ #include #endif #include #include -#ifndef __LEGACY__ +#ifdef __STDC__ #if defined(__APPLE__) || defined(__gnu_linux__) #include #include #define PACK __attribute__((packed)) #endif #endif -#ifndef __LEGACY__ +#ifdef __STDC__ #include #include #else @@ -65,7 +65,7 @@ char *g_type[16] = {"NULL", "CODE", "DATA", "EXTRA", "AUX #4", "SHARED CODE", "UNUSED 10", "UNUSED 11", "UNUSED 12", "UNUSED 13", "UNUSED 14", "ESCAPE CODE"}; -#ifndef __LEGACY__ +#ifdef __STDC__ void dump(FILE *out, int index, char type, uint16_t base, uint16_t length, long offset, FILE *fin) { #else @@ -131,7 +131,7 @@ void dump(out, index, type, base, length, offset, fin) fclose(fout); } -#ifndef __LEGACY__ +#ifdef __STDC__ void display_header(FILE *out, const char *name, int index, header_t *header, long *offset, FILE *fin) { #else @@ -167,7 +167,7 @@ display_header(out, name, index, header, offset, fin) *offset += header->length*16; } -#ifndef __LEGACY__ +#ifdef __STDC__ void display_header_block(FILE *out, const char *name, header_block_t *block, FILE *fin) { #else @@ -186,7 +186,7 @@ display_header_block(out, name, block, fin) } } -#ifndef __LEGACY__ +#ifdef __STDC__ int display_file(FILE *out, const char *name, int extract) { #else int display_file(out, name, extract) @@ -215,7 +215,7 @@ int display_file(out, name, extract) return 0; } -#ifndef __LEGACY__ +#ifdef __STDC__ void usage() { #else usage() { @@ -228,7 +228,7 @@ usage() { fprintf(stderr, " - extracts data segments (d-.bin)\n"); } -#ifndef __LEGACY__ +#ifdef __STDC__ int main(int argc, char **argv) { #else int main(argc, argv) diff --git a/exe2cmd.c b/exe2cmd.c index 6e1ff94..630d2ae 100644 --- a/exe2cmd.c +++ b/exe2cmd.c @@ -18,7 +18,7 @@ * */ -#ifndef __LEGACY__ +#ifdef __STDC__ #include #include #endif @@ -38,22 +38,22 @@ unsigned char cmd_header[0x80]; /* Read a word from the EXE header */ -#ifndef __LEGACY__ -unsigned short peek(int offset) { +#ifdef __STDC__ +unsigned short peek(int offset) #else unsigned short peek(offset) int offset; -{ #endif +{ unsigned short l = exe_header[offset]; unsigned short h = exe_header[offset + 1]; return (h << 8) | l; } /* Add a group to the CMD header */ -#ifndef __LEGACY__ +#ifdef __STDC__ void addgroup(int type, unsigned short paras, unsigned short base, - unsigned short minparas, unsigned short maxparas) { + unsigned short minparas, unsigned short maxparas) #else addgroup(type, paras, base, minparas, maxparas) int type; @@ -61,8 +61,8 @@ addgroup(type, paras, base, minparas, maxparas) unsigned short base; unsigned short minparas; unsigned short maxparas; -{ #endif +{ static unsigned char *group = cmd_header; *group++ = type; *group++ = (paras & 0xFF); @@ -79,15 +79,15 @@ addgroup(type, paras, base, minparas, maxparas) /* Copy bytes from one file to another. * TODO: Warn if error. */ -#ifndef __LEGACY__ -void mvbytes(FILE *fpexe, FILE *fpcmd, long count) { +#ifdef __STDC__ +void mvbytes(FILE *fpexe, FILE *fpcmd, long count) #else mvbytes(fpexe,fpcmd,count) FILE *fpexe; FILE *fpcmd; long count; -{ #endif +{ int c; while (count) @@ -99,14 +99,14 @@ mvbytes(fpexe,fpcmd,count) } -#ifndef __LEGACY__ -int main_alt(int argc, char **argv) { +#ifdef __STDC__ +int main_alt(int argc, char **argv) #else int main_alt(argc, argv) int argc; char **argv; -{ #endif +{ FILE *fpexe, *fpcmd; unsigned short cseg,dseg,sseg,dstop; unsigned short dsmin, dsmax, exeparas; @@ -228,14 +228,14 @@ int main_alt(argc, argv) return 0; } -#ifndef __LEGACY__ -int main(int argc, char **argv) { +#ifdef __STDC__ +int main(int argc, char **argv) #else int main(argc, argv) int argc; char **argv; -{ #endif +{ exit(main_alt(argc,argv)); return 0; }