Skip to content

Commit

Permalink
use __STDC__ flag
Browse files Browse the repository at this point in the history
  • Loading branch information
tsupplis committed Sep 30, 2021
1 parent 9169c82 commit ed0b28a
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Makefile.cpm86
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CC=aztec_cc
CFLAGS=-D__CPM86__ -D__LEGACY__
CFLAGS=-D__CPM86__
STRIP=aztec_sqz
LDFLAGS=-lm -lc86
LD=aztec_link
Expand Down
2 changes: 1 addition & 1 deletion Makefile.dos
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CC=aztec34_cc
CFLAGS=-D__MSDOS__ -D__LEGACY__
CFLAGS=-D__MSDOS__
STRIP=aztec34_sqz
LDFLAGS=-lm -lc
LD=aztec34_link
Expand Down
8 changes: 4 additions & 4 deletions bin2cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __LEGACY__
#ifdef __STDC__
#include <string.h>
#include <stdlib.h>
#endif
#include <stdio.h>
#include <errno.h>

#ifndef __LEGACY__
#ifdef __STDC__
#if defined(__APPLE__) || defined(__gnu_linux__)
#include <unistd.h>
#define BINARY_READ "rb"
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions build.sub
Original file line number Diff line number Diff line change
@@ -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
Expand Down
18 changes: 9 additions & 9 deletions cmdinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __LEGACY__
#ifdef __STDC__
#include <string.h>
#endif
#include <ctype.h>
#include <stdio.h>
#ifndef __LEGACY__
#ifdef __STDC__
#if defined(__APPLE__) || defined(__gnu_linux__)
#include <unistd.h>
#include <libgen.h>
#define PACK __attribute__((packed))
#endif
#endif
#ifndef __LEGACY__
#ifdef __STDC__
#include <stdint.h>
#include <stdlib.h>
#else
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -215,7 +215,7 @@ int display_file(out, name, extract)
return 0;
}

#ifndef __LEGACY__
#ifdef __STDC__
void usage() {
#else
usage() {
Expand All @@ -228,7 +228,7 @@ usage() {
fprintf(stderr, " - extracts data segments (d<index>-<base>.bin)\n");
}

#ifndef __LEGACY__
#ifdef __STDC__
int main(int argc, char **argv) {
#else
int main(argc, argv)
Expand Down
32 changes: 16 additions & 16 deletions exe2cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

#ifndef __LEGACY__
#ifdef __STDC__
#include <string.h>
#include <stdlib.h>
#endif
Expand All @@ -38,31 +38,31 @@ 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;
unsigned short paras;
unsigned short base;
unsigned short minparas;
unsigned short maxparas;
{
#endif
{
static unsigned char *group = cmd_header;
*group++ = type;
*group++ = (paras & 0xFF);
Expand All @@ -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)
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}

0 comments on commit ed0b28a

Please sign in to comment.