diff -c /usr2/polymnia/hyc/News/arc/Make.tws arc/Make.tws
*** /usr2/polymnia/hyc/News/arc/Make.tws	Wed Jul  6 02:26:14 1988
--- arc/Make.tws	Sun Jul 31 18:29:28 1988
***************
*** 22,33 ****
  
  libtws.a:	dtime.o dtimep.o lexstring.o
  		ar r libtws.a dtime.o dtimep.o lexstring.o
! # The following amusing bullshit makes sure that ranlib
! # gets executed if it is present, no matter which shell
! # make uses.  If there's a better way to do this, someone
! # please tell me!
! 		-if test -r /usr/bin/ranlib ; then ranlib libtws.a ; fi
! 		-if ( -r /usr/bin/ranlib ) ranlib libtws.a
  
  dtime.o:	dtime.c tws.h
  
--- 22,29 ----
  
  libtws.a:	dtime.o dtimep.o lexstring.o
  		ar r libtws.a dtime.o dtimep.o lexstring.o
! #Hope it goes, but no big deal if not. -- hyc
! 		-ranlib libtws.a
  
  dtime.o:	dtime.c tws.h
  
diff -c /usr2/polymnia/hyc/News/arc/arc.c arc/arc.c
*** /usr2/polymnia/hyc/News/arc/arc.c	Wed Jul  6 02:26:55 1988
--- arc/arc.c	Sun Jul 31 18:43:40 1988
***************
*** 1,5 ****
  /*
!  * $Header: arc.c,v 1.10 88/06/17 15:22:48 hyc Locked $
   */
  
  /*  ARC - Archive utility
--- 1,5 ----
  /*
!  * $Header: arc.c,v 1.12 88/07/31 18:39:50 hyc Exp $
   */
  
  /*  ARC - Archive utility
***************
*** 73,88 ****
  #include <stdio.h>
  #include "arc.h"
  
  int		strlen();
  void		addarc(), delarc(), extarc(), lstarc(), tstarc(), cvtarc(), runarc();
  void		abort();
  #if	MTS
  void		etoa();
  #endif
  #if	GEMDOS
! long		_stksize = 24576;
  #endif
  char		*strcpy(), *strcat();
  
  static char   **lst;		/* files list */
  static int	lnum;		/* length of files list */
--- 73,95 ----
  #include <stdio.h>
  #include "arc.h"
  
+ #if	UNIX
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #endif
+ 
  int		strlen();
  void		addarc(), delarc(), extarc(), lstarc(), tstarc(), cvtarc(), runarc();
  void		abort();
+ static	void	expandlst();
  #if	MTS
  void		etoa();
  #endif
  #if	GEMDOS
! long		_stksize = 65536L;
  #endif
  char		*strcpy(), *strcat();
+ char		*makefnam();	/* filename fixup routine */
  
  static char   **lst;		/* files list */
  static int	lnum;		/* length of files list */
***************
*** 93,99 ****
  {
  	char		opt = 0;/* selected action */
  	char	       *a;	/* option pointer */
- 	char	       *makefnam();	/* filename fixup routine */
  	void		upper();/* case conversion routine */
  	char	       *index();/* string index utility */
  	char	       *envfind();	/* environment searcher */
--- 100,105 ----
***************
*** 101,111 ****
--- 107,121 ----
  	char	       *arctemp2, *calloc(), *mktemp();
  #if	GEMDOS
  	void		exitpause();
+ 	int		append;
  #endif
  #if	MTS
  	fortran void	guinfo();
  	char		gotinf[4];
  #endif
+ #if	UNIX
+ 	struct	stat	sbuf;
+ #endif
  
  	if (num < 3) {
  		printf("ARC - Archive utility, Version 5.21, created on 04/22/87 at 15:05:21\n");
***************
*** 198,207 ****
  		if (arctemp[n - 1] != CUTOFF)
  			arctemp[n] = CUTOFF;
  	}
  #if	!MSDOS
! 	strcat(arctemp, mktemp("AXXXXXX"));
  #else
  	strcat(arctemp, "$ARCTEMP");
  #endif
  #else
  	guinfo("SHFSEP	", gotinf);
--- 208,224 ----
  		if (arctemp[n - 1] != CUTOFF)
  			arctemp[n] = CUTOFF;
  	}
+ #if	UNIX
+ 	else	strcpy(arctemp, "/tmp/");
+ #endif
  #if	!MSDOS
! 	{
! 		static char tempname[] = "AXXXXXX";
! 		strcat(arctemp, mktemp(tempname));
! 	}
  #else
  	strcat(arctemp, "$ARCTEMP");
+ 	arctemp2 = NULL;
  #endif
  #else
  	guinfo("SHFSEP	", gotinf);
***************
*** 223,229 ****
  #endif
  
  	/* create archive names, supplying defaults */
! 	makefnam(arg[2], ".arc", arcname);
  	/* makefnam(".$$$",arcname,newname); */
  	sprintf(newname, "%s.arc", arctemp);
  	makefnam(".BAK", arcname, bakname);
--- 240,253 ----
  #endif
  
  	/* create archive names, supplying defaults */
! #if	UNIX
! 	if (!stat(arg[2],&sbuf))
! 		strcpy(arcname,arg[2]);
! 	else
! 		makefnam(arg[2],".arc",arcname);
! #else
! 	makefnam(arg[2], ".ARC", arcname);
! #endif
  	/* makefnam(".$$$",arcname,newname); */
  	sprintf(newname, "%s.arc", arctemp);
  	makefnam(".BAK", arcname, bakname);
***************
*** 298,306 ****
--- 322,346 ----
  	for (n = 0; n < lnum;) {/* expand indirect references */
  		if (*lst[n] == '@')
  			expandlst(n);
+ #if	GEMDOS		/* redirect stdout from the desktop...*/
+ 		else if (*lst[n] == '>') {
+ 			arctemp2 = (++lst[n]);
+ 			lst[n] = lst[lnum-1];	/* delete this entry */
+ 			lnum--;
+ 			if (arctemp2[0] == '>') {
+ 				append = 1;
+ 				arctemp2++;
+ 			}
+ 			else	append = 0;
+ 		}
+ #endif
  		else
  			n++;
  	}
+ #if	GEMDOS
+ 	if (arctemp2)
+ 		freopen(arctemp2,append ? "a" : "w",stdout);
+ #endif
  
  	/* act on whatever action command was given */
  
***************
*** 349,355 ****
  #endif
  	return nerrs;
  }
! static
  expandlst(n)			/* expand an indirect reference */
  	int		n;	/* number of entry to expand */
  {
--- 389,395 ----
  #endif
  	return nerrs;
  }
! static	void
  expandlst(n)			/* expand an indirect reference */
  	int		n;	/* number of entry to expand */
  {
diff -c /usr2/polymnia/hyc/News/arc/arc.h arc/arc.h
*** /usr2/polymnia/hyc/News/arc/arc.h	Wed Jul  6 02:26:56 1988
--- arc/arc.h	Sun Jul 31 18:45:33 1988
***************
*** 1,5 ****
  /*
!  * $Header: arc.h,v 1.7 88/06/01 17:51:06 hyc Locked $
   */
  
  #undef	MSDOS
--- 1,5 ----
  /*
!  * $Header: arc.h,v 1.9 88/07/31 18:43:18 hyc Exp $
   */
  
  #undef	MSDOS
***************
*** 27,32 ****
--- 27,34 ----
  #if	MSDOS || GEMDOS
  #define	DOS	1
  #define	CUTOFF	'\\'
+ #define	OPEN_R	"rb"
+ #define	OPEN_W	"wb"
  #endif
  
  #if	!MSDOS
***************
*** 37,53 ****
  #if	BSD || SYSV
  #define	UNIX	1
  #define	CUTOFF	'/'
  #include <ctype.h>
  #endif
  
  #if	MTS
! #define rindex strrchr
! #define index strchr
! #undef  USEGFINFO		/* define this to use GFINFO for directory */
! #define USECATSCAN		/* scanning, else use CATSCAN/FILEINFO... */
  #define	CUTOFF	sepchr[0]
  #endif
  
  /*  ARC - Archive utility - ARC Header
    
      Version 2.17, created on 04/22/87 at 13:09:43
--- 39,60 ----
  #if	BSD || SYSV
  #define	UNIX	1
  #define	CUTOFF	'/'
+ #define	OPEN_R	"r"
+ #define	OPEN_W	"w"
  #include <ctype.h>
  #endif
  
  #if	MTS
! #define	USEGFINFO	0	/* define this to use GFINFO for directory */
! #define	USECATSCAN	1	/* scanning, else use CATSCAN/FILEINFO... */
  #define	CUTOFF	sepchr[0]
  #endif
  
+ #if	MTS || SYSV
+ #define	rindex	strrchr
+ #define	index	strchr
+ #endif
+ 
  /*  ARC - Archive utility - ARC Header
    
      Version 2.17, created on 04/22/87 at 13:09:43
***************
*** 69,75 ****
  #define ARCVER 9		/* archive header version code   */
  #define STRLEN 100		/* system standard string length */
  #define FNLEN 13		/* file name length              */
! #define MAXARG 25		/* maximum number of arguments   */
  
  #ifndef DONT_DEFINE		/* Defined by arcdata.c */
  #include "arcs.h"
--- 76,82 ----
  #define ARCVER 9		/* archive header version code   */
  #define STRLEN 100		/* system standard string length */
  #define FNLEN 13		/* file name length              */
! #define MAXARG 400		/* maximum number of arguments   */
  
  #ifndef DONT_DEFINE		/* Defined by arcdata.c */
  #include "arcs.h"
diff -c /usr2/polymnia/hyc/News/arc/arcadd.c arc/arcadd.c
*** /usr2/polymnia/hyc/News/arc/arcadd.c	Wed Jul  6 02:26:57 1988
--- arc/arcadd.c	Sun Jul 31 18:47:27 1988
***************
*** 1,5 ****
  /*
!  * $Header: arcadd.c,v 1.8 88/06/13 00:31:15 hyc Locked $
   */
  
  /*
--- 1,5 ----
  /*
!  * $Header: arcadd.c,v 1.9 88/07/31 18:45:14 hyc Exp $
   */
  
  /*
***************
*** 231,237 ****
  	int             upd = 0;/* true if replacing an entry */
  
  #if	!MTS
! 	if (!(f = fopen(path, "rb")))
  #else
  	if (image)
  		f = fopen(path, "rb");
--- 231,237 ----
  	int             upd = 0;/* true if replacing an entry */
  
  #if	!MTS
! 	if (!(f = fopen(path, OPEN_R)))
  #else
  	if (image)
  		f = fopen(path, "rb");
***************
*** 246,251 ****
--- 246,280 ----
  		}
  		return;
  	}
+ #if	!DOS
+ 	if (strlen(name) >= FNLEN) {
+ 		if (warn) {
+ 			char	buf[STRLEN];
+ 			printf("WARNING: File %s name too long!\n", name);
+ 			name[FNLEN-1]='\0';
+ 			while(1) {
+ 				printf("  Truncate to %s (y/n)? ", name);
+ 				fflush(stdout);
+ 				fgets(buf, STRLEN, stdin);
+ 				*buf = toupper(*buf);
+ 				if (*buf == 'Y' || *buf == 'N')
+ 					break;
+ 			}
+ 			if (*buf == 'N') {
+ 				printf("Skipping...\n");
+ 				fclose(f);
+ 				return;
+ 			}
+ 		}
+ 		else {
+ 			if (note)
+ 				printf("Skipping file: %s - name too long.\n",
+ 					name);
+ 			fclose(f);
+ 			return;
+ 		}
+ 	}
+ #endif
  	strcpy(nhdr.name, name);/* save name */
  	nhdr.size = 0;		/* clear out size storage */
  	nhdr.crc = 0;		/* clear out CRC check storage */
***************
*** 257,269 ****
  	int	inlen;
  	struct	GDDSECT	*region;
  
! 	region=gdinfo(f->_fd);
  	inlen=region->GDINLEN;
! 	buffer=malloc(inlen);   /* maximum line length */
  	setbuf(f,buffer);        
  	f->_bufsiz=inlen;        
! 	f->_mods|=0x00040000;   /* Don't do "$continue with" */
! 	f->_mods&=0xfff7ffff;   /* turn it off, if set... */
  	}
  	getstamp(path, &nhdr.date, &nhdr.time);
  #endif
--- 286,298 ----
  	int	inlen;
  	struct	GDDSECT	*region;
  
! 	region=gdinfo(f->_fd._fdub);
  	inlen=region->GDINLEN;
! 	buffer=malloc(inlen);	/* maximum line length */
  	setbuf(f,buffer);        
  	f->_bufsiz=inlen;        
! 	f->_mods|=_NOIC;	/* Don't do "$continue with" */
! 	f->_mods&=~_IC;		/* turn it off, if set... */
  	}
  	getstamp(path, &nhdr.date, &nhdr.time);
  #endif
***************
*** 325,331 ****
  	hdrver = ARCVER;		/* anything but end marker */
  	writehdr(&nhdr, new);	/* write out header skeleton */
  	pack(f, new, &nhdr);	/* pack file into archive */
- 	strcpy(nhdr.name, name);
  	fseek(new, starts, 0);	/* move back to header skeleton */
  	writehdr(&nhdr, new);	/* write out real header */
  	fseek(new, nhdr.size, 1);	/* skip over data to next header */
--- 354,359 ----
diff -c /usr2/polymnia/hyc/News/arc/arcdata.c arc/arcdata.c
*** /usr2/polymnia/hyc/News/arc/arcdata.c	Wed Jul  6 02:26:59 1988
--- arc/arcdata.c	Sun Jul 31 18:48:38 1988
***************
*** 1,5 ****
  /*
!  * $Header: arcdata.c,v 1.6 88/06/01 19:17:58 hyc Locked $
   */
  
  /*  ARC - Archive utility - ARCDATA
--- 1,5 ----
  /*
!  * $Header: arcdata.c,v 1.7 88/07/31 18:47:22 hyc Exp $
   */
  
  /*  ARC - Archive utility - ARCDATA
diff -c /usr2/polymnia/hyc/News/arc/arcdos.c arc/arcdos.c
*** /usr2/polymnia/hyc/News/arc/arcdos.c	Wed Jul  6 02:27:00 1988
--- arc/arcdos.c	Sun Jul 31 18:49:42 1988
***************
*** 1,5 ****
  /*
!  * $Header: arcdos.c,v 1.5 88/06/13 00:40:49 hyc Locked $
   */
  
  /*
--- 1,5 ----
  /*
!  * $Header: arcdos.c,v 1.6 88/07/31 18:48:09 hyc Exp $
   */
  
  /*
***************
*** 35,40 ****
--- 35,41 ----
  #endif
  
  #if	SYSV
+ #include <sys/times.h>
  struct timeval {
  	long tv_sec;
  	long tv_usec;
***************
*** 78,100 ****
  	*time = ret[0];
  #endif
  #if	UNIX
! 	char	       *ctime();
! 	struct stat    *buf;
! 	int             day, hr, min, sec, yr, imon;
! 	static char     mon[4], *mons[12] = {
! 				   "Jan", "Feb", "Mar", "Apr", "May", "Jun",
! 				    "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
! 	};
  
! 	buf = (struct stat *) malloc(sizeof(struct stat));
! 	fstat(fileno(f), buf);
! 
! 	sscanf(ctime(&(buf->st_mtime)), "%*4s%3s%d%d:%d:%d%d", mon, &day, &hr, &min,
! 	       &sec, &yr);
! 	for (imon = 0; imon < 12 && strcmp(mon, mons[imon]); imon++);
! 
! 	*date = (unsigned short) (((yr - 1980) << 9) + ((imon + 1) << 5) + day);
! 	*time = (unsigned short) ((hr << 11) + (min << 5) + sec / 2);
  #endif
  #if	MTS
  	fortran         timein(),
--- 79,93 ----
  	*time = ret[0];
  #endif
  #if	UNIX
! 	struct stat	buf;
! 	struct tm	*localtime(), *t;
  
! 	fstat(fileno(f), &buf);
! 	t=localtime(&(buf.st_mtime));
! 	*date = (unsigned short) (((t->tm_year - 80) << 9) +
! 				((t->tm_mon + 1) << 5) + t->tm_mday);
! 	*time = (unsigned short) ((t->tm_hour << 11) +
! 				(t->tm_min << 5) + t->tm_sec / 2);
  #endif
  #if	MTS
  	fortran         timein(),
diff -c /usr2/polymnia/hyc/News/arc/arcext.c arc/arcext.c
*** /usr2/polymnia/hyc/News/arc/arcext.c	Wed Jul  6 02:27:01 1988
--- arc/arcext.c	Fri Jul 22 14:53:29 1988
***************
*** 155,161 ****
  		}
  	}
  #if	!MTS
! 	if (!(f = fopen(fix, "wb")))
  #else
  	{
  		fortran         create();
--- 155,161 ----
  		}
  	}
  #if	!MTS
! 	if (!(f = fopen(fix, OPEN_W)))
  #else
  	{
  		fortran         create();
diff -c /usr2/polymnia/hyc/News/arc/arcio.c arc/arcio.c
*** /usr2/polymnia/hyc/News/arc/arcio.c	Wed Jul  6 02:27:02 1988
--- arc/arcio.c	Sun Jul 31 18:50:20 1988
***************
*** 1,5 ****
  /*
!  * $Header: arcio.c,v 1.7 88/06/02 16:27:32 hyc Locked $
   */
  
  /*  ARC - Archive utility - ARCIO
--- 1,5 ----
  /*
!  * $Header: arcio.c,v 1.9 88/07/31 18:49:19 hyc Exp $
   */
  
  /*  ARC - Archive utility - ARCIO
***************
*** 102,112 ****
  #if	MTS
  	(void) atoe(hdr->name, strlen(hdr->name));
  #endif
! 	for (i = 0; i<4; hdr->size<<=8, hdr->size += dummy[16-i], i++);
  	hdr->date = (short) ((dummy[18] << 8) + dummy[17]);
  	hdr->time = (short) ((dummy[20] << 8) + dummy[19]);
  	hdr->crc = (short) ((dummy[22] << 8) + dummy[21]);
! 	for (i = 0; i<4; hdr->length<<=8, hdr->length += dummy[26-i], i++);
  #endif
  
  	if (hdr->date > olddate
--- 102,112 ----
  #if	MTS
  	(void) atoe(hdr->name, strlen(hdr->name));
  #endif
! 	for (i = 0, hdr->size=0; i<4; hdr->size<<=8, hdr->size += dummy[16-i], i++);
  	hdr->date = (short) ((dummy[18] << 8) + dummy[17]);
  	hdr->time = (short) ((dummy[20] << 8) + dummy[19]);
  	hdr->crc = (short) ((dummy[22] << 8) + dummy[21]);
! 	for (i = 0, hdr->length=0; i<4; hdr->length<<=8, hdr->length += dummy[26-i], i++);
  #endif
  
  	if (hdr->date > olddate
***************
*** 175,187 ****
  	FILE           *t;	/* file to write to */
  {
  	c &= 0xff;
! 	if (t)
  #if	UNIX
  		fputc(c, t);
  #else
  		if (fputc(c, t) == EOF)
  			abort("Write fail (disk full?)");
  #endif
  }
  
  /*
--- 175,190 ----
  	FILE           *t;	/* file to write to */
  {
  	c &= 0xff;
! 	if (t) {
  #if	UNIX
  		fputc(c, t);
+ 		if (ferror(t))
+ 			abort("Write failed");
  #else
  		if (fputc(c, t) == EOF)
  			abort("Write fail (disk full?)");
  #endif
+ 	}
  }
  
  /*
diff -c /usr2/polymnia/hyc/News/arc/arclzw.c arc/arclzw.c
*** /usr2/polymnia/hyc/News/arc/arclzw.c	Wed Jul  6 02:27:19 1988
--- arc/arclzw.c	Sun Jul 31 18:50:49 1988
***************
*** 1,5 ****
  /*
!  * $Header: arclzw.c,v 1.4 88/06/01 16:27:59 hyc Locked $
   */
  
  /*
--- 1,5 ----
  /*
!  * $Header: arclzw.c,v 1.6 88/07/31 18:49:49 hyc Exp $
   */
  
  /*
***************
*** 59,65 ****
  	unsigned char   follower;	/* char following string */
  	unsigned short  next;	/* ptr to next in collision list */
  	unsigned short  predecessor;	/* code for preceeding string */
! };            /* string_tab[TABSIZE];	/* the code string table */
  
  
  /* definitions for the new dynamic Lempel-Zev crunching */
--- 59,65 ----
  	unsigned char   follower;	/* char following string */
  	unsigned short  next;	/* ptr to next in collision list */
  	unsigned short  predecessor;	/* code for preceeding string */
! };            /* string_tab[TABSIZE];	   the code string table */
  
  
  /* definitions for the new dynamic Lempel-Zev crunching */
diff -c /usr2/polymnia/hyc/News/arc/arcmatch.c arc/arcmatch.c
*** /usr2/polymnia/hyc/News/arc/arcmatch.c	Wed Jul  6 02:27:20 1988
--- arc/arcmatch.c	Sun Jul 31 18:51:22 1988
***************
*** 1,5 ****
  /*
!  * $Header: arcmatch.c,v 1.5 88/06/01 19:41:08 hyc Locked $
   */
  
  /*
--- 1,5 ----
  /*
!  * $Header: arcmatch.c,v 1.6 88/07/31 18:50:18 hyc Exp $
   */
  
  /*
***************
*** 67,72 ****
--- 67,77 ----
  	upper(t);		/* avoid case problems */
  #endif	/* UNIX */
  #if	GEMDOS
+ 	char *strstr(), *i;	/* allow "*.*" to mean '*' */
+ 	if (i=strstr(t,"*.*")) {
+ 		i++;
+ 		*i='\0';
+ 	}
  	return(pnmatch(n, t, 0));
  #else
  	/* first match name part */
diff -c /usr2/polymnia/hyc/News/arc/arcmisc.c arc/arcmisc.c
*** /usr2/polymnia/hyc/News/arc/arcmisc.c	Wed Jul  6 02:27:21 1988
--- arc/arcmisc.c	Sun Jul 31 18:52:44 1988
***************
*** 1,6 ****
  /*
   * Miscellaneous routines to get ARC running on non-MSDOS systems...
!  * $Header: arcmisc.c,v 1.7 88/06/12 19:23:13 hyc Locked $ 
   */
  
  #include <stdio.h>
--- 1,6 ----
  /*
   * Miscellaneous routines to get ARC running on non-MSDOS systems...
!  * $Header: arcmisc.c,v 1.8 88/07/31 18:50:56 hyc Exp $ 
   */
  
  #include <stdio.h>
***************
*** 55,61 ****
  #include <sys/types.h>
  #include <sys/dir.h>
  #include <sys/stat.h>
! 	int	rename();
  #endif
  
  #if	SYSV
--- 55,61 ----
  #include <sys/types.h>
  #include <sys/dir.h>
  #include <sys/stat.h>
! 	int	rename(), unlink();
  #endif
  
  #if	SYSV
***************
*** 65,72 ****
  #define DIRECT direct
  #endif
  
  char           *strcpy(), *strcat(), *malloc();
! int             strlen();
  
  int
  move(oldnam, newnam)
--- 65,85 ----
  #define DIRECT direct
  #endif
  
+ #if	BSD
+ char	*
+ memset(s, c, n)		/* oops. Thought it was standard BSD, but my Sun */
+ 	char	*s;	/* fooled me again. -- hyc */
+ 	int	c, n;
+ {
+ 	register int i;
+ 	for(i=0;i<n;i++)
+ 		s[i]=c;
+ 	return(s);
+ }
+ #endif
+ 
  char           *strcpy(), *strcat(), *malloc();
! int             strlen(), strcmp(), match();
  
  int
  move(oldnam, newnam)
***************
*** 73,79 ****
--- 86,94 ----
  	char           *oldnam, *newnam;
  {
  	FILE           *fopen(), *old, *new;
+ #if	!MTS
  	struct stat     oldstat;
+ #endif
  	char           *strcpy();
  	void		filecopy();
  #if	GEMDOS
***************
*** 81,99 ****
  #else
  	if (rename(oldnam, newnam))
  #endif
  	{
  		if (stat(oldnam, &oldstat))	/* different partition? */
  			return (-1);
! 		old = fopen(oldnam, "rb");
  		if (old == NULL)
  			return (-1);
! 		new = fopen(newnam, "wb");
  		if (new == NULL)
  			return (-1);
  		filecopy(old, new, oldstat.st_size);
! 		unlink(oldnam);
  	}
  	return 0;
  }
  
  static void
--- 96,118 ----
  #else
  	if (rename(oldnam, newnam))
  #endif
+ #if	!MTS
  	{
  		if (stat(oldnam, &oldstat))	/* different partition? */
  			return (-1);
! 		old = fopen(oldnam, OPEN_R);
  		if (old == NULL)
  			return (-1);
! 		new = fopen(newnam, OPEN_W);
  		if (new == NULL)
  			return (-1);
  		filecopy(old, new, oldstat.st_size);
! 		return(unlink(oldnam));
  	}
  	return 0;
+ #else
+ 	return(-1);
+ #endif
  }
  
  static void
***************
*** 270,276 ****
  	int             alphasort();
  	int             scandir();
  #endif				/* UNIX */
! 	int             fmatch();
  	static int      Nnum = 0, ii;
  	char		*rindex();
  
--- 289,295 ----
  	int             alphasort();
  	int             scandir();
  #endif				/* UNIX */
! 	int             fmatch(), free();
  	static int      Nnum = 0, ii;
  	char		*rindex();
  
diff -c /usr2/polymnia/hyc/News/arc/arcpack.c arc/arcpack.c
*** /usr2/polymnia/hyc/News/arc/arcpack.c	Wed Jul  6 02:27:22 1988
--- arc/arcpack.c	Sun Jul 31 18:53:25 1988
***************
*** 1,5 ****
  /*
!  * $Header: arcpack.c,v 1.9 88/06/02 16:27:36 hyc Locked $
   */
  
  /*  ARC - Archive utility - ARCPACK
--- 1,5 ----
  /*
!  * $Header: arcpack.c,v 1.11 88/07/31 18:52:08 hyc Exp $
   */
  
  /*  ARC - Archive utility - ARCPACK
***************
*** 24,30 ****
  #endif
  
  void	setcode(), sqinit_cm(), sqputc_cm(), init_cm(), putc_cm();
! void	filecopy(), abort(), putc_tst();
  int	getch(), addcrc();
  
  /* stuff for non-repeat packing */
--- 24,30 ----
  #endif
  
  void	setcode(), sqinit_cm(), sqputc_cm(), init_cm(), putc_cm();
! void	filecopy(), abort(), putc_tst(), init_sq(), scan_sq();
  int	getch(), addcrc();
  
  /* stuff for non-repeat packing */
***************
*** 155,161 ****
  	/* standard cleanups common to all methods */
  
  	if (note)
! 		printf("done. (%ld%%)\n",100L - (100L*hdr->size)/hdr->length);
  }
  
  /*
--- 155,162 ----
  	/* standard cleanups common to all methods */
  
  	if (note)
! 		printf("done. (%ld%%)\n",hdr->length == 0 ?
! 				0L : 100L - (100L*hdr->size)/hdr->length);
  }
  
  /*
diff -c /usr2/polymnia/hyc/News/arc/arcrun.c arc/arcrun.c
*** /usr2/polymnia/hyc/News/arc/arcrun.c	Wed Jul  6 02:27:22 1988
--- arc/arcrun.c	Sun Jul 31 18:53:59 1988
***************
*** 1,5 ****
  /*
!  * $Header: arcrun.c,v 1.3 88/06/01 19:57:16 hyc Locked $
   */
  
  /*
--- 1,5 ----
  /*
!  * $Header: arcrun.c,v 1.4 88/07/31 18:52:50 hyc Exp $
   */
  
  /*
***************
*** 22,27 ****
--- 22,29 ----
  #include "arc.h"
  
  void	rempath(), openarc(), closearc(), abort();
+ int	readhdr(), match(), unpack();
+ static	void	runfile();
  char	*strcat();
  
  void
***************
*** 33,39 ****
  	char           *makefnam();	/* filename fixer */
  	char            buf[STRLEN];	/* filename buffer */
  	FILE           *fopen();/* file opener */
- 	int             runfile();
  	char	       *dummy[2];
  
  	dummy[0]="dummy";
--- 35,40 ----
***************
*** 56,62 ****
  	closearc(0);		/* close archive after changes */
  }
  
! static          int
  runfile(hdr, num, arg)		/* run a file */
  	struct heads   *hdr;	/* pointer to header data */
  	int             num;	/* number of arguments */
--- 57,63 ----
  	closearc(0);		/* close archive after changes */
  }
  
! static  void
  runfile(hdr, num, arg)		/* run a file */
  	struct heads   *hdr;	/* pointer to header data */
  	int             num;	/* number of arguments */
***************
*** 120,126 ****
  	if (warn)
  		if (tmp = fopen(buf, "r"))
  			abort("Temporary file %s already exists", buf);
! 	if (!(tmp = fopen(buf, "wb")))
  		abort("Unable to create temporary file %s", buf);
  
  	if (note)
--- 121,127 ----
  	if (warn)
  		if (tmp = fopen(buf, "r"))
  			abort("Temporary file %s already exists", buf);
! 	if (!(tmp = fopen(buf, OPEN_W)))
  		abort("Unable to create temporary file %s", buf);
  
  	if (note)
diff -c /usr2/polymnia/hyc/News/arc/arcsq.c arc/arcsq.c
*** /usr2/polymnia/hyc/News/arc/arcsq.c	Wed Jul  6 02:27:24 1988
--- arc/arcsq.c	Sun Jul 31 18:54:48 1988
***************
*** 1,5 ****
  /*
!  * $Header: arcsq.c,v 1.2 88/06/02 16:27:38 hyc Locked $
   */
  
  /*
--- 1,5 ----
  /*
!  * $Header: arcsq.c,v 1.3 88/07/31 18:53:32 hyc Exp $
   */
  
  /*
***************
*** 65,71 ****
  static int      cbitsrem;	/* # of code string bits left */
  static unsigned short ccode;	/* current code right justified */
  
! int 
  init_sq()
  {				/* prepare for scanning pass */
  	int             i;	/* node index */
--- 65,73 ----
  static int      cbitsrem;	/* # of code string bits left */
  static unsigned short ccode;	/* current code right justified */
  
! static	void	scale(), heap(), adjust(), bld_tree(), init_enc(), put_int();
! static	int	cmptrees(), buildenc(), maxchar();
! void 
  init_sq()
  {				/* prepare for scanning pass */
  	int             i;	/* node index */
***************
*** 86,92 ****
  		valcount[i] = 0;
  }
  
! int 
  scan_sq(c)			/* add a byte to the tables */
  	int             c;	/* byte to add */
  {
--- 88,94 ----
  		valcount[i] = 0;
  }
  
! void 
  scan_sq(c)			/* add a byte to the tables */
  	int             c;	/* byte to add */
  {
***************
*** 113,123 ****
  	unsigned short	ceiling;/* limit for scaling */
  	long            size = 0;	/* predicted size */
  	int             numnodes;	/* # of nodes in simplified tree */
- 	int             scale();
- 	int             heap();
- 	int             bld_tree();
- 	int             buildenc();
- 	int             init_enc();
  
  	scan_sq(EOF);		/* signal end of input */
  
--- 115,120 ----
***************
*** 188,194 ****
   * integer. Rescaling is used if necessary to limit the code length. 
   */
  
! static int 
  scale(ceil)
  	unsigned short	ceil;	/* upper limit on total weight */
  {
--- 185,191 ----
   * integer. Rescaling is used if necessary to limit the code length. 
   */
  
! static	void
  scale(ceil)
  	unsigned short	ceil;	/* upper limit on total weight */
  {
***************
*** 236,247 ****
   * rescaling. 
   */
  
! static int 
  heap(list, length)
  	int             list[], length;
  {
  	register int    i;
- 	int             adjust();
  
  	for (i = (length - 2) / 2; i >= 0; --i)
  		adjust(list, i, length - 1);
--- 233,243 ----
   * rescaling. 
   */
  
! static	void
  heap(list, length)
  	int             list[], length;
  {
  	register int    i;
  
  	for (i = (length - 2) / 2; i >= 0; --i)
  		adjust(list, i, length - 1);
***************
*** 249,260 ****
  
  /* Make a heap from a heap with a new top */
  
! static int 
  adjust(list, top, bottom)
  	int             list[], top, bottom;
  {
  	register int    k, temp;
- 	int             cmptrees();
  
  	k = 2 * top + 1;	/* left child of top */
  	temp = list[top];	/* remember root node of top tree */
--- 245,255 ----
  
  /* Make a heap from a heap with a new top */
  
! static	void
  adjust(list, top, bottom)
  	int             list[], top, bottom;
  {
  	register int    k, temp;
  
  	k = 2 * top + 1;	/* left child of top */
  	temp = list[top];	/* remember root node of top tree */
***************
*** 282,288 ****
   * comparison rules in previous comments. 
   */
  
! static int 
  cmptrees(a, b)
  	int             a, b;	/* root nodes of trees */
  {
--- 277,283 ----
   * comparison rules in previous comments. 
   */
  
! static	int 
  cmptrees(a, b)
  	int             a, b;	/* root nodes of trees */
  {
***************
*** 308,314 ****
   * element and reheaping the shorter list. 
   */
  
! static int 
  bld_tree(list, len)
  	int             list[];
  int             len;
--- 303,309 ----
   * element and reheaping the shorter list. 
   */
  
! static	void
  bld_tree(list, len)
  	int             list[];
  int             len;
***************
*** 316,322 ****
  	register int    freenode;	/* next free node in tree */
  	register struct nd *frnp;	/* free node pointer */
  	int             lch, rch;	/* temps for left, right children */
- 	int             maxchar();
  
  	/*
  	 * Initialize index to next available (non-leaf) node. Lower numbered
--- 311,316 ----
***************
*** 365,371 ****
  	return a > b ? a : b;
  }
  
! static int 
  init_enc()
  {
  	register int    i;
--- 359,365 ----
  	return a > b ? a : b;
  }
  
! static	void
  init_enc()
  {
  	register int    i;
***************
*** 421,431 ****
  	return NULL;		/* it worked if we reach here */
  }
  
! static int 
  put_int(n, f)			/* output an integer */
  	short		n;	/* integer to output */
  	FILE           *f;	/* file to put it to */
  {
  	putc_pak(n & 0xff, f);	/* first the low byte */
  	putc_pak(n >> 8, f);	/* then the high byte */
  }
--- 415,427 ----
  	return NULL;		/* it worked if we reach here */
  }
  
! static	void
  put_int(n, f)			/* output an integer */
  	short		n;	/* integer to output */
  	FILE           *f;	/* file to put it to */
  {
+ 	void		putc_pak();
+ 
  	putc_pak(n & 0xff, f);	/* first the low byte */
  	putc_pak(n >> 8, f);	/* then the high byte */
  }
***************
*** 481,486 ****
--- 477,483 ----
  {
  	int             rbyte;	/* Result byte value */
  	int             need;	/* number of bits */
+ 	int		getc_ncr();
  
  	rbyte = 0;
  	need = 8;		/* build one byte per call */
diff -c /usr2/polymnia/hyc/News/arc/arcsqs.c arc/arcsqs.c
*** /usr2/polymnia/hyc/News/arc/arcsqs.c	Wed Jul  6 02:27:43 1988
--- arc/arcsqs.c	Sun Jul 31 18:55:21 1988
***************
*** 1,5 ****
  /*
!  * $Header: arcsqs.c,v 1.2 88/06/01 16:31:39 hyc Locked $
   */
  
  /*  ARC - Archive utility - SQUASH
--- 1,5 ----
  /*
!  * $Header: arcsqs.c,v 1.3 88/07/31 18:54:14 hyc Exp $
   */
  
  /*  ARC - Archive utility - SQUASH
***************
*** 12,18 ****
  */
  
  /*
!  * $Header: arcsqs.c,v 1.2 88/06/01 16:31:39 hyc Locked $
   */
  
  #include <stdio.h>
--- 12,18 ----
  */
  
  /*
!  * $Header: arcsqs.c,v 1.3 88/07/31 18:54:14 hyc Exp $
   */
  
  #include <stdio.h>
diff -c /usr2/polymnia/hyc/News/arc/arcsvc.c arc/arcsvc.c
*** /usr2/polymnia/hyc/News/arc/arcsvc.c	Wed Jul  6 02:27:44 1988
--- arc/arcsvc.c	Sun Jul 31 18:55:55 1988
***************
*** 1,5 ****
  /*
!  * $Header: arcsvc.c,v 1.8 88/06/13 00:42:59 hyc Locked $
   */
  
  /*  ARC - Archive utility - ARCSVC
--- 1,5 ----
  /*
!  * $Header: arcsvc.c,v 1.9 88/07/31 18:54:55 hyc Exp $
   */
  
  /*  ARC - Archive utility - ARCSVC
***************
*** 31,37 ****
  {
  	FILE           *fopen();/* file opener */
  
! 	if (!(arc = fopen(arcname, "rb"))) {
  		if (chg) {
  			if (note)
  				printf("Creating new archive: %s\n", arcname);
--- 31,37 ----
  {
  	FILE           *fopen();/* file opener */
  
! 	if (!(arc = fopen(arcname, OPEN_R))) {
  		if (chg) {
  			if (note)
  				printf("Creating new archive: %s\n", arcname);
***************
*** 45,51 ****
  		int inlen;
  		struct GDDSECT *region;
  
! 		region=gdinfo(arc->_fd);
  		inlen=region->GDINLEN;
  		buffer=malloc(inlen);
  		setbuf(arc, buffer);
--- 45,51 ----
  		int inlen;
  		struct GDDSECT *region;
  
! 		region=gdinfo(arc->_fd._fdub);
  		inlen=region->GDINLEN;
  		buffer=malloc(inlen);
  		setbuf(arc, buffer);
***************
*** 53,59 ****
  	}
  #endif
  	if (chg) {		/* if opening for changes */
! 		if (!(new = fopen(newname, "wb")))
  			abort("Cannot create archive copy: %s", newname);
  
  	changing = chg;		/* note if open for changes */
--- 53,59 ----
  	}
  #endif
  	if (chg) {		/* if opening for changes */
! 		if (!(new = fopen(newname, OPEN_W)))
  			abort("Cannot create archive copy: %s", newname);
  
  	changing = chg;		/* note if open for changes */
***************
*** 66,73 ****
  {
  	if (arc) {		/* if we had an initial archive */
  		fclose(arc);
- 		if (kludge)	/* kludge to update timestamp */
  #if	!MTS
  			setstamp(arcname, olddate, oldtime);
  #endif
  	}
--- 66,73 ----
  {
  	if (arc) {		/* if we had an initial archive */
  		fclose(arc);
  #if	!MTS
+ 		if (kludge)	/* kludge to update timestamp */
  			setstamp(arcname, olddate, oldtime);
  #endif
  	}
diff -c /usr2/polymnia/hyc/News/arc/marc.c arc/marc.c
*** /usr2/polymnia/hyc/News/arc/marc.c	Wed Jul  6 02:27:53 1988
--- arc/marc.c	Fri Jul 22 14:59:11 1988
***************
*** 25,30 ****
--- 25,35 ----
  #include <stdio.h>
  #include "arc.h"
  
+ #if	UNIX
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #endif
+ 
  FILE *src;			       /* source archive */
  char srcname[STRLEN];		       /* source archive name */
  
***************
*** 46,52 ****
--- 51,61 ----
      void exitpause();
  #endif
      int n;			       /* index */
+ #if	UNIX
+     struct	stat	sbuf;
+ #endif
  
+ 
      if(nargs<3)
      {	 printf("MARC - Archive merger, Version 5.21, created on 04/22/87 at 15:05:10\n");
  /*	 printf("(C) COPYRIGHT 1985,86,87 by System Enhancement Associates;");
***************
*** 96,102 ****
  			arctemp[n] = CUTOFF;
  	}
  #if	!MSDOS
! 	strcat(arctemp, mktemp("AXXXXXX"));
  #else
  	strcat(arctemp, "$ARCTEMP");
  #endif
--- 105,117 ----
  			arctemp[n] = CUTOFF;
  	}
  #if	!MSDOS
! 	{
! 		static char tempname[] = "AXXXXXX";
! #if     UNIX
! 		strcpy(arctemp, "/tmp/");
! #endif  /*UNIX*/
! 		strcat(arctemp, mktemp(tempname));
! 	}
  #else
  	strcat(arctemp, "$ARCTEMP");
  #endif
***************
*** 109,127 ****
  	arctemp[0] = tmpchr[0];
  #endif
  
!     makefnam(arg[1],".arc",arcname);   /* fix up archive names */
!     makefnam(arg[2],".arc",srcname);
  /*	makefnam(".$$$",arcname,newname);*/
  	sprintf(newname,"%s.arc",arctemp);
- 
- #if	!UNIX
-     upper(arcname); upper(srcname); upper(newname);
  #endif
  
!     arc = fopen(arcname,"rb");	       /* open the archives */
!     if(!(src=fopen(srcname,"rb")))
  	 abort("Cannot read source archive %s",srcname);
!     if(!(new=fopen(newname,"wb")))
  	 abort("Cannot create new archive %s",newname);
  
      if(!arc)
--- 124,149 ----
  	arctemp[0] = tmpchr[0];
  #endif
  
! #if	UNIX
! 	if (!stat(arg[1],&sbuf))
! 		strcpy(arcname,arg[1]);
! 	else
! 		makefnam(arg[1],".arc",arcname);
! 	if (!stat(arg[2],&sbuf))
! 		strcpy(srcname,arg[2]);
! 	else
! 		makefnam(arg[2],".arc",srcname);
! #else
!     makefnam(arg[1],".ARC",arcname);   /* fix up archive names */
!     makefnam(arg[2],".ARC",srcname);
  /*	makefnam(".$$$",arcname,newname);*/
  	sprintf(newname,"%s.arc",arctemp);
  #endif
  
!     arc = fopen(arcname,OPEN_R);	       /* open the archives */
!     if(!(src=fopen(srcname,OPEN_R)))
  	 abort("Cannot read source archive %s",srcname);
!     if(!(new=fopen(newname,OPEN_W)))
  	 abort("Cannot create new archive %s",newname);
  
      if(!arc)
