From b074ad8428d310021fbf706d1d0b279d6298c31b Mon Sep 17 00:00:00 2001 From: dholland Date: Sun, 29 Jun 2014 03:24:33 +0000 Subject: 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. --- archivers/zoo/distinfo | 17 +++++---- archivers/zoo/patches/patch-aa | 25 ++++++++++++-- archivers/zoo/patches/patch-ab | 63 ++++++++++++++++++++++------------ archivers/zoo/patches/patch-ai | 26 +++++++++----- archivers/zoo/patches/patch-ak | 16 +++++++-- archivers/zoo/patches/patch-am | 30 ++++++++++++++-- archivers/zoo/patches/patch-makelist.c | 17 +++++++++ archivers/zoo/patches/patch-mstime.i | 14 ++++++++ archivers/zoo/patches/patch-zoo.c | 14 ++++++++ archivers/zoo/patches/patch-zooadd.c | 14 ++++++++ archivers/zoo/patches/patch-zoofilt.c | 27 +++++++++++++++ 11 files changed, 220 insertions(+), 43 deletions(-) create mode 100644 archivers/zoo/patches/patch-makelist.c create mode 100644 archivers/zoo/patches/patch-mstime.i create mode 100644 archivers/zoo/patches/patch-zoo.c create mode 100644 archivers/zoo/patches/patch-zooadd.c create mode 100644 archivers/zoo/patches/patch-zoofilt.c (limited to 'archivers') diff --git a/archivers/zoo/distinfo b/archivers/zoo/distinfo index eab1c09d3ee..88008e34013 100644 --- a/archivers/zoo/distinfo +++ b/archivers/zoo/distinfo @@ -1,20 +1,25 @@ -$NetBSD: distinfo,v 1.12 2009/04/25 23:50:58 gdt Exp $ +$NetBSD: distinfo,v 1.13 2014/06/29 03:24:33 dholland Exp $ SHA1 (zoo-2.10pl1.tar.gz) = c02d96148ee57df01596d0c8d07a3e327b821600 RMD160 (zoo-2.10pl1.tar.gz) = 971d388b8cb29def1e4e31011463563e91c3d700 Size (zoo-2.10pl1.tar.gz) = 172096 bytes -SHA1 (patch-aa) = d8b9747df17619e9ff0fdcba897ff20af7b76c9f -SHA1 (patch-ab) = 5a8d87307750d967120481e54afe588636dfddf4 +SHA1 (patch-aa) = 22faf3fdc38c7d75867327718d23db50fb6013d3 +SHA1 (patch-ab) = 205936660e84f17c9ec49830acd3b46e343268bd SHA1 (patch-ac) = e5c9e18461b86fbfba4526f685fb65a507bb6f97 SHA1 (patch-ad) = d8992d565f48aab10521ecbd346d233a1e717790 SHA1 (patch-ae) = d1e60cea71bb1c56e76a6ffc9923341664283a0c SHA1 (patch-af) = 2a1b67cf50fed58e5caf83a8ca4c8529d8e22c24 SHA1 (patch-ag) = 30fd80a1127f7625db9f0c9889ad5ef43f68d7fb SHA1 (patch-ah) = 488753b5a49404b908713cd6dcfc0356b0cab40c -SHA1 (patch-ai) = b6102770f1f0318510a21b444bf9b7e4cfce51c3 +SHA1 (patch-ai) = 711e03f57ce19e3d2d5b0690cf4988f13c3cca11 SHA1 (patch-aj) = 2c764ca5c164ae3744e6447fef7815025c125c36 -SHA1 (patch-ak) = c6b44cd1e45728ba227728c1527da5209ece1e00 +SHA1 (patch-ak) = 121dfd5f25afc7a27a510cdb144d845dcf7c3121 SHA1 (patch-al) = 6272e830b028789398cf052c36d6a311eecc1311 -SHA1 (patch-am) = b294d0589ecf74ad0d1fe0ed4c53f7b34376f19d +SHA1 (patch-am) = 5bafebb97eeeb47225283ad4b21e350289544b5d SHA1 (patch-an) = 8d74579ab5b7df59b9684828b356a3d4415bdd63 SHA1 (patch-ao) = 3f82cd62968f0e510f75411192560f70b608560d +SHA1 (patch-makelist.c) = 67db92491cdd9c1224765edbca4d1cba95362189 +SHA1 (patch-mstime.i) = 43c22a19a1507b3e7b887c03e35a268831f5708c +SHA1 (patch-zoo.c) = f26d2e4f909c3d27e95a45ddde8ff19f1b28e6cc +SHA1 (patch-zooadd.c) = cf495d2e6090195a6f155d68d692b5ee53d52445 +SHA1 (patch-zoofilt.c) = 762e185468163be255f69b89e660f6ea77fa1dc5 diff --git a/archivers/zoo/patches/patch-aa b/archivers/zoo/patches/patch-aa index 6242235d956..c357b7d2099 100644 --- a/archivers/zoo/patches/patch-aa +++ b/archivers/zoo/patches/patch-aa @@ -1,8 +1,19 @@ -$NetBSD: patch-aa,v 1.5 2009/04/25 23:46:47 gdt Exp $ +$NetBSD: patch-aa,v 1.6 2014/06/29 03:24:33 dholland Exp $ ---- ar.h.orig 1993-05-01 06:04:22.000000000 +0200 +- use standard headers +- don't redeclare memmove + +--- ar.h.orig 1993-05-01 04:04:22.000000000 +0000 +++ ar.h -@@ -15,11 +15,15 @@ Adapted from "ar" archiver written by Ha +@@ -7,6 +7,7 @@ Adapted from "ar" archiver written by Ha + ***********************************************************/ + + #include ++#include + + #ifdef ANSI_HDRS + # include +@@ -15,11 +16,15 @@ Adapted from "ar" archiver written by Ha /* uchar should be 8 bits or more */ /* typedef unsigned char uchar; -- already in zoo.h */ @@ -18,3 +29,11 @@ $NetBSD: patch-aa,v 1.5 2009/04/25 23:46:47 gdt Exp $ /* T_UINT16 must be #defined in options.h to be a 16-bit unsigned integer type */ +@@ -116,7 +121,6 @@ int make_tree + void move_left(); + #else + # define MOVE_LEFT memmove +- extern VOIDPTR memmove(); + #endif + + #if 0 diff --git a/archivers/zoo/patches/patch-ab b/archivers/zoo/patches/patch-ab index 1bf7486525b..57886f809bc 100644 --- a/archivers/zoo/patches/patch-ab +++ b/archivers/zoo/patches/patch-ab @@ -1,48 +1,67 @@ -$NetBSD: patch-ab,v 1.5 2009/04/25 23:46:47 gdt Exp $ +$NetBSD: patch-ab,v 1.6 2014/06/29 03:24:33 dholland Exp $ ---- bsd.c.orig 1993-05-01 06:21:53.000000000 +0200 +- use standard headers +- use standard macros for seeking +- don't declare own lseek +- use off_t +- supply missing return value + +--- bsd.c.orig 1993-05-01 04:21:53.000000000 +0000 +++ bsd.c -@@ -69,8 +69,12 @@ ZOOFILE f; - } +@@ -26,7 +26,7 @@ to be on the safe side. It is needed fo + long lseek PARMS ((int, long, int)); + long tell (fd) + int fd; +-{ return (lseek (fd, 0L, 1)); } ++{ return (lseek (fd, 0L, SEEK_CUR)); } + #endif - /* Function gettz() returns the offset from GMT in seconds */ --long gettz() -+long gettz(t) -+long t; - { -+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -+ return -localtime(&t)->tm_gmtoff; -+#else + long ftell(); +@@ -74,26 +74,13 @@ long gettz() #define SEC_IN_DAY (24L * 60L * 60L) #define INV_VALUE (SEC_IN_DAY + 1L) static long retval = INV_VALUE; /* cache, init to impossible value */ -@@ -95,6 +99,7 @@ long gettz() +-#ifndef __386BSD__ +- struct timeval tp; +- struct timezone tzp; +-#else + time_t lt; + struct tm *tm; +-#endif + if (retval != INV_VALUE) /* if have cached value, return it */ + return retval; +-#ifndef __386BSD__ +- gettimeofday (&tp, &tzp); /* specific to 4.3BSD */ +- /* return (tzp.tz_minuteswest * 60); */ /* old incorrect code */ +- /* Timezone fix thanks to Bill Davidsen */ +- /* !! - ache@hq.demos.su */ +- retval = tzp.tz_minuteswest * 60 - (tzp.tz_dsttime != 0) * 3600L; +-#else + time(<); + tm = localtime(<); retval = -tm->tm_gmtoff; - #endif +-#endif return retval; -+#endif } - /* Standard UNIX-compatible time routines */ -@@ -103,15 +108,19 @@ long gettz() +@@ -103,6 +90,7 @@ long gettz() /* Standard UNIX-specific file attribute routines */ #include "nixmode.i" -+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) +#include -+#else #ifndef SEEK_CUR # define SEEK_CUR 1 #endif -+#endif - +@@ -110,10 +98,10 @@ long gettz() /* Truncate a file. */ int zootrunc(f) FILE *f; { - extern long lseek(); - long seekpos; -+ extern off_t lseek(); + off_t seekpos; int fd = fileno(f); seekpos = lseek(fd, 0L, SEEK_CUR); if (seekpos >= 0) + return ftruncate(fd, seekpos); ++ return 0; + } diff --git a/archivers/zoo/patches/patch-ai b/archivers/zoo/patches/patch-ai index e6bd4bd9fec..43c99ac51f7 100644 --- a/archivers/zoo/patches/patch-ai +++ b/archivers/zoo/patches/patch-ai @@ -1,8 +1,18 @@ -$NetBSD: patch-ai,v 1.4 2009/04/25 23:46:47 gdt Exp $ +$NetBSD: patch-ai,v 1.5 2014/06/29 03:24:33 dholland Exp $ ---- zoolist.c.orig 1991-07-20 00:57:27.000000000 +0200 +- use standard headers +- use printf formats matching types +- add zoo_pointer and logic related to it, appears to be a bug fix +- changes calling gettz() that should be reverted now that gettz() has + been fixed up + +--- zoolist.c.orig 1991-07-19 22:57:27.000000000 +0000 +++ zoolist.c -@@ -21,7 +21,7 @@ Copyright (C) 1986, 1987 Rahul Dhesi -- +@@ -18,10 +18,11 @@ duplicate information will be dumped. + Copyright (C) 1986, 1987 Rahul Dhesi -- All rights reserved + (C) Copyright 1988 Rahul Dhesi -- All rights reserved + */ ++#include #include "options.h" #include "portable.h" #include "zoomem.h" /* to get ZOOCOUNT */ @@ -11,7 +21,7 @@ $NetBSD: patch-ai,v 1.4 2009/04/25 23:46:47 gdt Exp $ /* Lists files in archive */ #include "zoo.h" #include "errors.i" -@@ -92,6 +92,7 @@ int genson = 1; /* enable/disable ge +@@ -92,6 +93,7 @@ int genson = 1; /* enable/disable ge int show_mode = 0; /* show file protection */ #endif int first_dir = 1; /* if first direntry -- to adjust dat_ofs */ @@ -19,7 +29,7 @@ $NetBSD: patch-ai,v 1.4 2009/04/25 23:46:47 gdt Exp $ while (*option) { switch (*option) { -@@ -211,6 +212,9 @@ if (fiz_ofs != 0L) { /* i +@@ -211,6 +213,9 @@ if (fiz_ofs != 0L) { /* i show_acmt (&zoo_header, zoo_file, 0); /* show archive comment */ } @@ -29,7 +39,7 @@ $NetBSD: patch-ai,v 1.4 2009/04/25 23:46:47 gdt Exp $ /* Seek to the beginning of the first directory entry */ if (zooseek (zoo_file, zoo_header.zoo_start, 0) != 0) { ercount++; -@@ -414,7 +418,7 @@ if (fiz_ofs != 0L) { /* i +@@ -414,7 +419,7 @@ if (fiz_ofs != 0L) { /* i if (direntry.fattr == 0) printf ("--- "); else if ((direntry.fattr >> 22) == 1) @@ -38,7 +48,7 @@ $NetBSD: patch-ai,v 1.4 2009/04/25 23:46:47 gdt Exp $ else printf ("??? "); } -@@ -437,6 +441,11 @@ if (fiz_ofs != 0L) { /* i +@@ -437,6 +442,11 @@ if (fiz_ofs != 0L) { /* i if (verb_list && !fast) show_comment (&direntry, zoo_file, 0, (char *) NULL); } /* end if (lots of conditions) */ @@ -50,7 +60,7 @@ $NetBSD: patch-ai,v 1.4 2009/04/25 23:46:47 gdt Exp $ /* ..seek to next dir entry */ zooseek (zoo_file, direntry.next, 0); -@@ -539,10 +548,12 @@ int file_tz; +@@ -539,10 +549,12 @@ int file_tz; { long gettz(); int diff_tz; /* timezone difference */ diff --git a/archivers/zoo/patches/patch-ak b/archivers/zoo/patches/patch-ak index 08515a33455..196d4838d0d 100644 --- a/archivers/zoo/patches/patch-ak +++ b/archivers/zoo/patches/patch-ak @@ -1,7 +1,19 @@ -$NetBSD: patch-ak,v 1.2 2009/04/25 23:46:47 gdt Exp $ +$NetBSD: patch-ak,v 1.3 2014/06/29 03:24:33 dholland Exp $ ---- misc.c.orig 1991-07-16 17:52:54.000000000 +0200 +- use correctly +- avoid string overflow + +--- misc.c.orig 1991-07-16 15:52:54.000000000 +0000 +++ misc.c +@@ -41,7 +41,7 @@ char *str; + char *p; + retval = 0L; + p = str; /* save for error message */ +- while (isdigit(*str)) { ++ while (isdigit((unsigned char)*str)) { + retval = retval * 10L + (*str-'0'); + str++; + } @@ -135,11 +135,17 @@ if available, else the short filename is char *fullpath (direntry) struct direntry *direntry; diff --git a/archivers/zoo/patches/patch-am b/archivers/zoo/patches/patch-am index 292d29a894d..255d487be4f 100644 --- a/archivers/zoo/patches/patch-am +++ b/archivers/zoo/patches/patch-am @@ -1,6 +1,10 @@ -$NetBSD: patch-am,v 1.2 2009/04/25 23:46:47 gdt Exp $ +$NetBSD: patch-am,v 1.3 2014/06/29 03:24:33 dholland Exp $ ---- portable.c.orig 1991-07-16 17:55:11.000000000 +0200 +- provide zoocreate_fd +- use 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; @@ -15,6 +19,28 @@ $NetBSD: patch-am,v 1.2 2009/04/25 23:46:47 gdt Exp $ #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)); } diff --git a/archivers/zoo/patches/patch-makelist.c b/archivers/zoo/patches/patch-makelist.c new file mode 100644 index 00000000000..8e86616c424 --- /dev/null +++ b/archivers/zoo/patches/patch-makelist.c @@ -0,0 +1,17 @@ +$NetBSD: patch-makelist.c,v 1.1 2014/06/29 03:24:33 dholland Exp $ + +initialize uninitialized variable, found by gcc 4.5 + +--- makelist.c~ 1991-07-16 15:52:17.000000000 +0000 ++++ makelist.c +@@ -53,7 +53,9 @@ int *longest; /* length of longes + #endif + + int gap; /* for Shell sort */ +- ++ ++ this_path = NULL; ++ + flistsize--; /* allow for one terminating NULL entry */ + fptr = *longest = 0; + diff --git a/archivers/zoo/patches/patch-mstime.i b/archivers/zoo/patches/patch-mstime.i new file mode 100644 index 00000000000..a88282945f9 --- /dev/null +++ b/archivers/zoo/patches/patch-mstime.i @@ -0,0 +1,14 @@ +$NetBSD: patch-mstime.i,v 1.1 2014/06/29 03:24:33 dholland Exp $ + +supply missing return type + +--- mstime.i~ 1991-07-16 15:53:11.000000000 +0000 ++++ mstime.i +@@ -12,6 +12,7 @@ static char mstimeid[]="@(#) mstime.i 2. + Function mstime() converts time in seconds since January 1 of BASEYEAR + to MS-DOS format date and time. + */ ++void + mstime(longtime, date, time) + long longtime; /* input: seconds since Jan 1, BASEYEAR */ + int *date, *time; /* output: MS-DOS format date and time */ diff --git a/archivers/zoo/patches/patch-zoo.c b/archivers/zoo/patches/patch-zoo.c new file mode 100644 index 00000000000..e62282d5a8f --- /dev/null +++ b/archivers/zoo/patches/patch-zoo.c @@ -0,0 +1,14 @@ +$NetBSD: patch-zoo.c,v 1.1 2014/06/29 03:24:33 dholland Exp $ + +use standard headers + +--- zoo.c~ 1991-07-17 12:28:43.000000000 +0000 ++++ zoo.c +@@ -15,6 +15,7 @@ Copyright (C) 1986, 1987 Rahul Dhesi -- + (C) Copyright 1988 Rahul Dhesi -- All rights reserved + (C) Copyright 1991 Rahul Dhesi -- All rights reserved + */ ++#include + #include "options.h" + #include "zooio.h" + #include "various.h" diff --git a/archivers/zoo/patches/patch-zooadd.c b/archivers/zoo/patches/patch-zooadd.c new file mode 100644 index 00000000000..7fbd1d16a5a --- /dev/null +++ b/archivers/zoo/patches/patch-zooadd.c @@ -0,0 +1,14 @@ +$NetBSD: patch-zooadd.c,v 1.1 2014/06/29 03:24:33 dholland Exp $ + +use standard headers + +--- zooadd.c~ 1993-05-01 03:43:38.000000000 +0000 ++++ zooadd.c +@@ -9,6 +9,7 @@ Copyright (C) 1986, 1987 Rahul Dhesi -- + (C) Copyright 1988 Rahul Dhesi -- All rights reserved + (C) Copyright 1991 Rahul Dhesi -- All rights reserved + */ ++#include + #include "options.h" + /* Adds files specified in parameter-list to archive zoo_path. */ + diff --git a/archivers/zoo/patches/patch-zoofilt.c b/archivers/zoo/patches/patch-zoofilt.c new file mode 100644 index 00000000000..e491c23c834 --- /dev/null +++ b/archivers/zoo/patches/patch-zoofilt.c @@ -0,0 +1,27 @@ +$NetBSD: patch-zoofilt.c,v 1.1 2014/06/29 03:24:33 dholland Exp $ + +- avoid implicit int +- initialize uninitialized variable + +--- zoofilt.c~ 1991-07-16 15:59:09.000000000 +0000 ++++ zoofilt.c +@@ -34,15 +34,16 @@ int wrint PARMS((unsigned int)); /* writ + /* global variable used to pass two bytes (CRC value) back from lzd to here */ + unsigned int filt_lzd_word; + ++extern int lzc(), lzh_encode(); /* possible encoders */ ++extern int lzd(), lzh_decode(); /* and decoders */ ++ + void zoofilt (option) + char *option; + { +- int choice; /* what to do -- [de]compress */ ++ int choice = 0; /* what to do -- [de]compress */ + unsigned int filetag; /* tag stored in input */ + int stat1, stat2, stat3; /* status codes */ + int use_lzh = 0; /* use lzh instead */ +- extern lzc(), lzh_encode(); /* possible encoders */ +- extern lzd(), lzh_decode(); /* and decoders */ + + while (*++option) { + switch (*option) { -- cgit v1.2.3