<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>patch-Apple</title>
<style type="text/css">
.enscript-comment { font-style: italic; color: rgb(178,34,34); }
.enscript-function-name { font-weight: bold; color: rgb(0,0,255); }
.enscript-variable-name { font-weight: bold; color: rgb(184,134,11); }
.enscript-keyword { font-weight: bold; color: rgb(160,32,240); }
.enscript-reference { font-weight: bold; color: rgb(95,158,160); }
.enscript-string { font-weight: bold; color: rgb(188,143,143); }
.enscript-builtin { font-weight: bold; color: rgb(218,112,214); }
.enscript-type { font-weight: bold; color: rgb(34,139,34); }
.enscript-highlight { text-decoration: underline; color: 0; }
</style>
</head>
<body id="top">
<h1 style="margin:8px;" id="f1">patch-Apple&nbsp;&nbsp;&nbsp;<span style="font-weight: normal; font-size: 0.5em;">[<a href="patch-Apple">plain text</a>]</span></h1>
<hr/>
<div></div>
<pre>
diff -up ./tailor.h ../zip.Apple/tailor.h
--- ./tailor.h	2008-05-06 21:38:12.000000000 -0700
+++ ../zip.Apple/tailor.h	2008-09-22 17:24:13.000000000 -0700
@@ -707,7 +707,11 @@ typedef struct ztimbuf {
 # define zstat stat
 # define zfstat fstat
 # define zlstat lstat
+#ifdef __APPLE__
+# define zfseeko fseeko
+#else
 # define zfseeko fseek
+#endif
 # define zftello ftell
 # define zfopen fopen
 # define zfdopen fdopen
diff -up ./zip.c ../zip.Apple/zip.c
--- ./zip.c	2008-07-05 12:34:06.000000000 -0700
+++ ../zip.Apple/zip.c	2008-09-22 17:24:13.000000000 -0700
@@ -15,6 +15,7 @@
 
 #include &quot;zip.h&quot;
 #include &lt;time.h&gt;       /* for tzset() declaration */
+#include &lt;spawn.h&gt;		/* posix_spawnp */
 #if defined(WIN32) || defined(WINDLL)
 #  define WIN32_LEAN_AND_MEAN
 #  include &lt;windows.h&gt;
@@ -924,7 +925,7 @@ local void help_extended()
 &quot;  -TT cmd   use command cmd instead of 'unzip -tqq' to test archive&quot;,
 &quot;             On Unix, to use unzip in current directory, could use:&quot;,
 &quot;               zip archive file1 file2 -T -TT \&quot;./unzip -tqq\&quot;&quot;,
-&quot;             In cmd, {} replaced by temp archive path, else temp appended.&quot;,
+/*&quot;             In cmd, {} replaced by temp archive path, else temp appended.&quot;,*/
 &quot;             The return code is checked for success (0 on Unix)&quot;,
 &quot;&quot;,
 &quot;Fixing archives:&quot;,
@@ -1028,8 +1029,7 @@ local void help_extended()
 
   for (i = 0; i &lt; sizeof(text)/sizeof(char *); i++)
   {
-    printf(text[i]);
-    putchar('\n');
+    puts(text[i]);
   }
 #ifdef DOS
   check_for_windows(&quot;Zip&quot;);
@@ -1225,8 +1225,7 @@ local void version_info()
             CR_MAJORVER, CR_MINORVER, CR_BETA_VER, CR_VERSION_DATE);
   for (i = 0; i &lt; sizeof(cryptnote)/sizeof(char *); i++)
   {
-    printf(cryptnote[i]);
-    putchar('\n');
+    puts(cryptnote[i]);
   }
   ++i;  /* crypt support means there IS at least one compilation option */
 #endif /* CRYPT */
@@ -1423,83 +1422,78 @@ local void check_zipfile(zipname, zippat
   if (status != 0) {
 
 #else /* (MSDOS &amp;&amp; !__GO32__) || __human68k__ */
-  char *cmd;
   int result;
 
   /* Tell picky compilers to shut up about unused variables */
   zippath = zippath;
 
   if (unzip_path) {
+    char *argv[3];
+    int argc = 0;
+    int rc;
+    pid_t pid;
     /* user gave us a path to some unzip (may not be UnZip) */
-    char *here;
-    int len;
 
-    /* Replace first {} with archive name.  If no {} append name to string. */
-    here = strstr(unzip_path, &quot;{}&quot;);
-
-    if ((cmd = malloc(strlen(unzip_path) + strlen(zipname) + 3)) == NULL) {
-      ziperr(ZE_MEM, &quot;building command string for testing archive&quot;);
+    if (strstr(unzip_path, &quot;{}&quot;)) {
+      ziperr(ZE_PARMS, &quot;{} in -TT not supported&quot;);
     }
+    argv[argc] = unzip_path;
+    argc++;
+    argv[argc] = zipname;
+    argc++;
+    argv[argc] = NULL;
 
-    if (here) {
-      /* have {} so replace with temp name */
-      len = here - unzip_path;
-      strcpy(cmd, unzip_path);
-      cmd[len] = '\0';
-      strcat(cmd, &quot; &quot;);
-# ifdef UNIX
-      strcat(cmd, &quot;'&quot;);    /* accept space or $ in name */
-      strcat(cmd, zipname);
-      strcat(cmd, &quot;'&quot;);
-# else
-      strcat(cmd, zipname);
-# endif
-      strcat(cmd, &quot; &quot;);
-      strcat(cmd, here + 2);
-    } else {
-      /* No {} so append temp name to end */
-      strcpy(cmd, unzip_path);
-      strcat(cmd, &quot; &quot;);
-# ifdef UNIX
-      strcat(cmd, &quot;'&quot;);    /* accept space or $ in name */
-      strcat(cmd, zipname);
-      strcat(cmd, &quot;'&quot;);
-# else
-      strcat(cmd, zipname);
-# endif
-    }
+    rc = posix_spawnp(&amp;pid, argv[0], NULL, NULL, argv, NULL);
     free(unzip_path);
     unzip_path = NULL;
-
+    if (rc == 0) {
+       int status;
+       waitpid(pid, &amp;status, 0);
+       if (WIFEXITED(status))
+	 result = WEXITSTATUS(status);
+       else
+	 result = 1;
+    } else
+      result = 1;
   } else {
-    if ((cmd = malloc(20 + strlen(zipname))) == NULL) {
-      ziperr(ZE_MEM, &quot;building command string for testing archive&quot;);
-    }
-
-    strcpy(cmd, &quot;unzip -t &quot;);
+    char *argv[10];
+    int argc = 0;
+    pid_t pid;
+    int rc;
+
+    argv[argc] = &quot;unzip&quot;;
+    argc++;
+    argv[argc] = &quot;-t&quot;;
+    argc++;
 # ifdef QDOS
-    strcat(cmd, &quot;-Q4 &quot;);
+    argv[argc] = &quot;-Q4&quot;;
+    argc++;
 # endif
-    if (!verbose) strcat(cmd, &quot;-qq &quot;);
+    if (!verbose) {
+      argv[argc] = &quot;-qq&quot;;
+      argc++;
+    }
     if (check_unzip_version(&quot;unzip&quot;) == 0)
       ZIPERR(ZE_TEST, zipfile);
-
-# ifdef UNIX
-    strcat(cmd, &quot;'&quot;);    /* accept space or $ in name */
-    strcat(cmd, zipname);
-    strcat(cmd, &quot;'&quot;);
-# else
-    strcat(cmd, zipname);
-# endif
+    argv[argc] = zipname;
+    argc++;
+    argv[argc] = NULL;
+    rc = posix_spawnp(&amp;pid, argv[0], NULL, NULL, argv, NULL);
+    if (rc == 0) {
+       int status;
+       waitpid(pid, &amp;status, 0);
+       if (WIFEXITED(status))
+	 result = WEXITSTATUS(status);
+       else
+	 result = 1;
+    } else
+      result = 1;
   }
 
-  result = system(cmd);
 # ifdef VMS
   /* Convert success severity to 0, others to non-zero. */
   result = ((result &amp; STS$M_SEVERITY) != STS$M_SUCCESS);
 # endif /* def VMS */
-  free(cmd);
-  cmd = NULL;
   if (result) {
 #endif /* ?((MSDOS &amp;&amp; !__GO32__) || __human68k__) */
 
@@ -4373,7 +4367,7 @@ char **argv;            /* command line 
                    z-&gt;trash ? &quot;up to date&quot; : &quot;missing or early&quot;);
         }
         else if (diff_mode &amp;&amp; tf == z-&gt;tim &amp;&amp;
-                 ((isdirname &amp;&amp; (zoff_t)usize == -1) || (usize == z-&gt;len))) {
+                 ((isdirname &amp;&amp; usize == (uzoff_t)~0) || (usize == (uzoff_t)z-&gt;len))) {
           /* if in diff mode only include if file time or size changed */
           /* usize is -1 for directories */
           z-&gt;mark = 0;
@@ -4381,7 +4375,7 @@ char **argv;            /* command line 
         else {
           /* usize is -1 for directories and -2 for devices */
           if (tf == z-&gt;tim &amp;&amp;
-              ((z-&gt;len == 0 &amp;&amp; (zoff_t)usize == -1)
+              ((z-&gt;len == 0 &amp;&amp; usize == (uzoff_t)~0)
                || usize == z-&gt;len)) {
             /* FileSync uses the current flag */
             /* Consider an entry current if file time is the same
@@ -4993,7 +4987,7 @@ char **argv;            /* command line 
     if (z-&gt;mark == 1)
     {
       uzoff_t len;
-      if ((zoff_t)z-&gt;len == -1)
+      if (z-&gt;len == (uzoff_t)~0)
         /* device */
         len = 0;
       else

</pre>
<hr />
</body></html>