home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 9 Archive
/
09-Archive.zip
/
unzip511.zip
/
os2
/
watcom.dif
< prev
next >
Wrap
Internet Message Format
|
1994-07-27
|
12KB
Date: Tue, 26 Jul 1994 00:33:40 +0200
From: Kai Uwe Rommel <rommel@ars.muc.de>
Ok, Watcom support is done now. All four targets (MS-DOS and OS/2,
each of them both 16- and 32-bit) work now. The patches are quite
minor, again. The version() code is fixed for Watcom now too.
Greg, please ignore the patches sent in the first message, the
following patches are relative to original 5.11g.
diff -cbr unzip/envargs.c unzip-2/envargs.c
*** unzip/envargs.c Thu Apr 21 10:02:16 1994
--- unzip-2/envargs.c Mon Jul 25 23:25:26 1994
***************
*** 180,186 ****
--- 180,188 ----
char ***argvp;
{
#ifndef MSC /* declared differently in MSC 7.0 headers, at least */
+ #ifndef __WATCOMC__
extern char **environ; /* environment */
+ #endif
#endif
char **envp; /* pointer into environment */
char **newargv; /* new argument list */
diff -cbr unzip/msdos/msdos.c unzip-2/msdos/msdos.c
*** unzip/msdos/msdos.c Fri Jul 22 13:18:30 1994
--- unzip-2/msdos/msdos.c Tue Jul 26 00:02:34 1994
***************
*** 37,45 ****
static int renamed_fullpath; /* ditto */
static unsigned nLabelDrive; /* ditto, plus volumelabel() */
! #if (defined(__GO32__) || defined(__EMX__))
! # define MKDIR(path,mode) mkdir(path,mode)
# include <dirent.h> /* use readdir() */
# define direct dirent
# define Opendir opendir
# define Readdir readdir
--- 37,57 ----
static int renamed_fullpath; /* ditto */
static unsigned nLabelDrive; /* ditto, plus volumelabel() */
! #if (defined(__WATCOMC__) && defined(__386__))
! # define WREGS(v,r) (v##.w.##r)
! # define int86x int386x
! #else
! # define WREGS(v,r) (v##.x.##r)
! #endif
!
! #if (defined(__GO32__) || defined(__EMX__) || defined(__WATCOMC__))
! # ifdef __WATCOMC__
! # include <direct.h>
! # define MKDIR(path,mode) mkdir(path)
! # else
# include <dirent.h> /* use readdir() */
+ # define MKDIR(path,mode) mkdir(path,mode)
+ # endif
# define direct dirent
# define Opendir opendir
# define Readdir readdir
***************
*** 774,791 ****
regs.h.bl = (uch)nDrive;
#ifdef __EMX__
_int86(0x21, ®s, ®s);
! if (regs.x.flags & 1)
#else
intdos(®s, ®s);
! if (regs.x.cflag) /* error: do default a/b check instead */
#endif
{
Trace((stderr,
"error in DOS function 0x44 (AX = 0x%04x): guessing instead...\n",
! regs.x.ax));
return (nDrive == 1 || nDrive == 2)? TRUE : FALSE;
} else
! return regs.x.ax? FALSE : TRUE;
}
--- 786,803 ----
regs.h.bl = (uch)nDrive;
#ifdef __EMX__
_int86(0x21, ®s, ®s);
! if (WREGS(regs,flags) & 1)
#else
intdos(®s, ®s);
! if (WREGS(regs,cflag)) /* error: do default a/b check instead */
#endif
{
Trace((stderr,
"error in DOS function 0x44 (AX = 0x%04x): guessing instead...\n",
! WREGS(regs,ax)));
return (nDrive == 1 || nDrive == 2)? TRUE : FALSE;
} else
! return WREGS(regs,ax)? FALSE : TRUE;
}
***************
*** 854,874 ****
/* set the disk transfer address for subsequent FCB calls */
sregs.ds = FP_SEG(pdta);
! regs.x.dx = FP_OFF(pdta);
! Trace((stderr, "segment:offset of pdta = %x:%x\n", sregs.ds, regs.x.dx));
Trace((stderr, "&dta = %lx, pdta = %lx\n", (ulg)&dta, (ulg)pdta));
regs.h.ah = 0x1a;
intdosx(®s, ®s, &sregs);
/* fill in the FCB */
sregs.ds = FP_SEG(pfcb);
! regs.x.dx = FP_OFF(pfcb);
pfcb->flag = 0xff; /* extended FCB */
pfcb->vattr = 0x08; /* attribute: disk volume label */
pfcb->drive = (uch)nLabelDrive;
#ifdef DEBUG
! Trace((stderr, "segment:offset of pfcb = %x:%x\n", sregs.ds, regs.x.dx));
Trace((stderr, "&fcb = %lx, pfcb = %lx\n", (ulg)&fcb, (ulg)pfcb));
Trace((stderr, "(2nd check: labelling drive %c:)\n", pfcb->drive-1+'A'));
if (pfcb->flag != fcb.flag)
--- 866,886 ----
/* set the disk transfer address for subsequent FCB calls */
sregs.ds = FP_SEG(pdta);
! WREGS(regs,dx) = FP_OFF(pdta);
! Trace((stderr, "segment:offset of pdta = %x:%x\n", sregs.ds, WREGS(regs,dx)));
Trace((stderr, "&dta = %lx, pdta = %lx\n", (ulg)&dta, (ulg)pdta));
regs.h.ah = 0x1a;
intdosx(®s, ®s, &sregs);
/* fill in the FCB */
sregs.ds = FP_SEG(pfcb);
! WREGS(regs,dx) = FP_OFF(pfcb);
pfcb->flag = 0xff; /* extended FCB */
pfcb->vattr = 0x08; /* attribute: disk volume label */
pfcb->drive = (uch)nLabelDrive;
#ifdef DEBUG
! Trace((stderr, "segment:offset of pfcb = %x:%x\n", sregs.ds, WREGS(regs,dx)));
Trace((stderr, "&fcb = %lx, pfcb = %lx\n", (ulg)&fcb, (ulg)pfcb));
Trace((stderr, "(2nd check: labelling drive %c:)\n", pfcb->drive-1+'A'));
if (pfcb->flag != fcb.flag)
***************
*** 894,900 ****
strncpy((char *)fcb.vn, "???????????", 11); /* i.e., "*.*" */
Trace((stderr, "fcb.vn = %lx\n", (ulg)fcb.vn));
Trace((stderr, "regs.h.ah = %x, regs.x.dx = %04x, sregs.ds = %04x\n",
! regs.h.ah, regs.x.dx, sregs.ds));
Trace((stderr, "flag = %x, drive = %d, vattr = %x, vn = %s = %s.\n",
fcb.flag, fcb.drive, fcb.vattr, fcb.vn, pfcb->vn));
intdosx(®s, ®s, &sregs);
--- 906,912 ----
strncpy((char *)fcb.vn, "???????????", 11); /* i.e., "*.*" */
Trace((stderr, "fcb.vn = %lx\n", (ulg)fcb.vn));
Trace((stderr, "regs.h.ah = %x, regs.x.dx = %04x, sregs.ds = %04x\n",
! regs.h.ah, WREGS(regs,dx), sregs.ds));
Trace((stderr, "flag = %x, drive = %d, vattr = %x, vn = %s = %s.\n",
fcb.flag, fcb.drive, fcb.vattr, fcb.vn, pfcb->vn));
intdosx(®s, ®s, &sregs);
***************
*** 1058,1065 ****
union REGS regs;
sregs.ds = FP_SEG(CountryInfo);
! regs.x.dx = FP_OFF(CountryInfo);
! regs.x.ax = 0x3800;
int86x(0x21, ®s, ®s, &sregs);
#else /* __GO32__ || __EMX__ */
--- 1070,1077 ----
union REGS regs;
sregs.ds = FP_SEG(CountryInfo);
! WREGS(regs,dx) = FP_OFF(CountryInfo);
! WREGS(regs,ax) = 0x3800;
int86x(0x21, ®s, ®s, &sregs);
#else /* __GO32__ || __EMX__ */
diff -cbr unzip/os2/makefile.os2 unzip-2/os2/makefile.os2
*** unzip/os2/makefile.os2 Sun Jul 10 23:53:12 1994
--- unzip-2/os2/makefile.os2 Tue Jul 26 00:28:12 1994
***************
*** 32,37 ****
--- 32,38 ----
# For Watcom C/386, edit the os2$(OBJ) target so that os2/os2.c reads
# os2\os2.c instead. Watcom can't handle forward slashes; gcc can't
# handle backslashes. We'll see about making this a macro next time...
+ # Same for msdos/msdos.c ...
default:
@echo "Enter `$(MAKE) -f makefile.os2 target' with makefile.os2 copied"
***************
*** 59,65 ****
CC="cl -nologo -AS -Oaict -Gs -I. $(FP)" \
CFLAGS="-Zp1 -W3" \
NFLAGS="" \
! LDFLAGS="-F 0c00 -Lr -Fe" \
LDFLAGS2="-link /noe /exe" \
OUT="-Fo" \
OBJ=".obj" \
--- 60,66 ----
CC="cl -nologo -AS -Oaict -Gs -I. $(FP)" \
CFLAGS="-Zp1 -W3" \
NFLAGS="" \
! LDFLAGS="-F 0C00 -Lr -Fe" \
LDFLAGS2="-link /noe /exe" \
OUT="-Fo" \
OBJ=".obj" \
***************
*** 114,130 ****
OBJ=".obj" \
DEF="os2\unzip.def"
! # Watcom C/386 9.0
watcom:
$(MAKE) -f makefile.os2 all \
CC="wcl386 -zq -Ox -s -I." \
CFLAGS="-Zp1 -DOS2" \
NFLAGS="" \
! LDFLAGS="-k0x40000 -x -Fe=" \
LDFLAGS2="" \
OUT="-Fo" \
OBJ=".obj" \
DEF=""
# Borland C++
borland:
--- 115,168 ----
OBJ=".obj" \
DEF="os2\unzip.def"
! # Watcom C/386 9.0 or higher
watcom:
$(MAKE) -f makefile.os2 all \
CC="wcl386 -zq -Ox -s -I." \
CFLAGS="-Zp1 -DOS2" \
NFLAGS="" \
! LDFLAGS="-k0x40000 -x -l=os2v2 -Fe=" \
LDFLAGS2="" \
OUT="-Fo" \
OBJ=".obj" \
DEF=""
+
+ # Watcom C/286 9.0 or higher
+ watcom16:
+ $(MAKE) -f makefile.os2 all \
+ CC="wcl -zq -ml -Ox -s -I." \
+ CFLAGS="-Zp1 -DOS2" \
+ NFLAGS="" \
+ LDFLAGS="-k0x2000 -x -l=os2 -Fe=" \
+ LDFLAGS2="" \
+ OUT="-Fo" \
+ OBJ=".obj"
+
+ # Watcom C/386 9.0 or higher, crosscompilation for DOS
+ watcomdos:
+ $(MAKE) -f makefile.os2 all \
+ CC="wcl386 -zq -Ox -s -I." \
+ CFLAGS="-Zp1 -DMSDOS" \
+ NFLAGS="" \
+ LDFLAGS="-k0x40000 -x -l=dos4g -Fe=" \
+ LDFLAGS2="" \
+ OUT="-Fo" \
+ OBJ=".obj" \
+ OBJU2="msdos.obj" \
+ OBJX2="msdos_.obj"
+
+ # Watcom C/286 9.0 or higher, crosscompilation for DOS
+ watcom16dos:
+ $(MAKE) -f makefile.os2 all \
+ CC="wcl -zq -mm -Ox -s -I." \
+ CFLAGS="-Zp1 -DMSDOS" \
+ NFLAGS="" \
+ LDFLAGS="-k0xC00 -x -l=dos -Fe=" \
+ LDFLAGS2="" \
+ OUT="-Fo" \
+ OBJ=".obj" \
+ OBJU2="msdos.obj" \
+ OBJX2="msdos_.obj"
# Borland C++
borland:
diff -cbr unzip/os2/os2.c unzip-2/os2/os2.c
*** unzip/os2/os2.c Fri Jul 22 13:29:44 1994
--- unzip-2/os2/os2.c Tue Jul 26 00:29:00 1994
***************
*** 73,78 ****
--- 73,79 ----
#define INCL_DOSDEVICES
#define INCL_DOSDEVIOCTL
#define INCL_DOSERRORS
+ #define INCL_DOSMISC
#include <os2.h>
#ifdef __32BIT__
***************
*** 229,238 ****
#endif
- #ifdef __WATCOMC__
- unsigned char __near _osmode = OS2_MODE;
- #endif
-
#ifndef SFX
static char *getdirent(char *);
static void free_dircontents(struct _dircontents *);
--- 230,235 ----
***************
*** 450,474 ****
char *GetLoadPath(void)
{
#ifdef __32BIT__ /* generic for 32-bit API */
-
PTIB pptib;
PPIB pppib;
char *szPath;
DosGetInfoBlocks(&pptib, &pppib);
szPath = pppib -> pib_pchenv;
while (*szPath) /* find end of process environment */
szPath = strchr(szPath, 0) + 1;
return szPath + 1; /* .exe file name follows environment */
- #else /* 16-bit, specific for MS C 6.00, note: requires large data model */
-
- extern char _far *_pgmptr;
- return _pgmptr;
-
- #endif
} /* end function GetLoadPath() */
--- 447,472 ----
char *GetLoadPath(void)
{
#ifdef __32BIT__ /* generic for 32-bit API */
PTIB pptib;
PPIB pppib;
char *szPath;
DosGetInfoBlocks(&pptib, &pppib);
szPath = pppib -> pib_pchenv;
+ #else /* 16-bit, note: requires large data model */
+ SEL selEnv;
+ USHORT offCmd;
+ char *szPath;
+
+ DosGetEnv(&selEnv, &offCmd);
+ szPath = MAKEP(selEnv, 0);
+ #endif
while (*szPath) /* find end of process environment */
szPath = strchr(szPath, 0) + 1;
return szPath + 1; /* .exe file name follows environment */
} /* end function GetLoadPath() */
***************
*** 689,698 ****
PFSQBUFFER pData = (PFSQBUFFER) bData;
#endif
- if ( _osmode == DOS_MODE )
- return TRUE;
- else
- {
/* We separate FAT and HPFS+other file systems here.
at the moment I consider other systems to be similar to HPFS,
i.e. support long file names and case sensitive */
--- 687,692 ----
***************
*** 719,725 ****
/* End of this ugly code */
return nResult;
- }
} /* end function IsFileSystemFAT() */
--- 713,718 ----
***************
*** 1398,1404 ****
ULONG action;
#else
USHORT rc;
! UINT action;
#endif
--- 1391,1397 ----
ULONG action;
#else
USHORT rc;
! USHORT action;
#endif
diff -cbr unzip/unzip.h unzip-2/unzip.h
*** unzip/unzip.h Fri Jul 22 13:32:44 1994
--- unzip-2/unzip.h Tue Jul 26 00:14:20 1994
***************
*** 436,446 ****
--- 436,448 ----
#endif
#ifdef __WATCOMC__
+ # ifdef __386__
# define __32BIT__
# undef far
# define far
# undef near
# define near
+ # endif
# define PIPE_ERROR (errno == -1)
#endif
***************
*** 769,775 ****
#endif
/* GRR: NT defines MSDOS?? */
! #if (!defined(MSDOS) && !defined(__IBMC__)) || defined(NT)
# define near
# define far
#endif
--- 771,777 ----
#endif
/* GRR: NT defines MSDOS?? */
! #if (!defined(MSDOS) && !defined(__IBMC__) && defined(__32BIT__)) || defined(NT)
# define near
# define far
#endif