summaryrefslogtreecommitdiff
path: root/archivers/zoo/patches/patch-am
blob: 292d29a894d3287b450aa37815226a78d0d09852 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
$NetBSD: patch-am,v 1.2 2009/04/25 23:46:47 gdt Exp $

--- portable.c.orig	1991-07-16 17:55:11.000000000 +0200
+++ portable.c
@@ -87,6 +87,12 @@ ZOOFILE zoocreate (fname)
 char *fname;
 { return ((ZOOFILE) fopen (fname, Z_NEW)); }
 
+#ifndef USE_MKTEMP
+ZOOFILE zoocreate_fd (fd)
+int fd;
+{ return ((ZOOFILE) fdopen (fd, Z_NEW)); }
+#endif
+
 #endif /* FIZ */
 
 #ifndef zooseek
@@ -220,6 +226,13 @@ BYTE data[];
          ((unsigned long) data[2] << 16) | ((unsigned long) data[3] << 24));
 }
 
+long to_signed_long(data)
+BYTE data[];
+{
+   return (long) ((long) data[0] | ((long) data[1] << 8) |
+         ((long) data[2] << 16) | ((long) (char)data[3] << 24));
+}
+
 #ifndef FIZ
 /********************
 splitlong() converts a long integer to four consecutive BYTEs in order
@@ -426,7 +439,7 @@ BYTE bytes[];
       zoo_header->text[i] = bytes[TEXT_I + i];
    zoo_header->zoo_tag = to_long(&bytes[ZTAG_I]);     /* copy zoo_tag */
    zoo_header->zoo_start = to_long(&bytes[ZST_I]);    /* copy zoo_start */
-   zoo_header->zoo_minus = to_long(&bytes[ZSTM_I]);
+   zoo_header->zoo_minus = to_signed_long(&bytes[ZSTM_I]);
    zoo_header->major_ver = bytes[MAJV_I];          /* copy versions */
    zoo_header->minor_ver = bytes[MINV_I];
 	/* default is no archive comment and a header type of 0 */