home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-07-11 | 41.2 KB | 1,493 lines |
- Newsgroups: alt.sources
- Subject: zoo 2.1 source part 01/15
- Message-ID: <12767@bsu-cs.bsu.edu>
- From: dhesi@bsu-cs.bsu.edu (Rahul Dhesi)
- Date: 10 Jul 91 08:44:23 GMT
-
- Here is version 2.1 of the zoo archiver. It includes improved compression,
- better online help, VAX/VMS file timestamp preservation, faster
- uncompression, and other features. An MS-DOS binary is being sent to
- comp.binaries.ibm.pc.
-
- Each part of this 15-part posting is a separate shar archive. Do not
- concatenate -- feed each part separately to /bin/sh in any order.
-
- Rahul Dhesi <dhesi@bsu-cs.bsu.edu>
-
- Checksum: 2265637808 (verify with "brik -cv")
- Submitted-by: dhesi@bsu-cs.bsu.edu
- Archive-name: zoo210/part01
-
- ---- Cut Here and feed the following to sh ----
- #!/bin/sh
- # This is zoo210, a shell archive (produced by shar 3.49)
- # To extract the files from this archive, save it to a file, remove
- # everything above the "!/bin/sh" line above, and type "sh file_name".
- #
- # made 07/10/1991 06:47 UTC by dhesi@bsu-cs.bsu.edu
- # Source directory /tmp
- #
- # existing files will NOT be overwritten unless -c is specified
- #
- # This shar contains:
- # length mode name
- # ------ ---------- ------------------------------------------
- # 2176 -rw-r--r-- Checksums
- # 2160 -rw-r--r-- Copyright
- # 2138 -rw-r--r-- Install
- # 2706 -rw-r--r-- List
- # 852 -rw-r--r-- addbfcrc.c
- # 2097 -rw-r--r-- addbftcc.c
- # 3872 -rw-r--r-- addfname.c
- # 3097 -rw-r--r-- ar.h
- # 517 -rw-r--r-- asmconst.ai
- # 995 -rw-r--r-- assert.h
- # 3181 -rw-r--r-- basename.c
- # 6214 -rw-r--r-- bilf.c
- # 2650 -rw-r--r-- bsd.c
- # 9595 -rw-r--r-- comment.c
- # 2446 -rw-r--r-- crcdefs.c
- # 615 -rw-r--r-- debug.h
- # 1444 -rw-r--r-- decode.c
- # 4173 -rw-r--r-- descrip.mms
- # 7292 -rw-r--r-- encode.c
- # 825 -rw-r--r-- errors.i
- # 1814 -rw-r--r-- file.fix
- # 3849 -rw-r--r-- fiz.1
- # 6784 -rw-r--r-- fiz.c
- # 4227 -rw-r--r-- fiz.man
- # 2422 -rw-r--r-- generic.c
- # 4549 -rw-r--r-- getfile.c
- # 7757 -rw-r--r-- huf.c
- # 3003 -rw-r--r-- io.c
- # 12283 -rw-r--r-- lzc.asm
- # 8393 -rw-r--r-- lzc.c
- # 574 -rw-r--r-- lzconst.h
- # 9144 -rw-r--r-- lzd.asm
- # 29821 -rw-r--r-- lzd.c
- # 1255 -rw-r--r-- lzh.c
- # 934 -rw-r--r-- lzh.h
- # 1589 -rw-r--r-- machine.c
- # 1069 -rw-r--r-- machine.h
- # 369 -rw-r--r-- macros.ai
- # 10232 -rw-r--r-- makefile
- # 4490 -rw-r--r-- makefile.tcc
- # 6198 -rw-r--r-- makelist.c
- # 1836 -rw-r--r-- maketbl.c
- # 2836 -rw-r--r-- maketree.c
- # 9679 -rw-r--r-- misc.c
- # 8587 -rw-r--r-- misc2.c
- # 2290 -rw-r--r-- msdos.c
- # 2860 -rw-r--r-- mstime.i
- # 8266 -rw-r--r-- needed.c
- # 7588 -rw-r--r-- nextfile.c
- # 1127 -rw-r--r-- nixmode.i
- # 3434 -rw-r--r-- nixtime.i
- # 1874 -rw-r--r-- options.c
- # 16246 -rw-r--r-- options.doc
- # 8466 -rw-r--r-- options.h
- # 28 -rw-r--r-- options.opt
- # 5640 -rw-r--r-- parse.c
- # 704 -rw-r--r-- parse.h
- # 21613 -rw-r--r-- portable.c
- # 2657 -rw-r--r-- portable.h
- # 9094 -rw-r--r-- prterror.c
- # 4088 -rw-r--r-- sysv.c
- # 2063 -rw-r--r-- turboc.c
- # 113 -rw-r--r-- turboc.cfg
- # 2097 -rw-r--r-- various.h
- # 111 -rw-r--r-- version.c
- # 10243 -rw-r--r-- vms.c
- # 18584 -rw-r--r-- vmsbugs.doc
- # 3909 -rw-r--r-- vmsbuild.com
- # 6408 -rw-r--r-- vmstime.c
- # 46685 -rw-r--r-- zoo.1
- # 16090 -rw-r--r-- zoo.c
- # 10237 -rw-r--r-- zoo.h
- # 50054 -rw-r--r-- zoo.man
- # 26320 -rw-r--r-- zooadd.c
- # 8758 -rw-r--r-- zooadd2.c
- # 9676 -rw-r--r-- zoodel.c
- # 22207 -rw-r--r-- zooext.c
- # 2179 -rw-r--r-- zoofilt.c
- # 3423 -rw-r--r-- zoofns.h
- # 1939 -rw-r--r-- zooio.h
- # 18884 -rw-r--r-- zoolist.c
- # 1639 -rw-r--r-- zoomem.h
- # 13324 -rw-r--r-- zoopack.c
- #
- # ============= Checksums ==============
- if test -f 'Checksums' -a X"$1" != X"-c"; then
- echo 'x - skipping Checksums (File already exists)'
- else
- echo 'x - extracting Checksums (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'Checksums' &&
- # Whole file CRCs generated by Brik v2.0. Use "brik -C" to verify them.
- X
- # CRC-32 filename
- # ------ --------
- X
- 1667442549 Copyright
- X 359392938 Install
- X 630248997 List
- X 325879421 addbfcrc.c
- X 669949366 addbftcc.c
- 4137570368 addfname.c
- X 260075838 ar.h
- 3176247825 asmconst.ai
- 1968829781 assert.h
- 2774589019 basename.c
- 1418550454 bilf.c
- 3571167278 bsd.c
- 1744985930 comment.c
- 1095290529 crcdefs.c
- 1757282176 debug.h
- 3021583345 decode.c
- X 73743136 descrip.mms
- X 489796322 encode.c
- 4075798129 errors.i
- 3490413857 file.fix
- 3485210749 fiz.1
- 3600565988 fiz.c
- 1774024002 fiz.man
- 4182972025 generic.c
- 4010994345 getfile.c
- X 955564271 huf.c
- 2264840036 io.c
- X 75805716 lzc.asm
- 3570919889 lzc.c
- 2349470583 lzconst.h
- 1707878509 lzd.asm
- 2897597557 lzd.c
- 3828693743 lzh.c
- 2429644475 lzh.h
- 3979315416 machine.c
- X 182740816 machine.h
- X 535357786 macros.ai
- 2011785281 makefile
- 2589398917 makefile.tcc
- 2126848007 makelist.c
- 3525602735 maketbl.c
- X 876325461 maketree.c
- 2551733860 misc.c
- 2137143154 misc2.c
- 3638187888 msdos.c
- 3448357770 mstime.i
- X 31631311 needed.c
- 1766157868 nextfile.c
- X 199542926 nixmode.i
- 4077222384 nixtime.i
- X 538776329 options.c
- 1046541896 options.doc
- X 180668707 options.h
- X 900930479 options.opt
- X 736653532 parse.c
- X 574404514 parse.h
- 1002254917 portable.c
- 2748395706 portable.h
- 2801811069 prterror.c
- 3802884050 sysv.c
- 2806576319 turboc.c
- 3251857396 turboc.cfg
- 3963527820 various.h
- 1396445097 version.c
- 2692606938 vms.c
- 1336602147 vmsbugs.doc
- 2881095287 vmsbuild.com
- 3049809232 vmstime.c
- 3500434419 zoo.1
- 2239462961 zoo.c
- 2894729456 zoo.h
- 2869866215 zoo.man
- 2959104574 zooadd.c
- 3729120263 zooadd2.c
- X 367556730 zoodel.c
- 3847646036 zooext.c
- X 987202888 zoofilt.c
- 2253746453 zoofns.h
- X 778874820 zooio.h
- 1037042734 zoolist.c
- X 879931512 zoomem.h
- 3513827030 zoopack.c
- SHAR_EOF
- chmod 0644 Checksums ||
- echo 'restore of Checksums failed'
- Wc_c="`wc -c < 'Checksums'`"
- test 2176 -eq "$Wc_c" ||
- echo 'Checksums: original size 2176, current size' "$Wc_c"
- fi
- # ============= Copyright ==============
- if test -f 'Copyright' -a X"$1" != X"-c"; then
- echo 'x - skipping Copyright (File already exists)'
- else
- echo 'x - extracting Copyright (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'Copyright' &&
- X
- X COPYRIGHT
- X
- X
- The following rules apply only to the zoo archiver itself.
- Currently, all extract-only programs, and all supporting utili-
- ties, are fully in the public domain and are expected to remain so
- for the forseeable future.
- X
- X COPYRIGHT STATEMENT FOR ZOO ARCHIVE PROGRAM
- X
- 1. "This software" refers separately to each existing version, and
- X each existing authorized derivative work, of my zoo archive
- X program as of the date at the bottom of this copyright statement.
- X
- 2. DISTRIBUTION IN UNMODIFIED FORM: You may copy this software in
- X unmodified form for any purpose, whether commercial or
- X noncommercial, provided that you make no attempt to restrict
- X distribution of it by others.
- X
- 3. CREATION OF DERIVATIVE WORKS: You may create and distribute
- X derivative works made from any source code files that are part of
- X this software, provided that you (a) preserve all copyright
- X notices and author attributions, (b) do not create, whether
- X deliberately or through negligence, any derivative work that
- X violates the compatibility goals describe in the reference manual
- X for zoo 2.1, (c) do not attempt to restrict the distribution or
- X use of the derivative work by others, (d) make the fully commented
- X source code of the derivative work available to me at no cost if
- X I so request, and make no attempt to restrict the distribution
- X or use of this source code.
- X
- 4. NO WARRANTY. I make no claim that this software is free of defects.
- X I do not accept any legal obligation to provide any bug fixes or
- X any other type of support whatsoever. I disclaim all liability
- X for damages, whether direct or consequential.
- X
- 5. EXCEPTIONS: Exceptions to the above conditions are probably
- X possible. Please contact me to negotiate.
- X
- 6. The prohibition against incompatible derivative works does not
- X necessarily imply that the archiver and the archive format cannot
- X be enhanced. However, if any incompatibility is created, it may
- X be done only with my permission.
- X
- X -- Rahul Dhesi 1991/07/07
- SHAR_EOF
- chmod 0644 Copyright ||
- echo 'restore of Copyright failed'
- Wc_c="`wc -c < 'Copyright'`"
- test 2160 -eq "$Wc_c" ||
- echo 'Copyright: original size 2160, current size' "$Wc_c"
- fi
- # ============= Install ==============
- if test -f 'Install' -a X"$1" != X"-c"; then
- echo 'x - skipping Install (File already exists)'
- else
- echo 'x - extracting Install (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'Install' &&
- X
- X INSTALLATION
- X
- This is version 2.1 of the zoo archiver. It includes improved compression,
- better online help, VAX/VMS file timestamp preservation, faster
- uncompression, and other features that are described in the accompanying
- manual ("zoo.1" or "zoo.man").
- X
- The supplied makefile contains a number of targets for selected systems.
- Type "make help" for help from the makefile. Also, for VAX/VMS
- systems, see the file vmsbugs.doc for VMS-specific information.
- X
- The file ``options.h'' defines preprocessor symbols for the various sys-
- tems. In most cases, given a reasonably powerful C compiler and
- library, you will be able to find a combination of options that will
- work. Documentation for these options is in the file ``options.doc''.
- X
- Other machine-dependent code and definitions are in machine.h,
- machine.c, and portable.h. Also, the amount of memory used for some
- arrays can be customized by defining symbols that are described and used
- in zoomem.h.
- X
- The low-level input/output routines are in portable.c. In most cases
- these will not need to be modified.
- X
- On machines with older (Intel-style) architectures zoo requires the
- large memory model. Compiling with the small memory model will
- cause problems.
- X
- EXTRACT-ONLY VERSION. For a new system, your first concern should be
- the ability to extract and list zoo archives. For this purpose try com-
- piling booz (which stands for Barebones Ooz) (currently version 2.0),
- which is small and portable. It is distributed separately from zoo.
- X
- X KNOWN BUGS
- X
- 1. The filter mode of zoo 2.1 appears to compresses and uncompresses
- correctly, but often reports an "Uncompression error" even when
- uncompression was successful.
- X
- 2. It is possible for zoo 2.1 to fail to detect an out of disk space
- situation when adding files to a zoo archive.
- X
- 3. The MS-DOS version of zoo 2.1 may unnecessarily report an error
- when extracting a file to standard output. Normal file extraction
- to disk is not affected.
- X
- These bugs are expected to be fixed in the next release.
- X
- X -- Rahul Dhesi 1991/07/07
- SHAR_EOF
- chmod 0644 Install ||
- echo 'restore of Install failed'
- Wc_c="`wc -c < 'Install'`"
- test 2138 -eq "$Wc_c" ||
- echo 'Install: original size 2138, current size' "$Wc_c"
- fi
- # ============= List ==============
- if test -f 'List' -a X"$1" != X"-c"; then
- echo 'x - skipping List (File already exists)'
- else
- echo 'x - extracting List (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'List' &&
- ## List of files for zoo 2.1
- ##
- ## Here is a list of all files that are part of the zoo 2.1 source
- ## distribution.
- ##
- ## @all: for all systems
- ## @bsd: BSD
- ## @sysv: System V
- ## @vms: VMS
- ## @gen: Generic **IX systems
- ## @tcc: Turbo C/MS-DOS
- ## @doc: Documentation (not source code etc.)
- ##
- ## To select all files needed for a specific system, just do a search.
- ## For example, to find all non-doc files needed for BSD:
- ##
- ## egrep '@bsd|@all' list.master | grep -v '@doc' | grep -v '^##'
- ##
- Copyright @doc @all
- Install @doc @all
- List @doc @all
- addbfcrc.c @all -@tcc
- addbftcc.c @tcc
- addfname.c @all
- ar.h @all
- asmconst.ai @tcc
- assert.h @all
- basename.c @all
- bilf.c @vms
- bsd.c @bsd
- comment.c @all
- crcdefs.c @all
- debug.h @all
- decode.c @all
- descrip.mms @vms
- encode.c @all
- errors.i @all
- file.fix @doc @bsd @sysv
- fiz.1 @doc @all
- fiz.c @all
- fiz.man @doc @all
- generic.c @gen
- getfile.c @all
- huf.c @all
- io.c @all
- lzc.asm @tcc
- lzc.c @all
- lzconst.h @all
- lzd.asm @tcc
- lzd.c @all
- lzh.c @all
- lzh.h @all
- machine.c @all
- machine.h @all
- macros.ai @tcc
- makefile @bsd @sysv
- makefile.tcc @tcc
- makelist.c @all
- maketbl.c @all
- maketree.c @all
- misc.c @all
- misc2.c @all
- msdos.c @all
- mstime.i @all
- needed.c @all
- nextfile.c @all
- nixmode.i @bsd @sysv
- nixtime.i @bsd @sysv
- options.c @all
- options.doc @doc
- options.h @all
- options.opt @vms
- parse.c @all
- parse.h @all
- portable.c @all
- portable.h @all
- prterror.c @all
- sysv.c @sysv
- turboc.c @tcc
- turboc.cfg @tcc
- various.h @all
- version.c @all
- vms.c @vms
- vmsbugs.doc @doc
- vmsbuild.com @vms
- vmstime.c @vms
- zoo.1 @doc
- zoo.c @all
- zoo.h @all
- zoo.man @doc
- zooadd.c @all
- zooadd2.c @all
- zoodel.c @all
- zooext.c @all
- zoofilt.c @all
- zoofns.h @all
- zooio.h @all
- zoolist.c @all
- zoomem.h @all
- zoopack.c @all
- SHAR_EOF
- chmod 0644 List ||
- echo 'restore of List failed'
- Wc_c="`wc -c < 'List'`"
- test 2706 -eq "$Wc_c" ||
- echo 'List: original size 2706, current size' "$Wc_c"
- fi
- # ============= addbfcrc.c ==============
- if test -f 'addbfcrc.c' -a X"$1" != X"-c"; then
- echo 'x - skipping addbfcrc.c (File already exists)'
- else
- echo 'x - extracting addbfcrc.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'addbfcrc.c' &&
- #ifndef LINT
- static char sccsid[]="@(#) addbfcrc.c 2.2 88/01/29 17:04:31";
- #endif /* LINT */
- X
- #include "options.h"
- /*
- addbfcrc() accepts a buffer address and a count and adds the CRC for
- all bytes in the buffer to the global variable crccode using
- CRC-16.
- X
- CRC computation algorithm originally from an article by David Schwaderer
- in the April 1985 issue of PC Tech Journal.
- X
- Loop optimization done by J. Brian Waters.
- X
- I claim no copyright over the contents of this file.
- X
- X -- Rahul Dhesi 1986/08/27
- X
- */
- X
- extern unsigned int crccode;
- extern unsigned crctab[];
- X
- void addbfcrc(buffer,count)
- register char *buffer;
- register int count;
- X
- {
- X register unsigned int localcrc;
- X localcrc = crccode;
- X
- X for (; count--; )
- X localcrc = (localcrc>>8) ^ crctab[(localcrc ^ (*buffer++)) & 0x00ff];
- X crccode = localcrc;
- }
- SHAR_EOF
- chmod 0644 addbfcrc.c ||
- echo 'restore of addbfcrc.c failed'
- Wc_c="`wc -c < 'addbfcrc.c'`"
- test 852 -eq "$Wc_c" ||
- echo 'addbfcrc.c: original size 852, current size' "$Wc_c"
- fi
- # ============= addbftcc.c ==============
- if test -f 'addbftcc.c' -a X"$1" != X"-c"; then
- echo 'x - skipping addbftcc.c (File already exists)'
- else
- echo 'x - extracting addbftcc.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'addbftcc.c' &&
- #pragma inline /* tell turbo assemble to use inline assembly */
- #ifndef LINT
- static char sccsid[]="$Source: /usr/home/dhesi/zoo/RCS/addbftcc.c,v $\n\
- $Id: addbftcc.c,v 1.1 91/07/07 18:40:11 dhesi Exp $";
- #endif /* LINT */
- X
- extern unsigned int crccode;
- extern unsigned crctab[];
- X
- void addbfcrc(buffer,count)
- char *buffer;
- int count;
- {
- X (void) kbhit(); /* allow keyboard interrupt to occur */
- X _AX = crccode; /* ax holds crccode value */
- X _CX = count; /* cx holds byte count */
- X asm les di,buffer /* es:di holds buffer address */
- X
- X asm jcxz done /* if zero bytes, just skip */
- X
- /* loop begins here */
- xloop:
- X asm sub bh,bh
- X asm mov bl,al
- X asm xor bl,es:[di] /* now bx = (crccode xor c) & 0x00ff */
- X /* next statement shifts _BX left (2-byte items) */
- X _DX = crctab[_BX]; /* dx <= *buffer == exp2 */
- X asm sub bh,bh /* bh = 0 */
- X asm mov bl,ah /* bx <- exp1 */
- X asm xor bx,dx /* bx <- exp1 xor exp2 */
- X asm mov ax,bx /* crccode <- exp1 xor exp2 */
- X asm inc di /* inc buffer pointer */
- X asm loop xloop /* dec CX, jump if not zero */
- /* loop ends here */
- X
- X crccode = _AX; /* put back calculated CRC value */
- X
- done:
- X ;
- X
- }
- X
- X
- #if 0
- ; The following (edited) code was generated by Turbo C from the
- ; preceding code. It is supplied here for porting to other systems
- ; and for user education.
- X
- _TEXT segment byte public 'CODE'
- _TEXT ends
- X
- DGROUP group _DATA,_BSS
- X assume cs:_TEXT,ds:DGROUP
- X
- _DATA segment word public 'DATA'
- _DATA ends
- X
- _BSS segment word public 'BSS'
- _BSS ends
- X
- _TEXT segment byte public 'CODE'
- X
- X assume cs:_TEXT
- _addbfcrc proc near
- X push bp
- X mov bp,sp
- X push di
- X
- X call near ptr _kbhit
- X mov ax,word ptr DGROUP:_crccode
- X mov cx,word ptr [bp+8]
- X les di,[bp+4]
- X jcxz short @1@362
- @1@98:
- X sub bh,bh
- X mov bl,al
- X xor bl,es:[di]
- X shl bx,1
- X mov dx,word ptr DGROUP:_crctab[bx]
- X sub bh,bh
- X mov bl,ah
- X xor bx,dx
- X mov ax,bx
- X inc di
- X loop short @1@98
- X mov word ptr DGROUP:_crccode,ax
- @1@362:
- X pop di
- X pop bp
- X ret
- _addbfcrc endp
- _TEXT ends
- X
- X extrn _crccode:word
- X extrn _kbhit:near
- X extrn _crctab:word
- X public _addbfcrc
- X end
- #endif
- SHAR_EOF
- chmod 0644 addbftcc.c ||
- echo 'restore of addbftcc.c failed'
- Wc_c="`wc -c < 'addbftcc.c'`"
- test 2097 -eq "$Wc_c" ||
- echo 'addbftcc.c: original size 2097, current size' "$Wc_c"
- fi
- # ============= addfname.c ==============
- if test -f 'addfname.c' -a X"$1" != X"-c"; then
- echo 'x - skipping addfname.c (File already exists)'
- else
- echo 'x - extracting addfname.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'addfname.c' &&
- #ifndef LINT
- static char sccsid[]="@(#) addfname.c 2.11 88/02/06 20:17:17";
- #endif /* LINT */
- X
- /*
- Copyright (C) 1986, 1987 Rahul Dhesi -- All rights reserved
- (C) Copyright 1988 Rahul Dhesi -- All rights reserved
- */
- #include "options.h"
- X
- /* Adds a filename to global list. (This global list will eventually
- be searched by the inlist() function.) The second and subsequent
- parameters suppplied are stored with the name of the file and
- returned by inlist. */
- X
- #include "zooio.h"
- #include "various.h"
- #include "zoo.h"
- #include "zoofns.h"
- #include "zoomem.h" /* to get LIST_SIZE */
- X
- #define FENTRY_BSIZE 80 /* allocation granularity for fentry below */
- static struct item **fentry; /* array of ptrs to file information structs */
- static unsigned sz_fentry; /* its current size */
- static int lastname = 0; /* index of last name */
- X
- struct item { /* global filename list entry */
- X char *fname;
- X long position;
- X unsigned int date;
- X unsigned int time;
- X unsigned vflag;
- X unsigned version_no;
- };
- X
- void addfname(fname, position, date, time, vflag, version_no)
- char *fname;
- long position;
- unsigned int date, time;
- unsigned vflag;
- unsigned version_no;
- {
- X if (lastname == 0) {
- X sz_fentry = FENTRY_BSIZE;
- X fentry = (struct item **) ealloc(sizeof(struct item *) * sz_fentry);
- X fentry[0] = (struct item *) ealloc (sizeof(struct item));
- X }
- X
- X /* allocated more memory if needed */
- X if (lastname >= sz_fentry - 3) {
- X sz_fentry += FENTRY_BSIZE;
- X fentry = (struct item **)
- X erealloc(fentry, sizeof(struct item *) * sz_fentry);
- X }
- X
- X fentry[lastname]->fname = str_dup(fname);
- X fentry[lastname]->position = position;
- X fentry[lastname]->date = date;
- X fentry[lastname]->time = time;
- X fentry[lastname]->vflag = vflag;
- X fentry[lastname]->version_no = version_no;
- X lastname++;
- X /* allocate memory for empty entry at end */
- X fentry[lastname] = (struct item *) ealloc (sizeof(struct item));
- } /* addfname */
- X
- /* inlist() */
- /* Examines global list built by addfname() to see if supplied filename
- is in the list.
- X
- If found, returns the file's position within the archive as the function
- value and the date, time, version flag, and version number as parameters.
- If not found, returns -1. Also returns the highest version no. seen
- for this filename and the vflag associated with that version.
- X
- A simple sequential search is done.
- X
- If justname is nonzero, then the search is for the filename only
- without the directory prefix; else it is for the full
- pathname.
- */
- X
- long inlist (fname, date, time, this_version_no, high_vflag,
- X high_version_no, high_pos, justname)
- char *fname;
- unsigned int *date, *time;
- unsigned *high_vflag;
- unsigned *this_version_no;
- unsigned *high_version_no;
- long *high_pos;
- int justname;
- {
- X register int i = 0;
- X
- X *high_version_no = 0;
- X if (justname)
- X fname = nameptr (fname); /* if directory wanted */
- X fentry[lastname]->fname = fname; /* sentinel */
- X fentry[lastname]->version_no = 0;
- X
- #ifdef IGNORECASE
- #define COMPARE str_icmp
- #else
- #define COMPARE strcmp
- #endif
- X
- X while (COMPARE(fname,
- X (justname ? nameptr (fentry[i]->fname) : fentry[i]->fname)) != 0) {
- X i++;
- X }
- X
- X if (i == lastname)
- X return (-1L);
- X else {
- X int j;
- X *date = fentry[i]->date;
- X *time = fentry[i]->time;
- X *high_pos = fentry[i]->position;
- X *high_vflag = fentry[i]->vflag;
- X for (j = i; j < lastname; j++) { /* find highest version no. for file */
- X if (COMPARE(fname,
- X (justname ? nameptr (fentry[j]->fname) : fentry[j]->fname)) == 0) {
- X if (*high_version_no < fentry[j]->version_no) {
- X *high_version_no = fentry[j]->version_no;
- X *high_vflag = fentry[j]->vflag;
- X *high_pos = fentry[j]->position;
- X *date = fentry[j]->date;
- X *time = fentry[j]->time;
- X }
- X }
- X }
- X *this_version_no = fentry[i]->version_no;
- X return (fentry[i]->position);
- X }
- } /* inlist() */
- SHAR_EOF
- chmod 0644 addfname.c ||
- echo 'restore of addfname.c failed'
- Wc_c="`wc -c < 'addfname.c'`"
- test 3872 -eq "$Wc_c" ||
- echo 'addfname.c: original size 3872, current size' "$Wc_c"
- fi
- # ============= ar.h ==============
- if test -f 'ar.h' -a X"$1" != X"-c"; then
- echo 'x - skipping ar.h (File already exists)'
- else
- echo 'x - extracting ar.h (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'ar.h' &&
- /*$Source: /usr/home/dhesi/zoo/RCS/ar.h,v $*/
- /*$Id: ar.h,v 1.17 91/07/09 01:39:50 dhesi Exp $*/
- /***********************************************************
- X ar.h
- X
- Adapted from "ar" archiver written by Haruhiko Okumura.
- ***********************************************************/
- X
- #include <stdio.h>
- X
- #ifdef ANSI_HDRS
- # include <limits.h>
- #endif
- X
- /* uchar should be 8 bits or more */
- /* typedef unsigned char uchar; -- already in zoo.h */
- X
- typedef unsigned int uint; /* 16 bits or more */
- typedef unsigned short ushort; /* 16 bits or more */
- typedef unsigned long ulong; /* 32 bits or more */
- X
- /* T_UINT16 must be #defined in options.h to be
- a 16-bit unsigned integer type */
- X
- #ifndef T_UINT16
- # include "T_UINT16 not defined"
- #endif
- X
- typedef T_UINT16 t_uint16; /* exactly 16 bits */
- X
- #ifndef SEEK_SET
- # define SEEK_SET 0
- #endif
- #ifndef SEEK_CUR
- # define SEEK_CUR 1
- #endif
- #ifndef SEEK_END
- # define SEEK_END 2
- #endif
- #ifndef EXIT_SUCCESS
- # define EXIT_SUCCESS 0
- #endif
- #ifndef EXIT_FAILURE
- # define EXIT_FAILURE 1
- #endif
- X
- /* ar.c */
- X
- extern int unpackable;
- extern ulong origsize, compsize;
- X
- /* all the prototypes follow here for all files */
- X
- /* standard library functions */
- #ifndef ANSI_HDRS
- X extern void exit();
- X extern long ftell();
- X extern int fseek();
- X extern int strlen();
- X extern char *strchr();
- X extern char *strpbrk();
- X extern int strcmp();
- X extern char *strcpy();
- X extern int memcmp();
- X extern VOIDPTR malloc();
- X extern VOIDPTR memcpy();
- #endif /* ANSI_HDRS */
- X
- /* AR.C */
- int get_line PARMS((char *s , int n ));
- void exitfunc PARMS((int code));
- void dlog PARMS((char *fmt, ...));
- void d1log PARMS((char *fmt, ...));
- void outcf PARMS((FILE *stream, char *buf, int n));
- void c1log PARMS((char *buf, int n));
- X
- /* DECODE.C */
- void decode_start PARMS((void ));
- int decode PARMS((uint count , uchar buffer []));
- X
- /* ENCODE.C */
- void encode PARMS((FILE *, FILE *));
- X
- /* HUF.C */
- void output PARMS((uint c , uint p ));
- void huf_encode_start PARMS((void ));
- void huf_encode_end PARMS((void ));
- uint decode_c PARMS((void ));
- uint decode_p PARMS((void ));
- void huf_decode_start PARMS((void ));
- X
- /* IO.C */
- void make_crctable PARMS((void ));
- void fillbuf PARMS((int n ));
- uint getbits PARMS((int n ));
- void putbits PARMS((int n , uint x ));
- int fread_crc PARMS((uchar *p , int n , FILE *f ));
- void fwrite_crc PARMS((uchar *p , int n , FILE *f ));
- void init_getbits PARMS((void ));
- void init_putbits PARMS((void ));
- X
- /* MAKETBL.C */
- void make_table
- X PARMS((int nchar, uchar bitlen[], int tablebits, ushort table[]));
- X
- /* MAKETREE.C */
- int make_tree
- X PARMS((int nparm, ushort freqparm [], uchar lenparm [], ushort codeparm []));
- X
- /* delete */
- X
- #ifdef NEED_MEMMOVE
- # define MOVE_LEFT move_left
- X void move_left();
- #else
- # define MOVE_LEFT memmove
- X extern VOIDPTR memmove();
- #endif
- X
- #if 0
- /* global crc variable stuff for use by various routines */
- extern t_uint16 crc;
- #define INIT_CRC 0 /* CCITT: 0xFFFF */
- #endif
- X
- /* for lzh modules and also for ar.c to use in defining buffer size */
- #define DICBIT 13 /* 12(-lh4-) or 13(-lh5-) */
- #define DICSIZ ((unsigned) 1 << DICBIT)
- SHAR_EOF
- chmod 0644 ar.h ||
- echo 'restore of ar.h failed'
- Wc_c="`wc -c < 'ar.h'`"
- test 3097 -eq "$Wc_c" ||
- echo 'ar.h: original size 3097, current size' "$Wc_c"
- fi
- # ============= asmconst.ai ==============
- if test -f 'asmconst.ai' -a X"$1" != X"-c"; then
- echo 'x - skipping asmconst.ai (File already exists)'
- else
- echo 'x - extracting asmconst.ai (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'asmconst.ai' &&
- ; $Source: /usr/home/dhesi/zoo/RCS/asmconst.ai,v $
- ; $Id: asmconst.ai,v 1.2 91/07/07 09:37:47 dhesi Exp $
- ;The contents of this file are hereby released to the public domain.
- ; -- Rahul Dhesi 1988/08/25
- X
- ;Constant values for lzc.asm and lzd.asm
- maxbits equ 13
- clear equ 256 ;Clear code
- eof equ 257 ;End of file marker
- first_free equ 258 ;First free code
- maxmax equ 1 shl maxbits ;Max code + 1
- X
- inbufsiz equ 8192 ;size of input buffer
- outbufsiz equ 8192 ;size of output buffer
- SHAR_EOF
- chmod 0644 asmconst.ai ||
- echo 'restore of asmconst.ai failed'
- Wc_c="`wc -c < 'asmconst.ai'`"
- test 517 -eq "$Wc_c" ||
- echo 'asmconst.ai: original size 517, current size' "$Wc_c"
- fi
- # ============= assert.h ==============
- if test -f 'assert.h' -a X"$1" != X"-c"; then
- echo 'x - skipping assert.h (File already exists)'
- else
- echo 'x - extracting assert.h (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'assert.h' &&
- /* @(#) assert.h 2.1 87/12/25 12:21:32 */
- X
- /*
- The contents of this file are hereby released to the public domain.
- X
- X -- Rahul Dhesi 1991/07/04
- X
- Defines a macro assert() that causes an assertion error if the assertion
- fails.
- X
- Conditional compilation:
- X
- X If NDEBUG is defined then
- X assert() is defined as null so all assertions vanish
- X else
- X if __FILE__ and __LINE__ are defined then
- X assertions print message including filename and line number
- X else
- X assertions print a message but not the filename and line number
- X endif
- X endif
- */
- X
- #ifdef NDEBUG
- # define assert(E)
- #else
- X
- #undef LINE_FILE
- X
- #ifdef __LINE__
- # ifdef __FILE__
- # define LINE_FILE
- # endif
- #endif
- X
- #ifdef LINE_FILE
- # undef LINE_FILE
- # define assert(E) \
- X { if (!(E)) \
- X prterror ('w',"Assertion error in %s:%d.\n", __FILE__, __LINE__); \
- X }
- #else
- # define assert(E) \
- X { if (!(E)) \
- X prterror ('w', "Assertion error.\n"); \
- X }
- #endif
- #endif /* NDEBUG */
- SHAR_EOF
- chmod 0644 assert.h ||
- echo 'restore of assert.h failed'
- Wc_c="`wc -c < 'assert.h'`"
- test 995 -eq "$Wc_c" ||
- echo 'assert.h: original size 995, current size' "$Wc_c"
- fi
- # ============= basename.c ==============
- if test -f 'basename.c' -a X"$1" != X"-c"; then
- echo 'x - skipping basename.c (File already exists)'
- else
- echo 'x - extracting basename.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'basename.c' &&
- #ifndef LINT
- /* @(#) basename.c 2.2 87/12/27 13:42:40 */
- static char sccsid[]="@(#) basename.c 2.2 87/12/27 13:42:40";
- #endif /* LINT */
- X
- /*
- Copyright (C) 1986, 1987 Rahul Dhesi -- All rights reserved
- */
- X
- #include "options.h"
- #include "zooio.h"
- #include "zoo.h"
- #include "parse.h"
- #include "various.h"
- #include "zoofns.h"
- #include "debug.h"
- #include "assert.h"
- X
- /* This function strips device/directory information from
- a pathname and returns just the plain filename */
- void basename (pathname, fname)
- char *pathname;
- char fname[];
- {
- X strcpy (fname, nameptr (pathname));
- }
- X
- /* Set of legal MSDOS filename characters. The working of cvtchr() depends
- on the order of the first few characters here. In particular, '_' is
- positioned so '.' gets converted to it. */
- static char legal[] =
- "tabcdefghijklmnopqrs_uvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ@^`{}~!#$%&'()-";
- X
- /****************
- cvtchr() converts a character to a lowercase alphabetic character in
- a somewhat random way.
- */
- #define cvtchr(ch) legal[(ch & 0xff) % 26]
- X
- /***************
- cleanup() cleans up a string so it contains only legal MSDOS filename
- characters. Any other characters are converted to an underscore.
- If the filename is null or if it begins with a dot, it is fixed.
- All dots are also converted.
- */
- X
- void cleanup (p)
- char *p;
- {
- X assert(p != NULL);
- X if (*p == '\0')
- X strcpy (p, "X");
- X if (*p == '.')
- X *p = '_';
- X while (*p != '\0') {
- X if (strchr (legal, *p) == NULL) { /* if invalid character */
- X *p = cvtchr(*p);
- X }
- X p++;
- X }
- }
- /* This function strips device/directory information from a pathname,
- forces the remaining filename to MSDOS format, and returns it. Any
- illegal characters are fixed.
- */
- void dosname (pathname, fname)
- char *pathname;
- char fname[];
- {
- X struct path_st path_st;
- X parse (&path_st, pathname);
- X strcpy (fname, path_st.fname);
- X cleanup (fname);
- X
- #ifdef VER_CH /* remove any trailing extension field */
- X if (path_st.ext[0] != '\0')
- X strip_ver (path_st.ext);
- #endif
- X
- X /* extension could have been nulled, so we test again */
- X if (path_st.ext[0] != '\0') {
- X cleanup (path_st.ext);
- X strcat (fname, ".");
- X strcat (fname, path_st.ext);
- X }
- X
- #ifdef SPECMOD
- X specfname (fname);
- #endif
- }
- X
- /* rootname() */
- /* Accepts a pathname. Returns the root filename, i.e., with both the
- directory path and the extension stripped. */
- X
- void rootname (path, root)
- char *path, *root;
- {
- X char *p;
- X static char dot[] = {EXT_CH, '\0'};
- X strcpy(root, nameptr(path)); /* copy all but path prefix */
- X p = findlast(root, dot); /* find last dot */
- X if (p != NULL) /* if found ... */
- X *p = '\0'; /* ... null it out */
- }
- X
- /* nameptr() */
- /* Accepts a pathname. Returns a pointer to the filename within
- that pathname.
- */
- X
- char *nameptr (path)
- char *path;
- {
- X char *t;
- X t = findlast (path, PATH_SEP); /* last char separating device/directory */
- X debug ((printf ("nameptr: findlast returned ptr to string [%s].\n",t)))
- X if (t == NULL) /* no separator */
- X return (path);
- X else {
- X return (t+1);
- X }
- }
- SHAR_EOF
- chmod 0644 basename.c ||
- echo 'restore of basename.c failed'
- Wc_c="`wc -c < 'basename.c'`"
- test 3181 -eq "$Wc_c" ||
- echo 'basename.c: original size 3181, current size' "$Wc_c"
- fi
- # ============= bilf.c ==============
- if test -f 'bilf.c' -a X"$1" != X"-c"; then
- echo 'x - skipping bilf.c (File already exists)'
- else
- echo 'x - extracting bilf.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'bilf.c' &&
- /* $Source: /usr/home/dhesi/zoo/RCS/bilf.c,v $ */
- /* $Id: bilf.c,v 1.2 91/07/07 14:57:06 dhesi Exp $ */
- X
- /*
- This program performs conversion of files between stream-LF format
- (as used by zoo) and fixed-length record binary format (used for Kermit
- transfers of zoo archives).
- X
- This program is:
- X (C) Copyright 1987 Rahul Dhesi.
- X All Rights Reserved.
- X
- Permission is hereby granted to copy and modify this for any purpose,
- whether commercial or noncommercial, provided only that the above
- copyright notice and this paragraph be preserved and included
- in all copies.
- X
- X -- Rahul Dhesi 1987/07/25
- */
- X
- #include <stdio.h>
- #include <ssdef.h>
- #define STAT_NORM SS$_NORMAL
- #define STAT_ABORT SS$_ABORT
- X
- char *strrchr();
- char *strdup ();
- X
- main (argc, argv)
- int argc;
- char *argv[];
- {
- X char *inname;
- X char *outname;
- X char *option;
- X int status;
- X
- X if (argc < 3 || argc > 4) {
- X printf ("BILF version 1.00 for VAX/VMS by Rahul Dhesi (1987/07/25)\n\n");
- X printf ("(C) Copyright 1987 Rahul Dhesi, All Rights Reserved\n");
- X printf ("Permission to use and distribute is granted provided this copyright\n");
- X printf ("notice is preserved and included in all copies.\n\n");
- X printf ("Usage: BILF {lb} infile [ outfile ]\n\n");
- X printf ("Choose one character from within braces. If outfile is not supplied\n");
- X printf ("it has the same name as infile but a higher version number.\n");
- X printf ("Options are:\n\n");
- X printf ("l: Write output file in stream-LF format. This is the format that\n");
- X printf (" zoo expects all zoo archives to be in. If a zoo archive was\n");
- X printf (" uploaded to a VAX/VMS system, it will need to be converted to\n");
- X printf (" stream-LF format before manipulating with zoo.\n\n");
- X printf ("b: Write output file in fixed-length 512-byte binary record format. Before\n");
- X printf (" a zoo archive can be downloaded from a VAX/VMS system to a\n");
- X printf (" microcomputer using VAX/VMS Kermit, it must be converted to\n");
- X printf (" this binary format. Failure to do so will result in a corrupted\n");
- X printf (" download.\n");
- X exit (STAT_NORM);
- X }
- X
- X inname = argv[2];
- X option = argv[1];
- X
- X if (argc == 3) { /* use same filename for output */
- X char *p;
- X outname = strdup (inname);
- X p = strrchr (outname, ';'); /* strip trailing version field */
- X if (p != NULL)
- X *p = '\0';
- X } else
- X outname = argv[3];
- X
- X if (*option == 'l')
- X status = cvtstream (outname, inname);
- X else if (*option == 'b')
- X status = cvtbin (outname, inname);
- X else
- X prterror ('f', "Option %s is invalid\n", option);
- X if (status == -1)
- X prterror ('w', "An error occurred -- output file may be corrupted\n");
- X exit (STAT_NORM);
- }
- X
- #define MYBUFSIZ 8192
- X
- /* writes input file to output file in stream format */
- int cvtstream (outname, inname)
- char *outname, *inname;
- {
- X FILE *infile, *outfile;
- X char buffer[MYBUFSIZ];
- X int count;
- X
- X infile = fopen (inname, "r");
- X if (infile == NULL)
- X prterror ('f', "Could not open input file %s\n", inname);
- X outfile = fopen (outname, "w");
- X if (outfile == NULL)
- X prterror ('f', "Could not open output file %s\n", outname);
- X
- X while ((count = fread (buffer, 1, sizeof (buffer), infile)) > 0)
- X count = fwrite (buffer, 1, count, outfile);
- X
- X close (infile); close (outfile);
- X if (count == -1)
- X return (-1);
- X else
- X return (0);
- }
- X
- /*
- VMS C doesn't have strdup().
- */
- char *strdup (str)
- char *str;
- {
- X char *malloc();
- X char *newstr = malloc (strlen (str) + 1);
- X if (newstr != NULL) {
- X strcpy (newstr, str);
- X return (newstr);
- X } else
- X return ((char *) NULL);
- }
- X
- /* BLKSIZ must correspond to block size specified below in creat() */
- #define BLKSIZ 512
- X
- /*
- Writes input file to output in fixed-length BLKSIZ-byte record format.
- */
- X
- #if 1
- #include <file.h>
- #else
- #include <fcntl.h>
- #endif
- X
- int convert ();
- X
- int cvtbin (outname, inname)
- char *outname, *inname;
- {
- X int status, inhan, outhan;
- X inhan = open (inname, O_RDONLY);
- X if (inhan == -1)
- X prterror ('f', "Could not open input file %s\n", inname);
- X outhan = creat (outname, 0, "rfm=fix", "mrs=512");
- X if (outhan == -1)
- X prterror ('f', "Could not open output file %s\n", outname);
- X status = convert (outhan, inhan);
- X close (inhan);
- X close (outhan);
- X return (status);
- }
- X
- /*
- Function convert() reads from inhan and writes to outhan, always
- writing in BLKSIZ-byte blocks, padding with nulls if necessary
- */
- X
- int convert (outhan, inhan)
- int inhan, outhan;
- {
- X char junk[BLKSIZ];
- X int count;
- X int done = 0;
- X do {
- X count = vmsread (inhan, junk, BLKSIZ);
- X if (count <= 0)
- X break;
- X if (count < BLKSIZ) {
- X int i;
- X for (i = count; i < BLKSIZ; i++)
- X junk[i] = 0;
- X done++;
- X }
- X count = write (outhan, junk, BLKSIZ);
- X if (count == -1)
- X break;
- X } while (!done);
- X if (count == -1)
- X return (-1);
- X else
- X return (0);
- }
- X
- /**** Function vmsread() does a standard read() but gets around bugs
- in the read() function of VAX/VMS C which make it unable to always
- read the entire amount requested in a single read() call.
- */
- int vmsread (han, buf, amount)
- int han;
- char *buf;
- int amount;
- {
- X int count;
- X int thiscount;
- X count = 0;
- X while (count != -1 && count < amount) {
- X thiscount = read (han, &buf[count], amount - count);
- X if (thiscount == 0)
- X thiscount = read (han, &buf[count], amount - count);
- X if (thiscount == 0)
- X break;
- X if (thiscount == -1)
- X count = -1;
- X else
- X count += thiscount;
- X }
- X return (count);
- }
- X
- prterror (level, msg1, msg2)
- char level;
- char *msg1, *msg2;
- {
- X if (level == 'e' || level == 'w' || level == 'f')
- X printf ("BILF: ");
- X
- X switch (level) {
- X case 'e': printf ("ERROR: "); break;
- X case 'w': printf ("WARNING: "); break;
- X case 'f': printf ("FATAL: "); break;
- X default: prterror ('f', "Internal error in prterror()\n");
- X }
- X
- X printf (msg1, msg2);
- X if (level == 'f')
- X exit (STAT_ABORT);
- }
- SHAR_EOF
- chmod 0644 bilf.c ||
- echo 'restore of bilf.c failed'
- Wc_c="`wc -c < 'bilf.c'`"
- test 6214 -eq "$Wc_c" ||
- echo 'bilf.c: original size 6214, current size' "$Wc_c"
- fi
- # ============= bsd.c ==============
- if test -f 'bsd.c' -a X"$1" != X"-c"; then
- echo 'x - skipping bsd.c (File already exists)'
- else
- echo 'x - extracting bsd.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'bsd.c' &&
- #ifndef LINT
- static char bsdid[]="@(#) bsd.c 2.3 88/01/10 14:45:19";
- #endif /* LINT */
- X
- /* machine.c for 4.3BSD. */
- X
- /*
- The contents of this file are hereby released to the public domain.
- X
- X -- Rahul Dhesi 1987/07/23
- */
- X
- /*
- WARNING: This file assumes that ZOOFILE is a standard buffered
- file. It will have to be modified if ZOOFILE is changed to
- be an unbuffered file descriptor or to any other kind of file.
- */
- X
- #ifdef UNBUF_IO
- /*
- Function tell() returns the current seek position for a file
- descriptor. 4.3BSD on VAX-11/785 has an undocumented tell() function
- but it may not exist on all implementations, so we code one here
- to be on the safe side. It is needed for unbuffered I/O only.
- */
- long lseek PARMS ((int, long, int));
- long tell (fd)
- int fd;
- { return (lseek (fd, 0L, 1)); }
- #endif
- X
- long ftell();
- X
- /****************
- Function fixfname() converts the supplied filename to a syntax
- legal for the host system. It is used during extraction.
- */
- X
- char *fixfname(fname)
- char *fname;
- {
- X return fname; /* default is no-op */
- }
- X
- /****************
- Date and time functions are standard UNIX-style functions.
- */
- X
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <sys/time.h>
- X
- /* Function isadir() returns 1 if the supplied handle is a directory,
- else it returns 0.
- */
- X
- int isadir (f)
- ZOOFILE f;
- {
- X struct stat buf; /* buffer to hold file information */
- X if (fstat (fileno (f), &buf) == -1) {
- X return (0); /* inaccessible -- assume not dir */
- X } else {
- X if (buf.st_mode & S_IFDIR)
- X return (1);
- X else
- X return (0);
- X }
- }
- X
- /* Function gettz() returns the offset from GMT in seconds */
- long gettz()
- {
- #define SEC_IN_DAY (24L * 60L * 60L)
- #define INV_VALUE (SEC_IN_DAY + 1L)
- X static long retval = INV_VALUE; /* cache, init to impossible value */
- X struct timeval tp;
- X struct timezone tzp;
- X if (retval != INV_VALUE) /* if have cached value, return it */
- X return retval;
- X gettimeofday (&tp, &tzp); /* specific to 4.3BSD */
- X /* return (tzp.tz_minuteswest * 60); */ /* old incorrect code */
- X /* Timezone fix thanks to Bill Davidsen <wedu@ge-crd.ARPA> */
- X retval = tzp.tz_minuteswest * 60 - tzp.tz_dsttime * 3600L;
- X return retval;
- }
- X
- /* Standard UNIX-compatible time routines */
- #include "nixtime.i"
- X
- /* Standard UNIX-specific file attribute routines */
- #include "nixmode.i"
- X
- #ifndef SEEK_CUR
- # define SEEK_CUR 1
- #endif
- X
- /* Truncate a file. */
- int zootrunc(f) FILE *f;
- {
- X extern long lseek();
- X long seekpos;
- X int fd = fileno(f);
- X seekpos = lseek(fd, 0L, SEEK_CUR);
- X if (seekpos >= 0)
- X return ftruncate(fd, seekpos);
- }
- SHAR_EOF
- chmod 0644 bsd.c ||
- echo 'restore of bsd.c failed'
- Wc_c="`wc -c < 'bsd.c'`"
- test 2650 -eq "$Wc_c" ||
- echo 'bsd.c: original size 2650, current size' "$Wc_c"
- fi
- true || echo 'restore of comment.c failed'
- echo End of part 1, continue with part 2
- exit 0
-