From 40e650453c02dd67261c2493a1b2cc4f08dcb774 Mon Sep 17 00:00:00 2001 From: Robert Pengelly Date: Thu, 18 Jul 2024 12:31:31 +0100 Subject: [PATCH] Change variables names to non C90 --- Makefile.zpg | 37 +++++++++++++++++++++++++++++++++++++ common.c | 20 ++++++++++---------- mcopy.c | 14 +++++++------- mkfs.c | 8 ++++---- mmd.c | 8 ++++---- msdos.h | 4 ++-- 6 files changed, 64 insertions(+), 27 deletions(-) create mode 100644 Makefile.zpg diff --git a/Makefile.zpg b/Makefile.zpg new file mode 100644 index 0000000..ef6420d --- /dev/null +++ b/Makefile.zpg @@ -0,0 +1,37 @@ +#****************************************************************************** +# @file Makefile.zpg +#****************************************************************************** +AS=as370 +CC=gcc370 +LD=pdld --oformat mainframe -e __crt0 + +COPTS=-S -Os -fno-common -U__MVS__ -D__MF32__ -D__PDOSGEN__ \ + -D__NOBIVA__ -D__PDOS__ -ansi \ + -I . -I../pdos/pdpclib -I../pdos/src -I../pdos/generic +COBJ=common.obj report.obj write7x.obj + +all: clean mkdosfs.exe mcopy.exe mmd.exe mls.exe + +mkdosfs.exe: lib.obj mkfs.obj $(COBJ) + $(LD) -s -o mkdosfs.exe ../pdos/pdpclib/pgastart.o lib.obj mkfs.obj $(COBJ) + +mcopy.exe: mcopy.obj $(COBJ) + $(LD) -s -o mcopy.exe ../pdos/pdpclib/pgastart.o mcopy.obj $(COBJ) + +mmd.exe: mmd.obj $(COBJ) + $(LD) -s -o mmd.exe ../pdos/pdpclib/pgastart.o mmd.obj $(COBJ) + +mls.exe: mls.obj $(COBJ) + $(LD) -s -o mls.exe ../pdos/pdpclib/pgastart.o mls.obj $(COBJ) + +.c.obj: + $(CC) $(COPTS) $< + $(AS) -o $@ $*.s + rm -f $*.s + +clean: + rm -f *.obj + rm -f mkdosfs.exe + rm -f mcopy.exe + rm -f mmd.exe + rm -f mls.exe diff --git a/common.c b/common.c index 35241d6..9077b75 100644 --- a/common.c +++ b/common.c @@ -27,24 +27,24 @@ unsigned short generate_datestamp (void) { time_t create_time; #endif - struct tm *ctime = NULL; + struct tm *xctime = NULL; #if defined (__GNUC__) && !defined (__PDOS__) if (gettimeofday (&create_timeval, 0) == 0 && create_timeval.tv_sec != (time_t) -1) { - ctime = localtime ((time_t *) &create_timeval.tv_sec); + xctime = localtime ((time_t *) &create_timeval.tv_sec); } #else if (time (&create_time) != 0 && create_time != 0) { - ctime = localtime (&create_time); + xctime = localtime (&create_time); } #endif - if (ctime != NULL && ctime->tm_year >= 80 && ctime->tm_year <= 207) { - return (unsigned short) (ctime->tm_mday + ((ctime->tm_mon + 1) << 5) + ((ctime->tm_year - 80) << 9)); + if (xctime != NULL && xctime->tm_year >= 80 && xctime->tm_year <= 207) { + return (unsigned short) (xctime->tm_mday + ((xctime->tm_mon + 1) << 5) + ((xctime->tm_year - 80) << 9)); } return 1 + (1 << 5); @@ -59,24 +59,24 @@ unsigned short generate_timestamp (void) { time_t create_time; #endif - struct tm *ctime = NULL; + struct tm *xctime = NULL; #if defined (__GNUC__) && !defined (__PDOS__) if (gettimeofday (&create_timeval, 0) == 0 && create_timeval.tv_sec != (time_t) -1) { - ctime = localtime ((time_t *) &create_timeval.tv_sec); + xctime = localtime ((time_t *) &create_timeval.tv_sec); } #else if (time (&create_time) != 0 && create_time != 0) { - ctime = localtime (&create_time); + xctime = localtime (&create_time); } #endif - if (ctime != NULL && ctime->tm_year >= 80 && ctime->tm_year <= 207) { - return (unsigned short) ((ctime->tm_sec >> 1) + (ctime->tm_min << 5) + (ctime->tm_hour << 11)); + if (xctime != NULL && xctime->tm_year >= 80 && xctime->tm_year <= 207) { + return (unsigned short) ((xctime->tm_sec >> 1) + (xctime->tm_min << 5) + (xctime->tm_hour << 11)); } return 0; diff --git a/mcopy.c b/mcopy.c index 9db14f0..ef21690 100644 --- a/mcopy.c +++ b/mcopy.c @@ -1308,7 +1308,7 @@ static int open_file (const char *target, unsigned char *scratch, struct file_in struct msdos_dirent de; unsigned short date; - unsigned short time; + unsigned short xtime; unsigned int tempclust; @@ -1414,17 +1414,17 @@ static int open_file (const char *target, unsigned char *scratch, struct file_in } date = generate_datestamp (); - time = generate_timestamp (); + xtime = generate_timestamp (); memset (&de, 0, sizeof (de)); memcpy (de.name, filename, 11); de.attr = ATTR_ARCHIVE; - write721_to_byte_array (de.ctime, time); + write721_to_byte_array (de.xctime, xtime); write721_to_byte_array (de.cdate, date); write721_to_byte_array (de.adate, date); - write721_to_byte_array (de.time, time); + write721_to_byte_array (de.xtime, xtime); write721_to_byte_array (de.date, date); fi->pointer = 0; @@ -1459,17 +1459,17 @@ static int open_file (const char *target, unsigned char *scratch, struct file_in } date = generate_datestamp (); - time = generate_timestamp (); + xtime = generate_timestamp (); memset (&de, 0, sizeof (de)); memcpy (de.name, filename, 11); de.attr = ATTR_ARCHIVE; - write721_to_byte_array (de.ctime, time); + write721_to_byte_array (de.xctime, xtime); write721_to_byte_array (de.cdate, date); write721_to_byte_array (de.adate, date); - write721_to_byte_array (de.time, time); + write721_to_byte_array (de.xtime, xtime); write721_to_byte_array (de.date, date); fi->pointer = 0; diff --git a/mkfs.c b/mkfs.c index c768fb7..184e36d 100644 --- a/mkfs.c +++ b/mkfs.c @@ -802,7 +802,7 @@ static void establish_bpb (void) { static void add_volume_label (void) { struct msdos_dirent *de; - unsigned short date, time; + unsigned short date, xtime; unsigned char *scratch; long offset = 0; @@ -843,15 +843,15 @@ static void add_volume_label (void) { memset (de, 0, sizeof (*de)); date = generate_datestamp (); - time = generate_timestamp (); + xtime = generate_timestamp (); memcpy (de->name, state->label, 11); de->attr = ATTR_VOLUME_ID; - write721_to_byte_array (de->ctime, time); + write721_to_byte_array (de->xctime, xtime); write721_to_byte_array (de->cdate, date); write721_to_byte_array (de->adate, date); - write721_to_byte_array (de->time, time); + write721_to_byte_array (de->xtime, xtime); write721_to_byte_array (de->date, date); if (seekto (offset * 512) || fwrite (scratch, 512, 1, ofp) != 1) { diff --git a/mmd.c b/mmd.c index 65780d4..e481889 100644 --- a/mmd.c +++ b/mmd.c @@ -428,7 +428,7 @@ static int create_dir (const char *target, unsigned char *scratch) { struct msdos_dirent de; unsigned short date; - unsigned short time; + unsigned short xtime; unsigned int cluster, i; unsigned int dir_sector; @@ -507,7 +507,7 @@ static int create_dir (const char *target, unsigned char *scratch) { } date = generate_datestamp (); - time = generate_timestamp (); + xtime = generate_timestamp (); memset (&de, 0, sizeof (de)); memcpy (de.name, filename, 11); @@ -523,10 +523,10 @@ static int create_dir (const char *target, unsigned char *scratch) { de.attr = ATTR_DIR; - write721_to_byte_array (de.ctime, time); + write721_to_byte_array (de.xctime, xtime); write721_to_byte_array (de.cdate, date); write721_to_byte_array (de.adate, date); - write721_to_byte_array (de.time, time); + write721_to_byte_array (de.xtime, xtime); write721_to_byte_array (de.date, date); if (di.current_cluster == 0) { diff --git a/msdos.h b/msdos.h index 1b4464b..a4b4e4f 100644 --- a/msdos.h +++ b/msdos.h @@ -117,11 +117,11 @@ struct msdos_dirent { unsigned char attr; unsigned char lcase; unsigned char ctime_cs; - unsigned char ctime[2]; + unsigned char xctime[2]; unsigned char cdate[2]; unsigned char adate[2]; unsigned char starthi[2]; - unsigned char time[2]; + unsigned char xtime[2]; unsigned char date[2]; unsigned char startlo[2]; unsigned char size[4]; -- 2.34.1