pkgsrc/archivers/zoo/patches/patch-am
dholland 47d322ad49 Assorted basic legacy code fixes - ctype.h stuff, implicit int, use
standard headers, etc. "time_t" is not "long". Don't issue own
declarations of standard functions. Should fix Solaris build.
2014-06-29 03:24:33 +00:00

66 lines
1.9 KiB
Text

$NetBSD: patch-am,v 1.3 2014/06/29 03:24:33 dholland Exp $
- provide zoocreate_fd
- use <ctype.h> properly
- provide and use to_signed_long (why?)
--- portable.c.orig 1991-07-16 15:55:11.000000000 +0000
+++ 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
@@ -133,7 +139,7 @@ char *str;
s = str;
while (*s != '\0') {
*s = toascii(*s);
- *s = low_ch(*s);
+ *s = low_ch((unsigned char)*s);
s++;
}
return (str);
@@ -146,10 +152,10 @@ case.
int str_icmp (s1, s2)
register char *s1, *s2;
{
- for ( ; low_ch(*s1) == low_ch(*s2); s1++, s2++)
+ for ( ; low_ch((unsigned char)*s1) == low_ch((unsigned char)*s2); s1++, s2++)
if (*s1 == '\0')
return(0);
- return(low_ch(*s1) - low_ch(*s2));
+ return(low_ch((unsigned char)*s1) - low_ch((unsigned char)*s2));
}
#ifdef NEED_MEMSET
@@ -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 */