home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / unzip511.zip / os2 / watcom.dif < prev    next >
Internet Message Format  |  1994-07-27  |  12KB

  1. Date: Tue, 26 Jul 1994 00:33:40 +0200
  2. From: Kai Uwe Rommel <rommel@ars.muc.de>
  3.  
  4. Ok, Watcom support is done now. All four targets (MS-DOS and OS/2,
  5. each of them both 16- and 32-bit) work now. The patches are quite
  6. minor, again. The version() code is fixed for Watcom now too.
  7.  
  8. Greg, please ignore the patches sent in the first message, the
  9. following patches are relative to original 5.11g.
  10.  
  11.  
  12. diff -cbr unzip/envargs.c unzip-2/envargs.c
  13. *** unzip/envargs.c    Thu Apr 21 10:02:16 1994
  14. --- unzip-2/envargs.c    Mon Jul 25 23:25:26 1994
  15. ***************
  16. *** 180,186 ****
  17. --- 180,188 ----
  18.       char ***argvp;
  19.   {
  20.   #ifndef MSC /* declared differently in MSC 7.0 headers, at least */
  21. + #ifndef __WATCOMC__
  22.       extern char **environ;          /* environment */
  23. + #endif
  24.   #endif
  25.       char        **envp;             /* pointer into environment */
  26.       char        **newargv;          /* new argument list */
  27. diff -cbr unzip/msdos/msdos.c unzip-2/msdos/msdos.c
  28. *** unzip/msdos/msdos.c    Fri Jul 22 13:18:30 1994
  29. --- unzip-2/msdos/msdos.c    Tue Jul 26 00:02:34 1994
  30. ***************
  31. *** 37,45 ****
  32.   static int renamed_fullpath;   /* ditto */
  33.   static unsigned nLabelDrive;   /* ditto, plus volumelabel() */
  34.   
  35. ! #if (defined(__GO32__) || defined(__EMX__))
  36. ! #  define MKDIR(path,mode)   mkdir(path,mode)
  37.   #  include <dirent.h>        /* use readdir() */
  38.   #  define direct dirent
  39.   #  define Opendir opendir
  40.   #  define Readdir readdir
  41. --- 37,57 ----
  42.   static int renamed_fullpath;   /* ditto */
  43.   static unsigned nLabelDrive;   /* ditto, plus volumelabel() */
  44.   
  45. ! #if (defined(__WATCOMC__) && defined(__386__))
  46. ! #  define WREGS(v,r) (v##.w.##r)
  47. ! #  define int86x int386x
  48. ! #else
  49. ! #  define WREGS(v,r) (v##.x.##r)
  50. ! #endif
  51. ! #if (defined(__GO32__) || defined(__EMX__) || defined(__WATCOMC__))
  52. ! #  ifdef __WATCOMC__
  53. ! #    include <direct.h>
  54. ! #    define MKDIR(path,mode)   mkdir(path)
  55. ! #  else
  56.   #    include <dirent.h>        /* use readdir() */
  57. + #    define MKDIR(path,mode)   mkdir(path,mode)
  58. + #  endif
  59.   #  define direct dirent
  60.   #  define Opendir opendir
  61.   #  define Readdir readdir
  62. ***************
  63. *** 774,791 ****
  64.       regs.h.bl = (uch)nDrive;
  65.   #ifdef __EMX__
  66.       _int86(0x21, ®s, ®s);
  67. !     if (regs.x.flags & 1)
  68.   #else
  69.       intdos(®s, ®s);
  70. !     if (regs.x.cflag)        /* error:  do default a/b check instead */
  71.   #endif
  72.       {
  73.           Trace((stderr,
  74.             "error in DOS function 0x44 (AX = 0x%04x):  guessing instead...\n",
  75. !           regs.x.ax));
  76.           return (nDrive == 1 || nDrive == 2)? TRUE : FALSE;
  77.       } else
  78. !         return regs.x.ax? FALSE : TRUE;
  79.   }
  80.   
  81.   
  82. --- 786,803 ----
  83.       regs.h.bl = (uch)nDrive;
  84.   #ifdef __EMX__
  85.       _int86(0x21, ®s, ®s);
  86. !     if (WREGS(regs,flags) & 1)
  87.   #else
  88.       intdos(®s, ®s);
  89. !     if (WREGS(regs,cflag))        /* error:  do default a/b check instead */
  90.   #endif
  91.       {
  92.           Trace((stderr,
  93.             "error in DOS function 0x44 (AX = 0x%04x):  guessing instead...\n",
  94. !           WREGS(regs,ax)));
  95.           return (nDrive == 1 || nDrive == 2)? TRUE : FALSE;
  96.       } else
  97. !         return WREGS(regs,ax)? FALSE : TRUE;
  98.   }
  99.   
  100.   
  101. ***************
  102. *** 854,874 ****
  103.   
  104.       /* set the disk transfer address for subsequent FCB calls */
  105.       sregs.ds = FP_SEG(pdta);
  106. !     regs.x.dx = FP_OFF(pdta);
  107. !     Trace((stderr, "segment:offset of pdta = %x:%x\n", sregs.ds, regs.x.dx));
  108.       Trace((stderr, "&dta = %lx, pdta = %lx\n", (ulg)&dta, (ulg)pdta));
  109.       regs.h.ah = 0x1a;
  110.       intdosx(®s, ®s, &sregs);
  111.   
  112.       /* fill in the FCB */
  113.       sregs.ds = FP_SEG(pfcb);
  114. !     regs.x.dx = FP_OFF(pfcb);
  115.       pfcb->flag = 0xff;          /* extended FCB */
  116.       pfcb->vattr = 0x08;         /* attribute:  disk volume label */
  117.       pfcb->drive = (uch)nLabelDrive;
  118.   
  119.   #ifdef DEBUG
  120. !     Trace((stderr, "segment:offset of pfcb = %x:%x\n", sregs.ds, regs.x.dx));
  121.       Trace((stderr, "&fcb = %lx, pfcb = %lx\n", (ulg)&fcb, (ulg)pfcb));
  122.       Trace((stderr, "(2nd check:  labelling drive %c:)\n", pfcb->drive-1+'A'));
  123.       if (pfcb->flag != fcb.flag)
  124. --- 866,886 ----
  125.   
  126.       /* set the disk transfer address for subsequent FCB calls */
  127.       sregs.ds = FP_SEG(pdta);
  128. !     WREGS(regs,dx) = FP_OFF(pdta);
  129. !     Trace((stderr, "segment:offset of pdta = %x:%x\n", sregs.ds, WREGS(regs,dx)));
  130.       Trace((stderr, "&dta = %lx, pdta = %lx\n", (ulg)&dta, (ulg)pdta));
  131.       regs.h.ah = 0x1a;
  132.       intdosx(®s, ®s, &sregs);
  133.   
  134.       /* fill in the FCB */
  135.       sregs.ds = FP_SEG(pfcb);
  136. !     WREGS(regs,dx) = FP_OFF(pfcb);
  137.       pfcb->flag = 0xff;          /* extended FCB */
  138.       pfcb->vattr = 0x08;         /* attribute:  disk volume label */
  139.       pfcb->drive = (uch)nLabelDrive;
  140.   
  141.   #ifdef DEBUG
  142. !     Trace((stderr, "segment:offset of pfcb = %x:%x\n", sregs.ds, WREGS(regs,dx)));
  143.       Trace((stderr, "&fcb = %lx, pfcb = %lx\n", (ulg)&fcb, (ulg)pfcb));
  144.       Trace((stderr, "(2nd check:  labelling drive %c:)\n", pfcb->drive-1+'A'));
  145.       if (pfcb->flag != fcb.flag)
  146. ***************
  147. *** 894,900 ****
  148.       strncpy((char *)fcb.vn, "???????????", 11);   /* i.e., "*.*" */
  149.       Trace((stderr, "fcb.vn = %lx\n", (ulg)fcb.vn));
  150.       Trace((stderr, "regs.h.ah = %x, regs.x.dx = %04x, sregs.ds = %04x\n",
  151. !       regs.h.ah, regs.x.dx, sregs.ds));
  152.       Trace((stderr, "flag = %x, drive = %d, vattr = %x, vn = %s = %s.\n",
  153.         fcb.flag, fcb.drive, fcb.vattr, fcb.vn, pfcb->vn));
  154.       intdosx(®s, ®s, &sregs);
  155. --- 906,912 ----
  156.       strncpy((char *)fcb.vn, "???????????", 11);   /* i.e., "*.*" */
  157.       Trace((stderr, "fcb.vn = %lx\n", (ulg)fcb.vn));
  158.       Trace((stderr, "regs.h.ah = %x, regs.x.dx = %04x, sregs.ds = %04x\n",
  159. !       regs.h.ah, WREGS(regs,dx), sregs.ds));
  160.       Trace((stderr, "flag = %x, drive = %d, vattr = %x, vn = %s = %s.\n",
  161.         fcb.flag, fcb.drive, fcb.vattr, fcb.vn, pfcb->vn));
  162.       intdosx(®s, ®s, &sregs);
  163. ***************
  164. *** 1058,1065 ****
  165.       union REGS regs;
  166.   
  167.       sregs.ds  = FP_SEG(CountryInfo);
  168. !     regs.x.dx = FP_OFF(CountryInfo);
  169. !     regs.x.ax = 0x3800;
  170.       int86x(0x21, ®s, ®s, &sregs);
  171.   
  172.   #else /* __GO32__ || __EMX__ */
  173. --- 1070,1077 ----
  174.       union REGS regs;
  175.   
  176.       sregs.ds  = FP_SEG(CountryInfo);
  177. !     WREGS(regs,dx) = FP_OFF(CountryInfo);
  178. !     WREGS(regs,ax) = 0x3800;
  179.       int86x(0x21, ®s, ®s, &sregs);
  180.   
  181.   #else /* __GO32__ || __EMX__ */
  182. diff -cbr unzip/os2/makefile.os2 unzip-2/os2/makefile.os2
  183. *** unzip/os2/makefile.os2    Sun Jul 10 23:53:12 1994
  184. --- unzip-2/os2/makefile.os2    Tue Jul 26 00:28:12 1994
  185. ***************
  186. *** 32,37 ****
  187. --- 32,38 ----
  188.   #   For Watcom C/386, edit the os2$(OBJ) target so that os2/os2.c reads
  189.   #   os2\os2.c instead.  Watcom can't handle forward slashes; gcc can't
  190.   #   handle backslashes.  We'll see about making this a macro next time...
  191. + #   Same for msdos/msdos.c ...
  192.   
  193.   default:
  194.       @echo "Enter `$(MAKE) -f makefile.os2 target' with makefile.os2 copied"
  195. ***************
  196. *** 59,65 ****
  197.       CC="cl -nologo -AS -Oaict -Gs -I. $(FP)" \
  198.       CFLAGS="-Zp1 -W3" \
  199.       NFLAGS="" \
  200. !     LDFLAGS="-F 0c00 -Lr -Fe" \
  201.       LDFLAGS2="-link /noe /exe" \
  202.       OUT="-Fo" \
  203.       OBJ=".obj" \
  204. --- 60,66 ----
  205.       CC="cl -nologo -AS -Oaict -Gs -I. $(FP)" \
  206.       CFLAGS="-Zp1 -W3" \
  207.       NFLAGS="" \
  208. !     LDFLAGS="-F 0C00 -Lr -Fe" \
  209.       LDFLAGS2="-link /noe /exe" \
  210.       OUT="-Fo" \
  211.       OBJ=".obj" \
  212. ***************
  213. *** 114,130 ****
  214.       OBJ=".obj" \
  215.       DEF="os2\unzip.def"
  216.   
  217. ! # Watcom C/386 9.0
  218.   watcom:
  219.       $(MAKE) -f makefile.os2 all \
  220.       CC="wcl386 -zq -Ox -s -I." \
  221.       CFLAGS="-Zp1 -DOS2" \
  222.       NFLAGS="" \
  223. !     LDFLAGS="-k0x40000 -x -Fe=" \
  224.       LDFLAGS2="" \
  225.       OUT="-Fo" \
  226.       OBJ=".obj" \
  227.       DEF=""
  228.   
  229.   # Borland C++
  230.   borland:
  231. --- 115,168 ----
  232.       OBJ=".obj" \
  233.       DEF="os2\unzip.def"
  234.   
  235. ! # Watcom C/386 9.0 or higher
  236.   watcom:
  237.       $(MAKE) -f makefile.os2 all \
  238.       CC="wcl386 -zq -Ox -s -I." \
  239.       CFLAGS="-Zp1 -DOS2" \
  240.       NFLAGS="" \
  241. !     LDFLAGS="-k0x40000 -x -l=os2v2 -Fe=" \
  242.       LDFLAGS2="" \
  243.       OUT="-Fo" \
  244.       OBJ=".obj" \
  245.       DEF=""
  246. + # Watcom C/286 9.0 or higher
  247. + watcom16:
  248. +     $(MAKE) -f makefile.os2 all \
  249. +     CC="wcl -zq -ml -Ox -s -I." \
  250. +     CFLAGS="-Zp1 -DOS2" \
  251. +     NFLAGS="" \
  252. +     LDFLAGS="-k0x2000 -x -l=os2 -Fe=" \
  253. +     LDFLAGS2="" \
  254. +     OUT="-Fo" \
  255. +     OBJ=".obj"
  256. + # Watcom C/386 9.0 or higher, crosscompilation for DOS
  257. + watcomdos:
  258. +     $(MAKE) -f makefile.os2 all \
  259. +     CC="wcl386 -zq -Ox -s -I." \
  260. +     CFLAGS="-Zp1 -DMSDOS" \
  261. +     NFLAGS="" \
  262. +     LDFLAGS="-k0x40000 -x -l=dos4g -Fe=" \
  263. +     LDFLAGS2="" \
  264. +     OUT="-Fo" \
  265. +     OBJ=".obj" \
  266. +     OBJU2="msdos.obj" \
  267. +     OBJX2="msdos_.obj"
  268. + # Watcom C/286 9.0 or higher, crosscompilation for DOS
  269. + watcom16dos:
  270. +     $(MAKE) -f makefile.os2 all \
  271. +     CC="wcl -zq -mm -Ox -s -I." \
  272. +     CFLAGS="-Zp1 -DMSDOS" \
  273. +     NFLAGS="" \
  274. +     LDFLAGS="-k0xC00 -x -l=dos -Fe=" \
  275. +     LDFLAGS2="" \
  276. +     OUT="-Fo" \
  277. +     OBJ=".obj" \
  278. +     OBJU2="msdos.obj" \
  279. +     OBJX2="msdos_.obj"
  280.   
  281.   # Borland C++
  282.   borland:
  283. diff -cbr unzip/os2/os2.c unzip-2/os2/os2.c
  284. *** unzip/os2/os2.c    Fri Jul 22 13:29:44 1994
  285. --- unzip-2/os2/os2.c    Tue Jul 26 00:29:00 1994
  286. ***************
  287. *** 73,78 ****
  288. --- 73,79 ----
  289.   #define INCL_DOSDEVICES
  290.   #define INCL_DOSDEVIOCTL
  291.   #define INCL_DOSERRORS
  292. + #define INCL_DOSMISC
  293.   #include <os2.h>
  294.   
  295.   #ifdef __32BIT__
  296. ***************
  297. *** 229,238 ****
  298.   #endif
  299.   
  300.   
  301. - #ifdef __WATCOMC__
  302. -    unsigned char __near _osmode = OS2_MODE;
  303. - #endif
  304.   #ifndef SFX
  305.      static char *getdirent(char *);
  306.      static void free_dircontents(struct _dircontents *);
  307. --- 230,235 ----
  308. ***************
  309. *** 450,474 ****
  310.   char *GetLoadPath(void) 
  311.   {
  312.   #ifdef __32BIT__ /* generic for 32-bit API */
  313.     PTIB pptib;
  314.     PPIB pppib;
  315.     char *szPath;
  316.   
  317.     DosGetInfoBlocks(&pptib, &pppib);
  318.     szPath = pppib -> pib_pchenv;
  319.   
  320.     while (*szPath) /* find end of process environment */
  321.       szPath = strchr(szPath, 0) + 1;
  322.   
  323.     return szPath + 1; /* .exe file name follows environment */
  324.   
  325. - #else /* 16-bit, specific for MS C 6.00, note: requires large data model */
  326. -   extern char _far *_pgmptr;
  327. -   return _pgmptr;
  328. - #endif
  329.   } /* end function GetLoadPath() */
  330.   
  331.   
  332. --- 447,472 ----
  333.   char *GetLoadPath(void) 
  334.   {
  335.   #ifdef __32BIT__ /* generic for 32-bit API */
  336.     PTIB pptib;
  337.     PPIB pppib;
  338.     char *szPath;
  339.   
  340.     DosGetInfoBlocks(&pptib, &pppib);
  341.     szPath = pppib -> pib_pchenv;
  342. + #else /* 16-bit, note: requires large data model */
  343. +   SEL selEnv;
  344. +   USHORT offCmd;
  345. +   char *szPath;
  346. +   DosGetEnv(&selEnv, &offCmd);
  347. +   szPath = MAKEP(selEnv, 0);
  348. + #endif
  349.   
  350.     while (*szPath) /* find end of process environment */
  351.       szPath = strchr(szPath, 0) + 1;
  352.   
  353.     return szPath + 1; /* .exe file name follows environment */
  354.   
  355.   } /* end function GetLoadPath() */
  356.   
  357.   
  358. ***************
  359. *** 689,698 ****
  360.     PFSQBUFFER pData = (PFSQBUFFER) bData;
  361.   #endif
  362.   
  363. -   if ( _osmode == DOS_MODE )
  364. -     return TRUE;
  365. -   else
  366. -   {
  367.       /* We separate FAT and HPFS+other file systems here.
  368.          at the moment I consider other systems to be similar to HPFS,
  369.          i.e. support long file names and case sensitive */
  370. --- 687,692 ----
  371. ***************
  372. *** 719,725 ****
  373.   
  374.       /* End of this ugly code */
  375.       return nResult;
  376. -   }
  377.   } /* end function IsFileSystemFAT() */
  378.   
  379.   
  380. --- 713,718 ----
  381. ***************
  382. *** 1398,1404 ****
  383.       ULONG action;
  384.   #else
  385.       USHORT rc;
  386. !     UINT action;
  387.   #endif
  388.   
  389.   
  390. --- 1391,1397 ----
  391.       ULONG action;
  392.   #else
  393.       USHORT rc;
  394. !     USHORT action;
  395.   #endif
  396.   
  397.   
  398. diff -cbr unzip/unzip.h unzip-2/unzip.h
  399. *** unzip/unzip.h    Fri Jul 22 13:32:44 1994
  400. --- unzip-2/unzip.h    Tue Jul 26 00:14:20 1994
  401. ***************
  402. *** 436,446 ****
  403. --- 436,448 ----
  404.   #endif
  405.   
  406.   #ifdef __WATCOMC__
  407. + #  ifdef __386__
  408.   #    define __32BIT__
  409.   #    undef far
  410.   #    define far
  411.   #    undef near
  412.   #    define near
  413. + #  endif
  414.   #  define PIPE_ERROR (errno == -1)
  415.   #endif
  416.   
  417. ***************
  418. *** 769,775 ****
  419.   #endif
  420.   
  421.   /* GRR:  NT defines MSDOS?? */
  422. ! #if (!defined(MSDOS) && !defined(__IBMC__)) || defined(NT)
  423.   #  define near
  424.   #  define far
  425.   #endif
  426. --- 771,777 ----
  427.   #endif
  428.   
  429.   /* GRR:  NT defines MSDOS?? */
  430. ! #if (!defined(MSDOS) && !defined(__IBMC__) && defined(__32BIT__)) || defined(NT)
  431.   #  define near
  432.   #  define far
  433.   #endif
  434.