[comp.sources.d] ARC 5.21 Patch #1

hyc@math.lsa.umich.edu (Howard Chu) (08/01/88)

Ok, it's been a little longer than I expected, but here 'tis. There were very
few real bugs, and a few more suggestions, and this reflects all changes from
those suggestions...

A new copy of the Makefile is included - it's about half as long as the diffs
would be. Make.tws is unchanged. New files for System V support are also in a
shar file of their own. Some people had problems with the scandir.c posted in
the previous release - this collection of files should fix things. For folk
using SYSVR2, a rename() function is provided. (Thanks to Janet Walz for this
one, as well as Rich Salz...)

Bugs found & fixed -
	fopen() on various systems may or may not accept the 'b' (binary) flag
	in the mode parameter, and may or may not ignore it. It's no longer
	present when compiled on a Unix system. This seemed to only be a big
	problem for Ultrix users, 1.2 & 2.2 inclusive.

	The pack routine would bomb with a divide by zero error after storing
	a zero length file in an archive. Stupid oversight, fixed.

	The memset() routine was omitted, (it's in the library, right?) but
	isn't part of the standard BSD library. It's back.

Other changes made -
(Un*x)	Temp files will now be created in /tmp unless otherwise specified.
	Archive files can have arbitrarily long names.
	Filenames longer than 12 chars will be truncated, or the file will be
	skipped, when adding to an archive. Behavior is modified by both the
	Note and Warn option flags.
	Now uses localtime() to parse file timestamps.

(GEMDOS) Can redirect stdout when invoked from GEM desktop
	Accepts "*.*" as wildcard, as well as '*'

(MTS)	Fixed up handling of file buffers.

Compiled with GNU gcc on a Sun, Mark Williams C 3.0.6 on Atari ST, and C87
on MTS. All of these are ANSI conformant compilers.

Thanks again to John Gilmore, Jon Zeeff, and everyone else who mailed me
comments & bug reports & such. This should take care of 99% of the complaints.
  }-)
	Howard

#--------------------------------CUT HERE-------------------------------------
#! /bin/sh
#
# This is a shell archive.  Save this into a file, edit it
# and delete all lines above this comment.  Then give this
# file to sh by executing the command "sh file".  The files
# will be extracted into the current directory owned by
# you with default permissions.
#
# The files contained herein are:
#
# -r--r--r--  1 hyc          3163 Jul 31 18:33 Makefile
# -rw-r--r--  1 hyc          9367 Jul 22 16:30 Sysvarcstuf
# -rw-r--r--  1 hyc         32469 Jul 31 18:58 patches
#
echo 'x - Makefile'
if test -f Makefile; then echo 'shar: not overwriting Makefile'; else
sed 's/^X//' << '________This_Is_The_END________' > Makefile
X#
X#       Makefile for Hack-attack 1.3
X#       VAX 11/780 BSD4.2 "ARC" utility
X#
X# Originals from Dan Lanciani, James Turner, and others...
X#
X# Modified to support squashing, also added targets for the time routine
X# library.  -- Howard Chu, hyc@umix.cc.umich.edu, 4-11-88
X#
X# Modified again by John Gilmore & Howard Chu, July 1988.
X#
X# I put SRCDIR on a real disk on the ST, but copy the makefile to a
X# RAMdisk and compile from there. Makes things go a bit quicker...
X# This has to be done in the shell, to get the trailing backslash
X# specified correctly. e.g., setenv SRCDIR='d:\src\arc\'
XSRCDIR = 
X
XHEADER = $(SRCDIR)arc.h $(SRCDIR)arcs.h
X
X# Add a ".TTP" suffix to the executable files on an ST.
X#PROG = .ttp
XPROG =
X
X# TWSLIB is only needed on Unix systems. Likewise for TWHEAD.
X#TWSLIB =
X#TWHEAD =
XTWSLIB = libtws.a
XTWHEAD = tws.h
X
X# For MWC 3.0 on the Atari ST, use:
X#CFLAGS = -VCOMPAC -VPEEP
XCFLAGS = -O
X
XOBJS = arc.o arcadd.o arccode.o arccvt.o arcdata.o arcdel.o arcdos.o \
Xarcext.o arcio.o arclst.o arclzw.o arcmatch.o arcpack.o arcrun.o \
Xarcsq.o arcsqs.o arcsvc.o arctst.o arcunp.o arcusq.o arcmisc.o
X
XMOBJ = marc.o arcdata.o arcdos.o arcio.o arcmatch.o arcmisc.o
X
Xarc$(PROG):	$(OBJS) $(TWSLIB)
X	$(CC) -o arc$(PROG) $(OBJS) $(TWSLIB)
X
Xmarc$(PROG):	$(MOBJ) $(TWSLIB)
X	$(CC) -o marc$(PROG) $(MOBJ) $(TWSLIB)
X
Xclean:
X	-rm *.o arc$(PROG) marc$(PROG) $(TWSLIB)
X
Xarc.o:	$(SRCDIR)arc.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arc.c
Xmarc.o:	$(SRCDIR)marc.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)marc.c
Xarcadd.o:	$(SRCDIR)arcadd.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arcadd.c
Xarccode.o:	$(SRCDIR)arccode.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arccode.c
Xarccvt.o:	$(SRCDIR)arccvt.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arccvt.c
Xarcdata.o:	$(SRCDIR)arcdata.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arcdata.c
Xarcdel.o:	$(SRCDIR)arcdel.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arcdel.c
Xarcdir.o:	$(SRCDIR)arcdir.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arcdir.c
Xarcdos.o:	$(SRCDIR)arcdos.c	$(HEADER) $(TWHEAD)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arcdos.c
Xarcext.o:	$(SRCDIR)arcext.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arcext.c
Xarcio.o:	$(SRCDIR)arcio.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arcio.c
Xarclst.o:	$(SRCDIR)arclst.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arclst.c
Xarclzw.o:	$(SRCDIR)arclzw.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arclzw.c
Xarcmatch.o:	$(SRCDIR)arcmatch.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arcmatch.c
Xarcmisc.o:	$(SRCDIR)arcmisc.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arcmisc.c
Xarcpack.o:	$(SRCDIR)arcpack.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arcpack.c
Xarcrun.o:	$(SRCDIR)arcrun.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arcrun.c
Xarcsq.o:	$(SRCDIR)arcsq.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arcsq.c
Xarcsqs.o:	$(SRCDIR)arcsqs.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arcsqs.c
Xarcsvc.o:	$(SRCDIR)arcsvc.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arcsvc.c
Xarctst.o:	$(SRCDIR)arctst.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arctst.c
Xarcunp.o:	$(SRCDIR)arcunp.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arcunp.c
Xarcusq.o:	$(SRCDIR)arcusq.c	$(HEADER)
X	$(CC) $(CFLAGS) -c $(SRCDIR)arcusq.c
X
Xlibtws.a:
X	make -f Make.tws libtws.a
________This_Is_The_END________
if test `wc -c < Makefile` -ne     3163; then
	echo 'shar: Makefile was damaged during transit (should have been     3163 bytes)'
fi
fi		; : end of overwriting check
echo 'x - Sysvarcstuf'
if test -f Sysvarcstuf; then echo 'shar: not overwriting Sysvarcstuf'; else
sed 's/^X//' << '________This_Is_The_END________' > Sysvarcstuf
X#--------------------------------CUT HERE-------------------------------------
X#! /bin/sh
X#
X# This is a shell archive.  Save this into a file, edit it
X# and delete all lines above this comment.  Then give this
X# file to sh by executing the command "sh file".  The files
X# will be extracted into the current directory owned by
X# you with default permissions.
X#
X# The files contained herein are:
X#
X# -rw-r--r--  1 hyc           539 Jul 22 16:30 README
X# -rw-r--r--  1 hyc           787 Jul 22 15:10 getwd.c
X# -rw-r--r--  1 hyc           280 Jul 22 16:14 rename.c
X# -rw-r--r--  1 hyc          2353 Jul 22 15:55 scandir.3
X# -rw-r--r--  1 hyc          1875 Jul 22 15:55 scandir.c
X# -rw-r--r--  1 hyc           397 Jul 22 15:10 utimes.c
X#
Xecho 'x - README'
Xif test -f README; then echo 'shar: not overwriting README'; else
Xsed 's/^X//' << '________This_Is_The_END________' > README
XXThe enclosed files should be sufficient for bringing up ARC on a Sys V R3
XXsystem. As Jon mentions, Doug Gwyn's directory routines are needed for
XXSys V R2. The enclosed copy of scandir is new, as far as I can tell, and
XXI've removed the (unneeded) ftw.? files. Also added a rename() routine,
XXcourtesy of Janet Walz. (And an addition from Rich Salz.)
XX
XX[see comp.sources.unix, volume 9, for gwyn-dir-lib...]
XX
XXThanks again to Jon Zeeff, Janet Walz, and Rich Salz for their help.
XX  -- Howard Chu
XX	hyc@umix.cc.umich.edu
XX	{uunet,rutgers}!umix!hyc
X________This_Is_The_END________
Xif test `wc -c < README` -ne      539; then
X	echo 'shar: README was damaged during transit (should have been      539 bytes)'
Xfi
Xfi		; : end of overwriting check
Xecho 'x - getwd.c'
Xif test -f getwd.c; then echo 'shar: not overwriting getwd.c'; else
Xsed 's/^X//' << '________This_Is_The_END________' > getwd.c
XX/*
XX * 4.2bsd getwd simulation for Sys V.3
XX */
XX
XX#include <stdio.h>
XX
XX#define SYSV3
XX
XX#define MAXWD 1024	     /* limited by 4.2 getwd(2) */
XX
XX#ifdef SYSV3
XX
XXchar *getcwd();
XX
XXchar *
XXgetwd(path)
XXchar *path;
XX{
XX    return(getcwd(path,MAXWD));
XX}
XX
XX#else
XX
XX/*
XX * 4.2bsd getwd simulation for Sys V.2
XX */
XX
XX#include <stdio.h>
XX
XX#define MAXWD 1024	     /* limited by 4.2 getwd(2) */
XX
XXchar *
XXgetwd(path)
XXchar *path;
XX{
XX     char *nlp;
XX     FILE *fp;
XX     FILE *popen();
XX     char *strrchr();
XX
XX	putenv("IFS= \t\n");
XX     fp = popen("PATH=/bin:/usr/bin pwd", "r");
XX     if (fp == NULL)
XX	     return 0;
XX     if (fgets(path, MAXWD, fp) == NULL) {
XX	     (void) pclose(fp);
XX	     return 0;
XX     }
XX     if ((nlp = strrchr(path, '\n')) != NULL)
XX	     *nlp = '\0';
XX     (void) pclose(fp);
XX     return path;
XX}
XX#endif
XX
X________This_Is_The_END________
Xif test `wc -c < getwd.c` -ne      787; then
X	echo 'shar: getwd.c was damaged during transit (should have been      787 bytes)'
Xfi
Xfi		; : end of overwriting check
Xecho 'x - rename.c'
Xif test -f rename.c; then echo 'shar: not overwriting rename.c'; else
Xsed 's/^X//' << '________This_Is_The_END________' > rename.c
XX/*
XX * substitute for BSD/SVR3 rename() system call, from
XX * Janet Walz, walz@mimsy.umd.edu & Rich Salz, rsalz@pineapple.bbn.com
XX */
XX
XXint rename(oldname,newname)
XXchar *oldname,*newname;
XX{
XX	(void)unlink(newname);
XX	if(link(oldname,newname))
XX		return(-1);
XX	return(unlink(oldname));
XX}
X________This_Is_The_END________
Xif test `wc -c < rename.c` -ne      280; then
X	echo 'shar: rename.c was damaged during transit (should have been      280 bytes)'
Xfi
Xfi		; : end of overwriting check
Xecho 'x - scandir.3'
Xif test -f scandir.3; then echo 'shar: not overwriting scandir.3'; else
Xsed 's/^X//' << '________This_Is_The_END________' > scandir.3
XX.TH SCANDIR 3
XX.\" $Header: scandir.3,v 1.1 87/12/29 21:35:54 rsalz Exp $
XX.SH NAME
XXscandir, alphasort \- scan a directory
XX.SH SYNOPSIS
XX.nf
XX.ft B
XX#include <sys/types.h>
XX#include <sys/dirent.h>
XX
XXint
XXscandir(name, list, selector, sorter)
XX.in +4n
XXchar *name;
XXstruct dirent ***list;
XXint (*selector)();
XXint (*sorter)();
XX.in -4n
XX
XXint
XXalphasort(d1, d2)
XX.in +4n
XXstruct dirent **d1;
XXstruct dirent **d2;
XX.in -4n
XX.ft R
XX.fi
XX.SH DESCRIPTION
XX.I Scandir
XXreads the directory
XX.I name
XXand builds a NULL\-terminated array of pointers to the entries found
XXin that directory.
XXThis array is put into the location pointed to by the
XX.I list
XXparameter.
XX.PP
XXIf the
XX.I selector
XXparameter is non\-NULL, it is taken to be a pointer to a function called
XXwith each entry, to determine whether or not it should be included in
XXthe returned list.
XXIf the parameter is NULL, all entries are included.
XX.PP
XXAs an added feature, the entries can be sorted (with
XX.IR qsort (3))
XXbefore the list is returned.
XXIf the
XX.I sorter
XXparameter is non\-NULL, it is passed to qsort to use as the comparison
XXfunction.
XXThe
XX.I alphasort
XXroutine is provided to sort the array alphabetically.
XX.PP
XXThe array pointed to by
XX.I list
XXand the items it points to are all space obtained through
XX.IR malloc (3),
XXand their storage can be reclaimed as shown in the example below.
XX.SH "EXAMPLE"
XXHere is a small
XX.IR ls (1)\-like
XXprogram:
XX.ne 50
XX.RS
XX.nf
XX#include <stdio.h>
XX#include <sys/types.h>
XX#include <sys/stat.h>
XX#include <sys/dir.h>
XX
XXextern int alphasort();
XX
XXstatic int
XXfilesonly(e)
XX	struct dirent *e;
XX{
XX	struct stat sb;
XX
XX	return(stat(e->d_name, &sb) >= 0 && (sb.st_mode & S_IFMT) == S_IFREG);
XX}
XX
XXmain(ac, av)
XX	int ac;
XX	char *av[];
XX{
XX	register int i;
XX	register int j;
XX	struct dirent **list;
XX
XX	if (ac != 2) {
XX		fprintf(stderr, "usage: %s dirname\n", av[0]);
XX		exit(1);
XX	}
XX	if (chdir(av[1]) < 0) {
XX		perror(av[1]);
XX		exit(1);
XX	}
XX	if ((i = scandir(".", &list, filesonly, alphasort)) < 0) {
XX		perror("Error reading directory");
XX		exit(1);
XX	}
XX	for (j = 0; j < i; j++)
XX		printf("%s\n", list[j]->d_name);
XX	for (j = 0; j < i; j++)
XX		free((char *)list[j]);
XX	free((char *)list);
XX	exit(0);
XX}
XX.fi
XX.RE
XX.SH "SEE ALSO"
XXdirectory(3), qsort(3)
XX.SH DIAGNOSTICS
XXReturns the number of entries in the ``list,'' or \-1 if the directory
XXcould not be opened or a memory allocation failed.
XX.SH BUGS
XXThe routine can be slightly wasteful of space.
X________This_Is_The_END________
Xif test `wc -c < scandir.3` -ne     2353; then
X	echo 'shar: scandir.3 was damaged during transit (should have been     2353 bytes)'
Xfi
Xfi		; : end of overwriting check
Xecho 'x - scandir.c'
Xif test -f scandir.c; then echo 'shar: not overwriting scandir.c'; else
Xsed 's/^X//' << '________This_Is_The_END________' > scandir.c
XX/*
XX**  SCANDIR
XX**  Scan a directory, collecting all (selected) items into a an array.
XX*/
XX#include <stdio.h>
XX#include <sys/types.h>
XX#include <dirent.h>
XX
XX#ifdef	RCSID
XXstatic char RCS[] = "$Header: scandir.c,v 1.1 87/12/29 21:35:56 rsalz Exp $";
XX#endif	/* RCSID */
XX
XX/* Initial guess at directory size. */
XX#define INITIAL_SIZE	20
XX
XX/* A convenient shorthand. */
XXtypedef struct dirent	 ENTRY;
XX	    
XX#define DIRSIZ(d) (sizeof(struct dirent) + strlen(d->d_name) + 1) 
XX
XX/* Linked in later. */
XXextern char		*malloc();
XXextern char		*realloc();
XXextern char		*strcpy();
XX
XX
XXint
XXscandir(Name, List, Selector, Sorter)
XX    char		  *Name;
XX    ENTRY		***List;
XX    int			 (*Selector)();
XX    int			 (*Sorter)();
XX{
XX    register ENTRY	 **names;
XX    register ENTRY	  *E;
XX    register DIR	  *Dp;
XX    register int	   i;
XX    register int	   size;
XX
XX    /* Get initial list space and open directory. */
XX    size = INITIAL_SIZE;
XX    if ((names = (ENTRY **)malloc(size * sizeof names[0])) == NULL
XX     || (Dp = opendir(Name)) == NULL)
XX	return(-1);
XX
XX    /* Read entries in the directory. */
XX    for (i = 0; E = readdir(Dp); )
XX	if (Selector == NULL || (*Selector)(E)) {
XX	    /* User wants them all, or he wants this one. */
XX	    if (++i >= size) {
XX		size <<= 1;
XX		names = (ENTRY **)realloc((char *)names, size * sizeof names[0]);
XX		if (names == NULL) {
XX		    closedir(Dp);
XX		    return(-1);
XX		}
XX	    }
XX
XX	    /* Copy the entry. */
XX	    if ((names[i - 1] = (ENTRY *)malloc(DIRSIZ(E))) == NULL) { 
XX		closedir(Dp);
XX		return(-1);
XX	    }
XX	    names[i - 1]->d_ino = E->d_ino;
XX	    names[i - 1]->d_reclen = E->d_reclen;
XX	 /*   names[i - 1]->d_namlen = E->d_namlen; */
XX	    (void)strcpy(names[i - 1]->d_name, E->d_name);
XX	}
XX
XX    /* Close things off. */
XX    names[i] = NULL;
XX    *List = names;
XX    closedir(Dp);
XX
XX    /* Sort? */
XX    if (i && Sorter)
XX	qsort((char *)names, i, sizeof names[0], Sorter);
XX
XX    return(i);
XX}
X________This_Is_The_END________
Xif test `wc -c < scandir.c` -ne     1875; then
X	echo 'shar: scandir.c was damaged during transit (should have been     1875 bytes)'
Xfi
Xfi		; : end of overwriting check
Xecho 'x - utimes.c'
Xif test -f utimes.c; then echo 'shar: not overwriting utimes.c'; else
Xsed 's/^X//' << '________This_Is_The_END________' > utimes.c
XX
XX/* bsd utimes emulation for Sys V */
XX/* by Jon Zeeff */
XX
XX#include <sys/types.h>
XX
XXstruct utimbuf {
XX     time_t  actime;
XX     time_t  modtime;
XX};
XX
XXstruct timeval {
XX     long    tv_sec;
XX     long    tv_usec;
XX};
XX
XXutimes(path,tvp)
XXchar *path;
XXstruct timeval tvp[2];
XX{
XX
XXstruct utimbuf times;
XX
XXtimes.actime = (time_t) tvp[0].tv_sec;
XXtimes.modtime = (time_t) tvp[1].tv_sec;
XX
XXreturn utime(path,times);
XX
XX}
X________This_Is_The_END________
Xif test `wc -c < utimes.c` -ne      397; then
X	echo 'shar: utimes.c was damaged during transit (should have been      397 bytes)'
Xfi
Xfi		; : end of overwriting check
Xexit 0
________This_Is_The_END________
if test `wc -c < Sysvarcstuf` -ne     9367; then
	echo 'shar: Sysvarcstuf was damaged during transit (should have been     9367 bytes)'
fi
fi		; : end of overwriting check
echo 'x - patches'
if test -f patches; then echo 'shar: not overwriting patches'; else
sed 's/^X//' << '________This_Is_The_END________' > patches
Xdiff -c /usr2/polymnia/hyc/News/arc/Make.tws arc/Make.tws
X*** /usr2/polymnia/hyc/News/arc/Make.tws	Wed Jul  6 02:26:14 1988
X--- arc/Make.tws	Sun Jul 31 18:29:28 1988
X***************
X*** 22,33 ****
X  
X  libtws.a:	dtime.o dtimep.o lexstring.o
X  		ar r libtws.a dtime.o dtimep.o lexstring.o
X! # The following amusing bullshit makes sure that ranlib
X! # gets executed if it is present, no matter which shell
X! # make uses.  If there's a better way to do this, someone
X! # please tell me!
X! 		-if test -r /usr/bin/ranlib ; then ranlib libtws.a ; fi
X! 		-if ( -r /usr/bin/ranlib ) ranlib libtws.a
X  
X  dtime.o:	dtime.c tws.h
X  
X--- 22,29 ----
X  
X  libtws.a:	dtime.o dtimep.o lexstring.o
X  		ar r libtws.a dtime.o dtimep.o lexstring.o
X! #Hope it goes, but no big deal if not. -- hyc
X! 		-ranlib libtws.a
X  
X  dtime.o:	dtime.c tws.h
X  
Xdiff -c /usr2/polymnia/hyc/News/arc/arc.c arc/arc.c
X*** /usr2/polymnia/hyc/News/arc/arc.c	Wed Jul  6 02:26:55 1988
X--- arc/arc.c	Sun Jul 31 18:43:40 1988
X***************
X*** 1,5 ****
X  /*
X!  * $Header: arc.c,v 1.10 88/06/17 15:22:48 hyc Locked $
X   */
X  
X  /*  ARC - Archive utility
X--- 1,5 ----
X  /*
X!  * $Header: arc.c,v 1.12 88/07/31 18:39:50 hyc Exp $
X   */
X  
X  /*  ARC - Archive utility
X***************
X*** 73,88 ****
X  #include <stdio.h>
X  #include "arc.h"
X  
X  int		strlen();
X  void		addarc(), delarc(), extarc(), lstarc(), tstarc(), cvtarc(), runarc();
X  void		abort();
X  #if	MTS
X  void		etoa();
X  #endif
X  #if	GEMDOS
X! long		_stksize = 24576;
X  #endif
X  char		*strcpy(), *strcat();
X  
X  static char   **lst;		/* files list */
X  static int	lnum;		/* length of files list */
X--- 73,95 ----
X  #include <stdio.h>
X  #include "arc.h"
X  
X+ #if	UNIX
X+ #include <sys/types.h>
X+ #include <sys/stat.h>
X+ #endif
X+ 
X  int		strlen();
X  void		addarc(), delarc(), extarc(), lstarc(), tstarc(), cvtarc(), runarc();
X  void		abort();
X+ static	void	expandlst();
X  #if	MTS
X  void		etoa();
X  #endif
X  #if	GEMDOS
X! long		_stksize = 65536L;
X  #endif
X  char		*strcpy(), *strcat();
X+ char		*makefnam();	/* filename fixup routine */
X  
X  static char   **lst;		/* files list */
X  static int	lnum;		/* length of files list */
X***************
X*** 93,99 ****
X  {
X  	char		opt = 0;/* selected action */
X  	char	       *a;	/* option pointer */
X- 	char	       *makefnam();	/* filename fixup routine */
X  	void		upper();/* case conversion routine */
X  	char	       *index();/* string index utility */
X  	char	       *envfind();	/* environment searcher */
X--- 100,105 ----
X***************
X*** 101,111 ****
X--- 107,121 ----
X  	char	       *arctemp2, *calloc(), *mktemp();
X  #if	GEMDOS
X  	void		exitpause();
X+ 	int		append;
X  #endif
X  #if	MTS
X  	fortran void	guinfo();
X  	char		gotinf[4];
X  #endif
X+ #if	UNIX
X+ 	struct	stat	sbuf;
X+ #endif
X  
X  	if (num < 3) {
X  		printf("ARC - Archive utility, Version 5.21, created on 04/22/87 at 15:05:21\n");
X***************
X*** 198,207 ****
X  		if (arctemp[n - 1] != CUTOFF)
X  			arctemp[n] = CUTOFF;
X  	}
X  #if	!MSDOS
X! 	strcat(arctemp, mktemp("AXXXXXX"));
X  #else
X  	strcat(arctemp, "$ARCTEMP");
X  #endif
X  #else
X  	guinfo("SHFSEP	", gotinf);
X--- 208,224 ----
X  		if (arctemp[n - 1] != CUTOFF)
X  			arctemp[n] = CUTOFF;
X  	}
X+ #if	UNIX
X+ 	else	strcpy(arctemp, "/tmp/");
X+ #endif
X  #if	!MSDOS
X! 	{
X! 		static char tempname[] = "AXXXXXX";
X! 		strcat(arctemp, mktemp(tempname));
X! 	}
X  #else
X  	strcat(arctemp, "$ARCTEMP");
X+ 	arctemp2 = NULL;
X  #endif
X  #else
X  	guinfo("SHFSEP	", gotinf);
X***************
X*** 223,229 ****
X  #endif
X  
X  	/* create archive names, supplying defaults */
X! 	makefnam(arg[2], ".arc", arcname);
X  	/* makefnam(".$$$",arcname,newname); */
X  	sprintf(newname, "%s.arc", arctemp);
X  	makefnam(".BAK", arcname, bakname);
X--- 240,253 ----
X  #endif
X  
X  	/* create archive names, supplying defaults */
X! #if	UNIX
X! 	if (!stat(arg[2],&sbuf))
X! 		strcpy(arcname,arg[2]);
X! 	else
X! 		makefnam(arg[2],".arc",arcname);
X! #else
X! 	makefnam(arg[2], ".ARC", arcname);
X! #endif
X  	/* makefnam(".$$$",arcname,newname); */
X  	sprintf(newname, "%s.arc", arctemp);
X  	makefnam(".BAK", arcname, bakname);
X***************
X*** 298,306 ****
X--- 322,346 ----
X  	for (n = 0; n < lnum;) {/* expand indirect references */
X  		if (*lst[n] == '@')
X  			expandlst(n);
X+ #if	GEMDOS		/* redirect stdout from the desktop...*/
X+ 		else if (*lst[n] == '>') {
X+ 			arctemp2 = (++lst[n]);
X+ 			lst[n] = lst[lnum-1];	/* delete this entry */
X+ 			lnum--;
X+ 			if (arctemp2[0] == '>') {
X+ 				append = 1;
X+ 				arctemp2++;
X+ 			}
X+ 			else	append = 0;
X+ 		}
X+ #endif
X  		else
X  			n++;
X  	}
X+ #if	GEMDOS
X+ 	if (arctemp2)
X+ 		freopen(arctemp2,append ? "a" : "w",stdout);
X+ #endif
X  
X  	/* act on whatever action command was given */
X  
X***************
X*** 349,355 ****
X  #endif
X  	return nerrs;
X  }
X! static
X  expandlst(n)			/* expand an indirect reference */
X  	int		n;	/* number of entry to expand */
X  {
X--- 389,395 ----
X  #endif
X  	return nerrs;
X  }
X! static	void
X  expandlst(n)			/* expand an indirect reference */
X  	int		n;	/* number of entry to expand */
X  {
Xdiff -c /usr2/polymnia/hyc/News/arc/arc.h arc/arc.h
X*** /usr2/polymnia/hyc/News/arc/arc.h	Wed Jul  6 02:26:56 1988
X--- arc/arc.h	Sun Jul 31 18:45:33 1988
X***************
X*** 1,5 ****
X  /*
X!  * $Header: arc.h,v 1.7 88/06/01 17:51:06 hyc Locked $
X   */
X  
X  #undef	MSDOS
X--- 1,5 ----
X  /*
X!  * $Header: arc.h,v 1.9 88/07/31 18:43:18 hyc Exp $
X   */
X  
X  #undef	MSDOS
X***************
X*** 27,32 ****
X--- 27,34 ----
X  #if	MSDOS || GEMDOS
X  #define	DOS	1
X  #define	CUTOFF	'\\'
X+ #define	OPEN_R	"rb"
X+ #define	OPEN_W	"wb"
X  #endif
X  
X  #if	!MSDOS
X***************
X*** 37,53 ****
X  #if	BSD || SYSV
X  #define	UNIX	1
X  #define	CUTOFF	'/'
X  #include <ctype.h>
X  #endif
X  
X  #if	MTS
X! #define rindex strrchr
X! #define index strchr
X! #undef  USEGFINFO		/* define this to use GFINFO for directory */
X! #define USECATSCAN		/* scanning, else use CATSCAN/FILEINFO... */
X  #define	CUTOFF	sepchr[0]
X  #endif
X  
X  /*  ARC - Archive utility - ARC Header
X    
X      Version 2.17, created on 04/22/87 at 13:09:43
X--- 39,60 ----
X  #if	BSD || SYSV
X  #define	UNIX	1
X  #define	CUTOFF	'/'
X+ #define	OPEN_R	"r"
X+ #define	OPEN_W	"w"
X  #include <ctype.h>
X  #endif
X  
X  #if	MTS
X! #define	USEGFINFO	0	/* define this to use GFINFO for directory */
X! #define	USECATSCAN	1	/* scanning, else use CATSCAN/FILEINFO... */
X  #define	CUTOFF	sepchr[0]
X  #endif
X  
X+ #if	MTS || SYSV
X+ #define	rindex	strrchr
X+ #define	index	strchr
X+ #endif
X+ 
X  /*  ARC - Archive utility - ARC Header
X    
X      Version 2.17, created on 04/22/87 at 13:09:43
X***************
X*** 69,75 ****
X  #define ARCVER 9		/* archive header version code   */
X  #define STRLEN 100		/* system standard string length */
X  #define FNLEN 13		/* file name length              */
X! #define MAXARG 25		/* maximum number of arguments   */
X  
X  #ifndef DONT_DEFINE		/* Defined by arcdata.c */
X  #include "arcs.h"
X--- 76,82 ----
X  #define ARCVER 9		/* archive header version code   */
X  #define STRLEN 100		/* system standard string length */
X  #define FNLEN 13		/* file name length              */
X! #define MAXARG 400		/* maximum number of arguments   */
X  
X  #ifndef DONT_DEFINE		/* Defined by arcdata.c */
X  #include "arcs.h"
Xdiff -c /usr2/polymnia/hyc/News/arc/arcadd.c arc/arcadd.c
X*** /usr2/polymnia/hyc/News/arc/arcadd.c	Wed Jul  6 02:26:57 1988
X--- arc/arcadd.c	Sun Jul 31 18:47:27 1988
X***************
X*** 1,5 ****
X  /*
X!  * $Header: arcadd.c,v 1.8 88/06/13 00:31:15 hyc Locked $
X   */
X  
X  /*
X--- 1,5 ----
X  /*
X!  * $Header: arcadd.c,v 1.9 88/07/31 18:45:14 hyc Exp $
X   */
X  
X  /*
X***************
X*** 231,237 ****
X  	int             upd = 0;/* true if replacing an entry */
X  
X  #if	!MTS
X! 	if (!(f = fopen(path, "rb")))
X  #else
X  	if (image)
X  		f = fopen(path, "rb");
X--- 231,237 ----
X  	int             upd = 0;/* true if replacing an entry */
X  
X  #if	!MTS
X! 	if (!(f = fopen(path, OPEN_R)))
X  #else
X  	if (image)
X  		f = fopen(path, "rb");
X***************
X*** 246,251 ****
X--- 246,280 ----
X  		}
X  		return;
X  	}
X+ #if	!DOS
X+ 	if (strlen(name) >= FNLEN) {
X+ 		if (warn) {
X+ 			char	buf[STRLEN];
X+ 			printf("WARNING: File %s name too long!\n", name);
X+ 			name[FNLEN-1]='\0';
X+ 			while(1) {
X+ 				printf("  Truncate to %s (y/n)? ", name);
X+ 				fflush(stdout);
X+ 				fgets(buf, STRLEN, stdin);
X+ 				*buf = toupper(*buf);
X+ 				if (*buf == 'Y' || *buf == 'N')
X+ 					break;
X+ 			}
X+ 			if (*buf == 'N') {
X+ 				printf("Skipping...\n");
X+ 				fclose(f);
X+ 				return;
X+ 			}
X+ 		}
X+ 		else {
X+ 			if (note)
X+ 				printf("Skipping file: %s - name too long.\n",
X+ 					name);
X+ 			fclose(f);
X+ 			return;
X+ 		}
X+ 	}
X+ #endif
X  	strcpy(nhdr.name, name);/* save name */
X  	nhdr.size = 0;		/* clear out size storage */
X  	nhdr.crc = 0;		/* clear out CRC check storage */
X***************
X*** 257,269 ****
X  	int	inlen;
X  	struct	GDDSECT	*region;
X  
X! 	region=gdinfo(f->_fd);
X  	inlen=region->GDINLEN;
X! 	buffer=malloc(inlen);   /* maximum line length */
X  	setbuf(f,buffer);        
X  	f->_bufsiz=inlen;        
X! 	f->_mods|=0x00040000;   /* Don't do "$continue with" */
X! 	f->_mods&=0xfff7ffff;   /* turn it off, if set... */
X  	}
X  	getstamp(path, &nhdr.date, &nhdr.time);
X  #endif
X--- 286,298 ----
X  	int	inlen;
X  	struct	GDDSECT	*region;
X  
X! 	region=gdinfo(f->_fd._fdub);
X  	inlen=region->GDINLEN;
X! 	buffer=malloc(inlen);	/* maximum line length */
X  	setbuf(f,buffer);        
X  	f->_bufsiz=inlen;        
X! 	f->_mods|=_NOIC;	/* Don't do "$continue with" */
X! 	f->_mods&=~_IC;		/* turn it off, if set... */
X  	}
X  	getstamp(path, &nhdr.date, &nhdr.time);
X  #endif
X***************
X*** 325,331 ****
X  	hdrver = ARCVER;		/* anything but end marker */
X  	writehdr(&nhdr, new);	/* write out header skeleton */
X  	pack(f, new, &nhdr);	/* pack file into archive */
X- 	strcpy(nhdr.name, name);
X  	fseek(new, starts, 0);	/* move back to header skeleton */
X  	writehdr(&nhdr, new);	/* write out real header */
X  	fseek(new, nhdr.size, 1);	/* skip over data to next header */
X--- 354,359 ----
Xdiff -c /usr2/polymnia/hyc/News/arc/arcdata.c arc/arcdata.c
X*** /usr2/polymnia/hyc/News/arc/arcdata.c	Wed Jul  6 02:26:59 1988
X--- arc/arcdata.c	Sun Jul 31 18:48:38 1988
X***************
X*** 1,5 ****
X  /*
X!  * $Header: arcdata.c,v 1.6 88/06/01 19:17:58 hyc Locked $
X   */
X  
X  /*  ARC - Archive utility - ARCDATA
X--- 1,5 ----
X  /*
X!  * $Header: arcdata.c,v 1.7 88/07/31 18:47:22 hyc Exp $
X   */
X  
X  /*  ARC - Archive utility - ARCDATA
Xdiff -c /usr2/polymnia/hyc/News/arc/arcdos.c arc/arcdos.c
X*** /usr2/polymnia/hyc/News/arc/arcdos.c	Wed Jul  6 02:27:00 1988
X--- arc/arcdos.c	Sun Jul 31 18:49:42 1988
X***************
X*** 1,5 ****
X  /*
X!  * $Header: arcdos.c,v 1.5 88/06/13 00:40:49 hyc Locked $
X   */
X  
X  /*
X--- 1,5 ----
X  /*
X!  * $Header: arcdos.c,v 1.6 88/07/31 18:48:09 hyc Exp $
X   */
X  
X  /*
X***************
X*** 35,40 ****
X--- 35,41 ----
X  #endif
X  
X  #if	SYSV
X+ #include <sys/times.h>
X  struct timeval {
X  	long tv_sec;
X  	long tv_usec;
X***************
X*** 78,100 ****
X  	*time = ret[0];
X  #endif
X  #if	UNIX
X! 	char	       *ctime();
X! 	struct stat    *buf;
X! 	int             day, hr, min, sec, yr, imon;
X! 	static char     mon[4], *mons[12] = {
X! 				   "Jan", "Feb", "Mar", "Apr", "May", "Jun",
X! 				    "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
X! 	};
X  
X! 	buf = (struct stat *) malloc(sizeof(struct stat));
X! 	fstat(fileno(f), buf);
X! 
X! 	sscanf(ctime(&(buf->st_mtime)), "%*4s%3s%d%d:%d:%d%d", mon, &day, &hr, &min,
X! 	       &sec, &yr);
X! 	for (imon = 0; imon < 12 && strcmp(mon, mons[imon]); imon++);
X! 
X! 	*date = (unsigned short) (((yr - 1980) << 9) + ((imon + 1) << 5) + day);
X! 	*time = (unsigned short) ((hr << 11) + (min << 5) + sec / 2);
X  #endif
X  #if	MTS
X  	fortran         timein(),
X--- 79,93 ----
X  	*time = ret[0];
X  #endif
X  #if	UNIX
X! 	struct stat	buf;
X! 	struct tm	*localtime(), *t;
X  
X! 	fstat(fileno(f), &buf);
X! 	t=localtime(&(buf.st_mtime));
X! 	*date = (unsigned short) (((t->tm_year - 80) << 9) +
X! 				((t->tm_mon + 1) << 5) + t->tm_mday);
X! 	*time = (unsigned short) ((t->tm_hour << 11) +
X! 				(t->tm_min << 5) + t->tm_sec / 2);
X  #endif
X  #if	MTS
X  	fortran         timein(),
Xdiff -c /usr2/polymnia/hyc/News/arc/arcext.c arc/arcext.c
X*** /usr2/polymnia/hyc/News/arc/arcext.c	Wed Jul  6 02:27:01 1988
X--- arc/arcext.c	Fri Jul 22 14:53:29 1988
X***************
X*** 155,161 ****
X  		}
X  	}
X  #if	!MTS
X! 	if (!(f = fopen(fix, "wb")))
X  #else
X  	{
X  		fortran         create();
X--- 155,161 ----
X  		}
X  	}
X  #if	!MTS
X! 	if (!(f = fopen(fix, OPEN_W)))
X  #else
X  	{
X  		fortran         create();
Xdiff -c /usr2/polymnia/hyc/News/arc/arcio.c arc/arcio.c
X*** /usr2/polymnia/hyc/News/arc/arcio.c	Wed Jul  6 02:27:02 1988
X--- arc/arcio.c	Sun Jul 31 18:50:20 1988
X***************
X*** 1,5 ****
X  /*
X!  * $Header: arcio.c,v 1.7 88/06/02 16:27:32 hyc Locked $
X   */
X  
X  /*  ARC - Archive utility - ARCIO
X--- 1,5 ----
X  /*
X!  * $Header: arcio.c,v 1.9 88/07/31 18:49:19 hyc Exp $
X   */
X  
X  /*  ARC - Archive utility - ARCIO
X***************
X*** 102,112 ****
X  #if	MTS
X  	(void) atoe(hdr->name, strlen(hdr->name));
X  #endif
X! 	for (i = 0; i<4; hdr->size<<=8, hdr->size += dummy[16-i], i++);
X  	hdr->date = (short) ((dummy[18] << 8) + dummy[17]);
X  	hdr->time = (short) ((dummy[20] << 8) + dummy[19]);
X  	hdr->crc = (short) ((dummy[22] << 8) + dummy[21]);
X! 	for (i = 0; i<4; hdr->length<<=8, hdr->length += dummy[26-i], i++);
X  #endif
X  
X  	if (hdr->date > olddate
X--- 102,112 ----
X  #if	MTS
X  	(void) atoe(hdr->name, strlen(hdr->name));
X  #endif
X! 	for (i = 0, hdr->size=0; i<4; hdr->size<<=8, hdr->size += dummy[16-i], i++);
X  	hdr->date = (short) ((dummy[18] << 8) + dummy[17]);
X  	hdr->time = (short) ((dummy[20] << 8) + dummy[19]);
X  	hdr->crc = (short) ((dummy[22] << 8) + dummy[21]);
X! 	for (i = 0, hdr->length=0; i<4; hdr->length<<=8, hdr->length += dummy[26-i], i++);
X  #endif
X  
X  	if (hdr->date > olddate
X***************
X*** 175,187 ****
X  	FILE           *t;	/* file to write to */
X  {
X  	c &= 0xff;
X! 	if (t)
X  #if	UNIX
X  		fputc(c, t);
X  #else
X  		if (fputc(c, t) == EOF)
X  			abort("Write fail (disk full?)");
X  #endif
X  }
X  
X  /*
X--- 175,190 ----
X  	FILE           *t;	/* file to write to */
X  {
X  	c &= 0xff;
X! 	if (t) {
X  #if	UNIX
X  		fputc(c, t);
X+ 		if (ferror(t))
X+ 			abort("Write failed");
X  #else
X  		if (fputc(c, t) == EOF)
X  			abort("Write fail (disk full?)");
X  #endif
X+ 	}
X  }
X  
X  /*
Xdiff -c /usr2/polymnia/hyc/News/arc/arclzw.c arc/arclzw.c
X*** /usr2/polymnia/hyc/News/arc/arclzw.c	Wed Jul  6 02:27:19 1988
X--- arc/arclzw.c	Sun Jul 31 18:50:49 1988
X***************
X*** 1,5 ****
X  /*
X!  * $Header: arclzw.c,v 1.4 88/06/01 16:27:59 hyc Locked $
X   */
X  
X  /*
X--- 1,5 ----
X  /*
X!  * $Header: arclzw.c,v 1.6 88/07/31 18:49:49 hyc Exp $
X   */
X  
X  /*
X***************
X*** 59,65 ****
X  	unsigned char   follower;	/* char following string */
X  	unsigned short  next;	/* ptr to next in collision list */
X  	unsigned short  predecessor;	/* code for preceeding string */
X! };            /* string_tab[TABSIZE];	/* the code string table */
X  
X  
X  /* definitions for the new dynamic Lempel-Zev crunching */
X--- 59,65 ----
X  	unsigned char   follower;	/* char following string */
X  	unsigned short  next;	/* ptr to next in collision list */
X  	unsigned short  predecessor;	/* code for preceeding string */
X! };            /* string_tab[TABSIZE];	   the code string table */
X  
X  
X  /* definitions for the new dynamic Lempel-Zev crunching */
Xdiff -c /usr2/polymnia/hyc/News/arc/arcmatch.c arc/arcmatch.c
X*** /usr2/polymnia/hyc/News/arc/arcmatch.c	Wed Jul  6 02:27:20 1988
X--- arc/arcmatch.c	Sun Jul 31 18:51:22 1988
X***************
X*** 1,5 ****
X  /*
X!  * $Header: arcmatch.c,v 1.5 88/06/01 19:41:08 hyc Locked $
X   */
X  
X  /*
X--- 1,5 ----
X  /*
X!  * $Header: arcmatch.c,v 1.6 88/07/31 18:50:18 hyc Exp $
X   */
X  
X  /*
X***************
X*** 67,72 ****
X--- 67,77 ----
X  	upper(t);		/* avoid case problems */
X  #endif	/* UNIX */
X  #if	GEMDOS
X+ 	char *strstr(), *i;	/* allow "*.*" to mean '*' */
X+ 	if (i=strstr(t,"*.*")) {
X+ 		i++;
X+ 		*i='\0';
X+ 	}
X  	return(pnmatch(n, t, 0));
X  #else
X  	/* first match name part */
Xdiff -c /usr2/polymnia/hyc/News/arc/arcmisc.c arc/arcmisc.c
X*** /usr2/polymnia/hyc/News/arc/arcmisc.c	Wed Jul  6 02:27:21 1988
X--- arc/arcmisc.c	Sun Jul 31 18:52:44 1988
X***************
X*** 1,6 ****
X  /*
X   * Miscellaneous routines to get ARC running on non-MSDOS systems...
X!  * $Header: arcmisc.c,v 1.7 88/06/12 19:23:13 hyc Locked $ 
X   */
X  
X  #include <stdio.h>
X--- 1,6 ----
X  /*
X   * Miscellaneous routines to get ARC running on non-MSDOS systems...
X!  * $Header: arcmisc.c,v 1.8 88/07/31 18:50:56 hyc Exp $ 
X   */
X  
X  #include <stdio.h>
X***************
X*** 55,61 ****
X  #include <sys/types.h>
X  #include <sys/dir.h>
X  #include <sys/stat.h>
X! 	int	rename();
X  #endif
X  
X  #if	SYSV
X--- 55,61 ----
X  #include <sys/types.h>
X  #include <sys/dir.h>
X  #include <sys/stat.h>
X! 	int	rename(), unlink();
X  #endif
X  
X  #if	SYSV
X***************
X*** 65,72 ****
X  #define DIRECT direct
X  #endif
X  
X  char           *strcpy(), *strcat(), *malloc();
X! int             strlen();
X  
X  int
X  move(oldnam, newnam)
X--- 65,85 ----
X  #define DIRECT direct
X  #endif
X  
X+ #if	BSD
X+ char	*
X+ memset(s, c, n)		/* oops. Thought it was standard BSD, but my Sun */
X+ 	char	*s;	/* fooled me again. -- hyc */
X+ 	int	c, n;
X+ {
X+ 	register int i;
X+ 	for(i=0;i<n;i++)
X+ 		s[i]=c;
X+ 	return(s);
X+ }
X+ #endif
X+ 
X  char           *strcpy(), *strcat(), *malloc();
X! int             strlen(), strcmp(), match();
X  
X  int
X  move(oldnam, newnam)
X***************
X*** 73,79 ****
X--- 86,94 ----
X  	char           *oldnam, *newnam;
X  {
X  	FILE           *fopen(), *old, *new;
X+ #if	!MTS
X  	struct stat     oldstat;
X+ #endif
X  	char           *strcpy();
X  	void		filecopy();
X  #if	GEMDOS
X***************
X*** 81,99 ****
X  #else
X  	if (rename(oldnam, newnam))
X  #endif
X  	{
X  		if (stat(oldnam, &oldstat))	/* different partition? */
X  			return (-1);
X! 		old = fopen(oldnam, "rb");
X  		if (old == NULL)
X  			return (-1);
X! 		new = fopen(newnam, "wb");
X  		if (new == NULL)
X  			return (-1);
X  		filecopy(old, new, oldstat.st_size);
X! 		unlink(oldnam);
X  	}
X  	return 0;
X  }
X  
X  static void
X--- 96,118 ----
X  #else
X  	if (rename(oldnam, newnam))
X  #endif
X+ #if	!MTS
X  	{
X  		if (stat(oldnam, &oldstat))	/* different partition? */
X  			return (-1);
X! 		old = fopen(oldnam, OPEN_R);
X  		if (old == NULL)
X  			return (-1);
X! 		new = fopen(newnam, OPEN_W);
X  		if (new == NULL)
X  			return (-1);
X  		filecopy(old, new, oldstat.st_size);
X! 		return(unlink(oldnam));
X  	}
X  	return 0;
X+ #else
X+ 	return(-1);
X+ #endif
X  }
X  
X  static void
X***************
X*** 270,276 ****
X  	int             alphasort();
X  	int             scandir();
X  #endif				/* UNIX */
X! 	int             fmatch();
X  	static int      Nnum = 0, ii;
X  	char		*rindex();
X  
X--- 289,295 ----
X  	int             alphasort();
X  	int             scandir();
X  #endif				/* UNIX */
X! 	int             fmatch(), free();
X  	static int      Nnum = 0, ii;
X  	char		*rindex();
X  
Xdiff -c /usr2/polymnia/hyc/News/arc/arcpack.c arc/arcpack.c
X*** /usr2/polymnia/hyc/News/arc/arcpack.c	Wed Jul  6 02:27:22 1988
X--- arc/arcpack.c	Sun Jul 31 18:53:25 1988
X***************
X*** 1,5 ****
X  /*
X!  * $Header: arcpack.c,v 1.9 88/06/02 16:27:36 hyc Locked $
X   */
X  
X  /*  ARC - Archive utility - ARCPACK
X--- 1,5 ----
X  /*
X!  * $Header: arcpack.c,v 1.11 88/07/31 18:52:08 hyc Exp $
X   */
X  
X  /*  ARC - Archive utility - ARCPACK
X***************
X*** 24,30 ****
X  #endif
X  
X  void	setcode(), sqinit_cm(), sqputc_cm(), init_cm(), putc_cm();
X! void	filecopy(), abort(), putc_tst();
X  int	getch(), addcrc();
X  
X  /* stuff for non-repeat packing */
X--- 24,30 ----
X  #endif
X  
X  void	setcode(), sqinit_cm(), sqputc_cm(), init_cm(), putc_cm();
X! void	filecopy(), abort(), putc_tst(), init_sq(), scan_sq();
X  int	getch(), addcrc();
X  
X  /* stuff for non-repeat packing */
X***************
X*** 155,161 ****
X  	/* standard cleanups common to all methods */
X  
X  	if (note)
X! 		printf("done. (%ld%%)\n",100L - (100L*hdr->size)/hdr->length);
X  }
X  
X  /*
X--- 155,162 ----
X  	/* standard cleanups common to all methods */
X  
X  	if (note)
X! 		printf("done. (%ld%%)\n",hdr->length == 0 ?
X! 				0L : 100L - (100L*hdr->size)/hdr->length);
X  }
X  
X  /*
Xdiff -c /usr2/polymnia/hyc/News/arc/arcrun.c arc/arcrun.c
X*** /usr2/polymnia/hyc/News/arc/arcrun.c	Wed Jul  6 02:27:22 1988
X--- arc/arcrun.c	Sun Jul 31 18:53:59 1988
X***************
X*** 1,5 ****
X  /*
X!  * $Header: arcrun.c,v 1.3 88/06/01 19:57:16 hyc Locked $
X   */
X  
X  /*
X--- 1,5 ----
X  /*
X!  * $Header: arcrun.c,v 1.4 88/07/31 18:52:50 hyc Exp $
X   */
X  
X  /*
X***************
X*** 22,27 ****
X--- 22,29 ----
X  #include "arc.h"
X  
X  void	rempath(), openarc(), closearc(), abort();
X+ int	readhdr(), match(), unpack();
X+ static	void	runfile();
X  char	*strcat();
X  
X  void
X***************
X*** 33,39 ****
X  	char           *makefnam();	/* filename fixer */
X  	char            buf[STRLEN];	/* filename buffer */
X  	FILE           *fopen();/* file opener */
X- 	int             runfile();
X  	char	       *dummy[2];
X  
X  	dummy[0]="dummy";
X--- 35,40 ----
X***************
X*** 56,62 ****
X  	closearc(0);		/* close archive after changes */
X  }
X  
X! static          int
X  runfile(hdr, num, arg)		/* run a file */
X  	struct heads   *hdr;	/* pointer to header data */
X  	int             num;	/* number of arguments */
X--- 57,63 ----
X  	closearc(0);		/* close archive after changes */
X  }
X  
X! static  void
X  runfile(hdr, num, arg)		/* run a file */
X  	struct heads   *hdr;	/* pointer to header data */
X  	int             num;	/* number of arguments */
X***************
X*** 120,126 ****
X  	if (warn)
X  		if (tmp = fopen(buf, "r"))
X  			abort("Temporary file %s already exists", buf);
X! 	if (!(tmp = fopen(buf, "wb")))
X  		abort("Unable to create temporary file %s", buf);
X  
X  	if (note)
X--- 121,127 ----
X  	if (warn)
X  		if (tmp = fopen(buf, "r"))
X  			abort("Temporary file %s already exists", buf);
X! 	if (!(tmp = fopen(buf, OPEN_W)))
X  		abort("Unable to create temporary file %s", buf);
X  
X  	if (note)
Xdiff -c /usr2/polymnia/hyc/News/arc/arcsq.c arc/arcsq.c
X*** /usr2/polymnia/hyc/News/arc/arcsq.c	Wed Jul  6 02:27:24 1988
X--- arc/arcsq.c	Sun Jul 31 18:54:48 1988
X***************
X*** 1,5 ****
X  /*
X!  * $Header: arcsq.c,v 1.2 88/06/02 16:27:38 hyc Locked $
X   */
X  
X  /*
X--- 1,5 ----
X  /*
X!  * $Header: arcsq.c,v 1.3 88/07/31 18:53:32 hyc Exp $
X   */
X  
X  /*
X***************
X*** 65,71 ****
X  static int      cbitsrem;	/* # of code string bits left */
X  static unsigned short ccode;	/* current code right justified */
X  
X! int 
X  init_sq()
X  {				/* prepare for scanning pass */
X  	int             i;	/* node index */
X--- 65,73 ----
X  static int      cbitsrem;	/* # of code string bits left */
X  static unsigned short ccode;	/* current code right justified */
X  
X! static	void	scale(), heap(), adjust(), bld_tree(), init_enc(), put_int();
X! static	int	cmptrees(), buildenc(), maxchar();
X! void 
X  init_sq()
X  {				/* prepare for scanning pass */
X  	int             i;	/* node index */
X***************
X*** 86,92 ****
X  		valcount[i] = 0;
X  }
X  
X! int 
X  scan_sq(c)			/* add a byte to the tables */
X  	int             c;	/* byte to add */
X  {
X--- 88,94 ----
X  		valcount[i] = 0;
X  }
X  
X! void 
X  scan_sq(c)			/* add a byte to the tables */
X  	int             c;	/* byte to add */
X  {
X***************
X*** 113,123 ****
X  	unsigned short	ceiling;/* limit for scaling */
X  	long            size = 0;	/* predicted size */
X  	int             numnodes;	/* # of nodes in simplified tree */
X- 	int             scale();
X- 	int             heap();
X- 	int             bld_tree();
X- 	int             buildenc();
X- 	int             init_enc();
X  
X  	scan_sq(EOF);		/* signal end of input */
X  
X--- 115,120 ----
X***************
X*** 188,194 ****
X   * integer. Rescaling is used if necessary to limit the code length. 
X   */
X  
X! static int 
X  scale(ceil)
X  	unsigned short	ceil;	/* upper limit on total weight */
X  {
X--- 185,191 ----
X   * integer. Rescaling is used if necessary to limit the code length. 
X   */
X  
X! static	void
X  scale(ceil)
X  	unsigned short	ceil;	/* upper limit on total weight */
X  {
X***************
X*** 236,247 ****
X   * rescaling. 
X   */
X  
X! static int 
X  heap(list, length)
X  	int             list[], length;
X  {
X  	register int    i;
X- 	int             adjust();
X  
X  	for (i = (length - 2) / 2; i >= 0; --i)
X  		adjust(list, i, length - 1);
X--- 233,243 ----
X   * rescaling. 
X   */
X  
X! static	void
X  heap(list, length)
X  	int             list[], length;
X  {
X  	register int    i;
X  
X  	for (i = (length - 2) / 2; i >= 0; --i)
X  		adjust(list, i, length - 1);
X***************
X*** 249,260 ****
X  
X  /* Make a heap from a heap with a new top */
X  
X! static int 
X  adjust(list, top, bottom)
X  	int             list[], top, bottom;
X  {
X  	register int    k, temp;
X- 	int             cmptrees();
X  
X  	k = 2 * top + 1;	/* left child of top */
X  	temp = list[top];	/* remember root node of top tree */
X--- 245,255 ----
X  
X  /* Make a heap from a heap with a new top */
X  
X! static	void
X  adjust(list, top, bottom)
X  	int             list[], top, bottom;
X  {
X  	register int    k, temp;
X  
X  	k = 2 * top + 1;	/* left child of top */
X  	temp = list[top];	/* remember root node of top tree */
X***************
X*** 282,288 ****
X   * comparison rules in previous comments. 
X   */
X  
X! static int 
X  cmptrees(a, b)
X  	int             a, b;	/* root nodes of trees */
X  {
X--- 277,283 ----
X   * comparison rules in previous comments. 
X   */
X  
X! static	int 
X  cmptrees(a, b)
X  	int             a, b;	/* root nodes of trees */
X  {
X***************
X*** 308,314 ****
X   * element and reheaping the shorter list. 
X   */
X  
X! static int 
X  bld_tree(list, len)
X  	int             list[];
X  int             len;
X--- 303,309 ----
X   * element and reheaping the shorter list. 
X   */
X  
X! static	void
X  bld_tree(list, len)
X  	int             list[];
X  int             len;
X***************
X*** 316,322 ****
X  	register int    freenode;	/* next free node in tree */
X  	register struct nd *frnp;	/* free node pointer */
X  	int             lch, rch;	/* temps for left, right children */
X- 	int             maxchar();
X  
X  	/*
X  	 * Initialize index to next available (non-leaf) node. Lower numbered
X--- 311,316 ----
X***************
X*** 365,371 ****
X  	return a > b ? a : b;
X  }
X  
X! static int 
X  init_enc()
X  {
X  	register int    i;
X--- 359,365 ----
X  	return a > b ? a : b;
X  }
X  
X! static	void
X  init_enc()
X  {
X  	register int    i;
X***************
X*** 421,431 ****
X  	return NULL;		/* it worked if we reach here */
X  }
X  
X! static int 
X  put_int(n, f)			/* output an integer */
X  	short		n;	/* integer to output */
X  	FILE           *f;	/* file to put it to */
X  {
X  	putc_pak(n & 0xff, f);	/* first the low byte */
X  	putc_pak(n >> 8, f);	/* then the high byte */
X  }
X--- 415,427 ----
X  	return NULL;		/* it worked if we reach here */
X  }
X  
X! static	void
X  put_int(n, f)			/* output an integer */
X  	short		n;	/* integer to output */
X  	FILE           *f;	/* file to put it to */
X  {
X+ 	void		putc_pak();
X+ 
X  	putc_pak(n & 0xff, f);	/* first the low byte */
X  	putc_pak(n >> 8, f);	/* then the high byte */
X  }
X***************
X*** 481,486 ****
X--- 477,483 ----
X  {
X  	int             rbyte;	/* Result byte value */
X  	int             need;	/* number of bits */
X+ 	int		getc_ncr();
X  
X  	rbyte = 0;
X  	need = 8;		/* build one byte per call */
Xdiff -c /usr2/polymnia/hyc/News/arc/arcsqs.c arc/arcsqs.c
X*** /usr2/polymnia/hyc/News/arc/arcsqs.c	Wed Jul  6 02:27:43 1988
X--- arc/arcsqs.c	Sun Jul 31 18:55:21 1988
X***************
X*** 1,5 ****
X  /*
X!  * $Header: arcsqs.c,v 1.2 88/06/01 16:31:39 hyc Locked $
X   */
X  
X  /*  ARC - Archive utility - SQUASH
X--- 1,5 ----
X  /*
X!  * $Header: arcsqs.c,v 1.3 88/07/31 18:54:14 hyc Exp $
X   */
X  
X  /*  ARC - Archive utility - SQUASH
X***************
X*** 12,18 ****
X  */
X  
X  /*
X!  * $Header: arcsqs.c,v 1.2 88/06/01 16:31:39 hyc Locked $
X   */
X  
X  #include <stdio.h>
X--- 12,18 ----
X  */
X  
X  /*
X!  * $Header: arcsqs.c,v 1.3 88/07/31 18:54:14 hyc Exp $
X   */
X  
X  #include <stdio.h>
Xdiff -c /usr2/polymnia/hyc/News/arc/arcsvc.c arc/arcsvc.c
X*** /usr2/polymnia/hyc/News/arc/arcsvc.c	Wed Jul  6 02:27:44 1988
X--- arc/arcsvc.c	Sun Jul 31 18:55:55 1988
X***************
X*** 1,5 ****
X  /*
X!  * $Header: arcsvc.c,v 1.8 88/06/13 00:42:59 hyc Locked $
X   */
X  
X  /*  ARC - Archive utility - ARCSVC
X--- 1,5 ----
X  /*
X!  * $Header: arcsvc.c,v 1.9 88/07/31 18:54:55 hyc Exp $
X   */
X  
X  /*  ARC - Archive utility - ARCSVC
X***************
X*** 31,37 ****
X  {
X  	FILE           *fopen();/* file opener */
X  
X! 	if (!(arc = fopen(arcname, "rb"))) {
X  		if (chg) {
X  			if (note)
X  				printf("Creating new archive: %s\n", arcname);
X--- 31,37 ----
X  {
X  	FILE           *fopen();/* file opener */
X  
X! 	if (!(arc = fopen(arcname, OPEN_R))) {
X  		if (chg) {
X  			if (note)
X  				printf("Creating new archive: %s\n", arcname);
X***************
X*** 45,51 ****
X  		int inlen;
X  		struct GDDSECT *region;
X  
X! 		region=gdinfo(arc->_fd);
X  		inlen=region->GDINLEN;
X  		buffer=malloc(inlen);
X  		setbuf(arc, buffer);
X--- 45,51 ----
X  		int inlen;
X  		struct GDDSECT *region;
X  
X! 		region=gdinfo(arc->_fd._fdub);
X  		inlen=region->GDINLEN;
X  		buffer=malloc(inlen);
X  		setbuf(arc, buffer);
X***************
X*** 53,59 ****
X  	}
X  #endif
X  	if (chg) {		/* if opening for changes */
X! 		if (!(new = fopen(newname, "wb")))
X  			abort("Cannot create archive copy: %s", newname);
X  
X  	changing = chg;		/* note if open for changes */
X--- 53,59 ----
X  	}
X  #endif
X  	if (chg) {		/* if opening for changes */
X! 		if (!(new = fopen(newname, OPEN_W)))
X  			abort("Cannot create archive copy: %s", newname);
X  
X  	changing = chg;		/* note if open for changes */
X***************
X*** 66,73 ****
X  {
X  	if (arc) {		/* if we had an initial archive */
X  		fclose(arc);
X- 		if (kludge)	/* kludge to update timestamp */
X  #if	!MTS
X  			setstamp(arcname, olddate, oldtime);
X  #endif
X  	}
X--- 66,73 ----
X  {
X  	if (arc) {		/* if we had an initial archive */
X  		fclose(arc);
X  #if	!MTS
X+ 		if (kludge)	/* kludge to update timestamp */
X  			setstamp(arcname, olddate, oldtime);
X  #endif
X  	}
Xdiff -c /usr2/polymnia/hyc/News/arc/marc.c arc/marc.c
X*** /usr2/polymnia/hyc/News/arc/marc.c	Wed Jul  6 02:27:53 1988
X--- arc/marc.c	Fri Jul 22 14:59:11 1988
X***************
X*** 25,30 ****
X--- 25,35 ----
X  #include <stdio.h>
X  #include "arc.h"
X  
X+ #if	UNIX
X+ #include <sys/types.h>
X+ #include <sys/stat.h>
X+ #endif
X+ 
X  FILE *src;			       /* source archive */
X  char srcname[STRLEN];		       /* source archive name */
X  
X***************
X*** 46,52 ****
X--- 51,61 ----
X      void exitpause();
X  #endif
X      int n;			       /* index */
X+ #if	UNIX
X+     struct	stat	sbuf;
X+ #endif
X  
X+ 
X      if(nargs<3)
X      {	 printf("MARC - Archive merger, Version 5.21, created on 04/22/87 at 15:05:10\n");
X  /*	 printf("(C) COPYRIGHT 1985,86,87 by System Enhancement Associates;");
X***************
X*** 96,102 ****
X  			arctemp[n] = CUTOFF;
X  	}
X  #if	!MSDOS
X! 	strcat(arctemp, mktemp("AXXXXXX"));
X  #else
X  	strcat(arctemp, "$ARCTEMP");
X  #endif
X--- 105,117 ----
X  			arctemp[n] = CUTOFF;
X  	}
X  #if	!MSDOS
X! 	{
X! 		static char tempname[] = "AXXXXXX";
X! #if     UNIX
X! 		strcpy(arctemp, "/tmp/");
X! #endif  /*UNIX*/
X! 		strcat(arctemp, mktemp(tempname));
X! 	}
X  #else
X  	strcat(arctemp, "$ARCTEMP");
X  #endif
X***************
X*** 109,127 ****
X  	arctemp[0] = tmpchr[0];
X  #endif
X  
X!     makefnam(arg[1],".arc",arcname);   /* fix up archive names */
X!     makefnam(arg[2],".arc",srcname);
X  /*	makefnam(".$$$",arcname,newname);*/
X  	sprintf(newname,"%s.arc",arctemp);
X- 
X- #if	!UNIX
X-     upper(arcname); upper(srcname); upper(newname);
X  #endif
X  
X!     arc = fopen(arcname,"rb");	       /* open the archives */
X!     if(!(src=fopen(srcname,"rb")))
X  	 abort("Cannot read source archive %s",srcname);
X!     if(!(new=fopen(newname,"wb")))
X  	 abort("Cannot create new archive %s",newname);
X  
X      if(!arc)
X--- 124,149 ----
X  	arctemp[0] = tmpchr[0];
X  #endif
X  
X! #if	UNIX
X! 	if (!stat(arg[1],&sbuf))
X! 		strcpy(arcname,arg[1]);
X! 	else
X! 		makefnam(arg[1],".arc",arcname);
X! 	if (!stat(arg[2],&sbuf))
X! 		strcpy(srcname,arg[2]);
X! 	else
X! 		makefnam(arg[2],".arc",srcname);
X! #else
X!     makefnam(arg[1],".ARC",arcname);   /* fix up archive names */
X!     makefnam(arg[2],".ARC",srcname);
X  /*	makefnam(".$$$",arcname,newname);*/
X  	sprintf(newname,"%s.arc",arctemp);
X  #endif
X  
X!     arc = fopen(arcname,OPEN_R);	       /* open the archives */
X!     if(!(src=fopen(srcname,OPEN_R)))
X  	 abort("Cannot read source archive %s",srcname);
X!     if(!(new=fopen(newname,OPEN_W)))
X  	 abort("Cannot create new archive %s",newname);
X  
X      if(!arc)
________This_Is_The_END________
if test `wc -c < patches` -ne    32469; then
	echo 'shar: patches was damaged during transit (should have been    32469 bytes)'
fi
fi		; : end of overwriting check
exit 0
--
  /
 /_ , ,_.                      Howard Chu
/ /(_/(__                University of Michigan
    /           Computing Center          College of LS&A
   '              Unix Project          Information Systems

zeeff@b-tech.UUCP (Jon Zeeff) (08/01/88)

The only problems I had compiling on a Sys V.3 '386 systems were

1) Line 33 of arcdos.c needs to include time.h instead of sys/time.h

2) ftime may be missing - here's one someone gave me

------ cut here -------------------
/*
 * Uglix ftime simulation
 */

#include <sys/types.h>
#include <sys/timeb.h>		/* HACK */

ftime(tp)
struct timeb *tp;
{
	time_t time();

	tp->time = time(&tp->time);
	tp->millitm = 0;
	tp->timezone = 5*60;	/* HACK */
	tp->dstflag = 1;	/* HACK */
}

----- cut here and put in /usr/include/sys/timeb.h -------------

/* structure returned by ftime() */

/* bsd */

struct timeb
{

	time_t	time;
	unsigned short	millitm;
	short	timezone;
	short	dstflag;
};

--------------------------------------
-- 
Jon Zeeff           		Branch Technology,
uunet!umix!b-tech!zeeff  	zeeff%b-tech.uucp@umix.cc.umich.edu

hyc@math.lsa.umich.edu (Howard Chu) (08/01/88)

ftime isn't used if you've defined SYS5 in Make.tws. Hopefully that's enough
to insure "proper" behavior on most systems...

One last note regarding the screwups in the patches for marc.c - After applying
the patches from the large patch file, your copy of marc.c will be version 1.3,
but the RCS header will not be changed to reflect this. Mea culpa. Upon trying
to apply the followup patch to marc.c, you will probably find the RCS header
in a reject file. You should stick it in there by hand. Sorry 'bout that...
To summarize:
original posting	marc.c version 1.2
patch #1		marc.c should be version 1.3, but isn't so marked.
"oops" patch		marc.c version 1.4

Ok, that's about it. Oh, one more thing - if anyone has gotten this running on
SCO Xenix 386, I'd like to hear from you. Thanks.
--
  /
 /_ , ,_.                      Howard Chu
/ /(_/(__                University of Michigan
    /           Computing Center          College of LS&A
   '              Unix Project          Information Systems

pcng@cad.jmrc.eecs.unsw.oz (Also known as Andrew) (08/04/88)

From article <4659@b-tech.UUCP>, by zeeff@b-tech.UUCP (Jon Zeeff):
> The only problems I had compiling on a Sys V.3 '386 systems were
> 
> 1) Line 33 of arcdos.c needs to include time.h instead of sys/time.h
> 
> 2) ftime may be missing - here's one someone gave me
> 
> ...
> ...
>
> Jon Zeeff           		Branch Technology,
> uunet!umix!b-tech!zeeff  	zeeff%b-tech.uucp@umix.cc.umich.edu

ftime() function call exists on SCO Xenix 386 or 286 V. Just link the
program with '-lx' should work.

       _   _. __   _,
---   /_)_(__/) )_(_)_		[ Also know as Andrew ]
     /              /|
    '              |/

----------------
Po Cheung NG                               ISD:  +61 2 697-4056
JMRC, School of Elec. Eng. and Comp. Sci., STD:  (02) 697-4056
The University of New South Wales,         FAX:  +61 2 662-2087
PO Box 1, Kensington,          ARPA: pcng%cad.jmrc.eecs.unsw.oz.au@uunet.uu.net
Sydney, NSW 2033,              JANET: cad.jmrc.eecs.unsw.oz!pcng@ukc
AUSTRALIA.                     ACSnet: pcng@cad.jmrc.eecs.unsw.oz

UUCP:  {enea,hplabs,mcvax,prlb2,uunet,ubc-vision,ukc}!munnari!cad.jmrc.eecs.unsw.oz!pcng

zeeff@b-tech.UUCP (Jon Zeeff) (08/06/88)

The latest version of Howard's arc seems to work quite well on Sys V.3 and
even a Sys III system.  I'd recommend getting rid of any other versions
of Unix arc and using this one.

-- 
Jon Zeeff           		Branch Technology,
uunet!umix!b-tech!zeeff  	zeeff%b-tech.uucp@umix.cc.umich.edu

wnp@dcs.UUCP (Wolf N. Paul) (08/07/88)

In article <4678@b-tech.UUCP> zeeff@b-tech.UUCP (Jon Zeeff) writes:
>The latest version of Howard's arc seems to work quite well on Sys V.3 and
>even a Sys III system.  I'd recommend getting rid of any other versions
>of Unix arc and using this one.


Has anyone got this version of ARC working on Microport System V/AT --
the 286 version? If so, please let me know what changes you made to the
source.

Wolf
-- 
Wolf N. Paul * 3387 Sam Rayburn Run * Carrollton TX 75007 * (214) 306-9101
UUCP:     killer!dcs!wnp                 ESL: 62832882
DOMAIN:   wnp%dcs@killer.dallas.tx.us    TLX: 910-380-0585 EES PLANO UD

roger@marque.mu.edu (Roger Abrahams) (08/08/88)

In article <4678@b-tech.UUCP> zeeff@b-tech.UUCP (Jon Zeeff) writes:
<The latest version of Howard's arc seems to work quite well on Sys V.3 and
<even a Sys III system.  I'd recommend getting rid of any other versions
<of Unix arc and using this one.
<
<-- 
<Jon Zeeff           		Branch Technology,
<uunet!umix!b-tech!zeeff  	zeeff%b-tech.uucp@umix.cc.umich.edu

Well not really...

I have succeeded in getting the thing to "work" on a 3B15, running system V.
However, it is buggy.  I had some test files from the ibm-pc binaries group.
I had these in a directory with the original uuencode versions.  It did
decode the .arc files correctly.  I then attempted to make an arc file
from this conglomerate, and alas, the arcive created would add characters
to the uuencode files when I attempted to decode them.  A brief look showed 
things like a line containing a space or a "'" character, would suddenly have 
multiple spaces and 3 "'"'s instead of one.

I also atempted a port to a 3B1, and this was a total disaster.  It cannot
decode ANY archive.

Frankly I am confused as MOST thing ported between these two system usually
behave the same.  That is that if they are buggy, they generally are buggy
in the same way...

						- Roger