Cleaned up the DOS port a bit.

This commit is contained in:
stainless
2001-08-29 03:39:25 +00:00
parent 85d5849d7e
commit dd8da1dcfd
4 changed files with 1259 additions and 1232 deletions

View File

@@ -19,9 +19,14 @@
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
#include <zlib.h> #include <zlib.h>
#ifdef ZDOS
#include <dos.h> #include <dos.h>
#endif #include <fcntl.h>
#include <share.h>
#include <sys/stat.h>
#include <unistd.h>
/* #ifdef ZDOS
#include <dos.h>
#endif */
#define DWORD unsigned int #define DWORD unsigned int
@@ -158,7 +163,7 @@ DWORD ZCloseFile()
DWORD ZFileSeek() DWORD ZFileSeek()
{ {
int res = 0; /*int res = 0;*/
int mode = 0; int mode = 0;
if (ZFileSeekMode==0) if (ZFileSeekMode==0)
mode = SEEK_SET; mode = SEEK_SET;
@@ -237,7 +242,8 @@ DWORD ZFileGetFTime()
DWORD ZFileMKDir() DWORD ZFileMKDir()
{ {
return(mkdir(MKPath)); /*return(mkdir(MKPath));*/
return (mkdir(MKPath, S_IWUSR));
} }
DWORD ZFileCHDir() DWORD ZFileCHDir()
@@ -252,7 +258,8 @@ DWORD ZFileRMDir()
DWORD ZFileGetDir() DWORD ZFileGetDir()
{ {
return(getcwd(DirName,128)); /*return(getcwd(DirName,128));*/
return(*getcwd(DirName,128));
} }
BYTE * ZFileFindPATH; BYTE * ZFileFindPATH;
@@ -270,12 +277,15 @@ DWORD DTALocPos;
DWORD ZFileFindFirst() DWORD ZFileFindFirst()
{ {
return(_dos_findfirst(ZFileFindPATH,ZFileFindATTRIB,DTALocPos)); /*return(_dos_findfirst(ZFileFindPATH,ZFileFindATTRIB,DTALocPos));*/
return(_dos_findfirst(ZFileFindPATH,ZFileFindATTRIB,((struct find_t *)DTALocPos)));
} }
DWORD ZFileFindNext() DWORD ZFileFindNext()
{ {
return(_dos_findnext(DTALocPos)); /*return(_dos_findnext(DTALocPos));*/
return(_dos_findnext(((struct find_t *) DTALocPos)));
} }
DWORD ZFileFindEnd() // for compatibility with windows later DWORD ZFileFindEnd() // for compatibility with windows later
@@ -312,7 +322,8 @@ DWORD GetDate()
struct tm *newtime; struct tm *newtime;
time_t long_time; time_t long_time;
time( &long_time ); /*time( &long_time );*/
long_time = time (NULL);
newtime = localtime( &long_time ); newtime = localtime( &long_time );
value = ((newtime->tm_mday) % 10)+((newtime->tm_mday)/10)*16 value = ((newtime->tm_mday) % 10)+((newtime->tm_mday)/10)*16
+(((newtime->tm_mon)+1) << 8) +(((newtime->tm_mon)+1) << 8)

View File

@@ -18,6 +18,10 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <stdlib.h>
#include <string.h>
int pccmdline(void);
extern void zstart(void); extern void zstart(void);
extern void DosExit(void); extern void DosExit(void);
@@ -58,6 +62,7 @@ int main(int margc, char **margv)
argc=margc; argc=margc;
argv=margv; argv=margv;
zstart(); zstart();
return(0);
} }

View File

@@ -59,7 +59,7 @@ MAINOBJ=cfgload.o endmem.o fixsin.o init.o ui.o vcache.o water.o
OBJS=${CHIPSOBJ} ${CPUOBJ} ${DOSOBJ} ${GUIOBJ} ${VIDEOBJ} ${PREOBJ} ${MAINOBJ} ${ZIPOBJ} OBJS=${CHIPSOBJ} ${CPUOBJ} ${DOSOBJ} ${GUIOBJ} ${VIDEOBJ} ${PREOBJ} ${MAINOBJ} ${ZIPOBJ}
LIBS=-lz -lgcc -lm -lpng LIBS=-lz -lgcc -lm -lpng
CFLAGS=-D__MSDOS__ -O2 CFLAGS=-O2 -fomit-frame-pointer -Wall -D__MSDOS__
ASM=nasm ASM=nasm
ASMFLAGS=-f coff -D__MSDOS__ ASMFLAGS=-f coff -D__MSDOS__
CC=gcc CC=gcc

View File

@@ -25,6 +25,11 @@
#include <time.h> #include <time.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <utime.h>
#endif
#ifdef __MSDOS__
#include <sys/stat.h>
#endif #endif
#include "unzip.h" #include "unzip.h"
@@ -42,11 +47,13 @@ unsigned int ZipError=0;
// 6 : Error Writing file // 6 : Error Writing file
#ifndef __LINUX__ #ifndef __LINUX__
#ifndef __MSDOS__
struct utimbuf { struct utimbuf {
time_t actime; time_t actime;
time_t modtime; time_t modtime;
}; };
#endif #endif
#endif
void change_file_date(const char *filename,uLong dosdate,tm_unz tmu_date) void change_file_date(const char *filename,uLong dosdate,tm_unz tmu_date)
{ {
@@ -72,9 +79,13 @@ int mymkdir(const char *dirname)
{ {
#ifdef __LINUX__ #ifdef __LINUX__
return(mkdir(dirname, (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH))); return(mkdir(dirname, (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)));
#else
#ifdef __MSDOS__
return(mkdir(dirname, (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)));
#else #else
return(mkdir(dirname)); return(mkdir(dirname));
#endif #endif
#endif
} }
int makedir (char *newdir) int makedir (char *newdir)