home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 28 / amigaformatcd28.iso / -seriously_amiga- / archivers / arcppc / src / patch1 < prev    next >
Text File  |  1998-04-23  |  51KB  |  1,942 lines

  1. Article 181 of comp.sources.bugs:
  2. Path: um-math!hyc
  3. From: hyc@math.lsa.umich.edu (Howard Chu)
  4. Newsgroups: comp.sources.bugs,comp.sources.d
  5. Subject: ARC 5.21 Patch #1
  6. Message-ID: <385@clio.math.lsa.umich.edu>
  7. Date: 31 Jul 88 23:39:05 GMT
  8. Sender: usenet@math.lsa.umich.edu
  9. Reply-To: hyc@math.lsa.umich.edu (Howard Chu)
  10. Organization: University of Michigan Math Dept., Ann Arbor
  11. Lines: 1925
  12. Xref: um-math comp.sources.bugs:181 comp.sources.d:451
  13. UUCP-Path: {mailrus,umix}!um-math!hyc
  14.  
  15. Ok, it's been a little longer than I expected, but here 'tis. There were very
  16. few real bugs, and a few more suggestions, and this reflects all changes from
  17. those suggestions...
  18.  
  19. A new copy of the Makefile is included - it's about half as long as the diffs
  20. would be. Make.tws is unchanged. New files for System V support are also in a
  21. shar file of their own. Some people had problems with the scandir.c posted in
  22. the previous release - this collection of files should fix things. For folk
  23. using SYSVR2, a rename() function is provided. (Thanks to Janet Walz for this
  24. one, as well as Rich Salz...)
  25.  
  26. Bugs found & fixed -
  27.     fopen() on various systems may or may not accept the 'b' (binary) flag
  28.     in the mode parameter, and may or may not ignore it. It's no longer
  29.     present when compiled on a Unix system. This seemed to only be a big
  30.     problem for Ultrix users, 1.2 & 2.2 inclusive.
  31.  
  32.     The pack routine would bomb with a divide by zero error after storing
  33.     a zero length file in an archive. Stupid oversight, fixed.
  34.  
  35.     The memset() routine was omitted, (it's in the library, right?) but
  36.     isn't part of the standard BSD library. It's back.
  37.  
  38. Other changes made -
  39. (Un*x)    Temp files will now be created in /tmp unless otherwise specified.
  40.     Archive files can have arbitrarily long names.
  41.     Filenames longer than 12 chars will be truncated, or the file will be
  42.     skipped, when adding to an archive. Behavior is modified by both the
  43.     Note and Warn option flags.
  44.     Now uses localtime() to parse file timestamps.
  45.  
  46. (GEMDOS) Can redirect stdout when invoked from GEM desktop
  47.     Accepts "*.*" as wildcard, as well as '*'
  48.  
  49. (MTS)    Fixed up handling of file buffers.
  50.  
  51. Compiled with GNU gcc on a Sun, Mark Williams C 3.0.6 on Atari ST, and C87
  52. on MTS. All of these are ANSI conformant compilers.
  53.  
  54. Thanks again to John Gilmore, Jon Zeeff, and everyone else who mailed me
  55. comments & bug reports & such. This should take care of 99% of the complaints.
  56.   }-)
  57.     Howard
  58.  
  59. #--------------------------------CUT HERE-------------------------------------
  60. #! /bin/sh
  61. #
  62. # This is a shell archive.  Save this into a file, edit it
  63. # and delete all lines above this comment.  Then give this
  64. # file to sh by executing the command "sh file".  The files
  65. # will be extracted into the current directory owned by
  66. # you with default permissions.
  67. #
  68. # The files contained herein are:
  69. #
  70. # -r--r--r--  1 hyc          3163 Jul 31 18:33 Makefile
  71. # -rw-r--r--  1 hyc          9367 Jul 22 16:30 Sysvarcstuf
  72. # -rw-r--r--  1 hyc         32469 Jul 31 18:58 patches
  73. #
  74. echo 'x - Makefile'
  75. if test -f Makefile; then echo 'shar: not overwriting Makefile'; else
  76. sed 's/^X//' << '________This_Is_The_END________' > Makefile
  77. X#
  78. X#       Makefile for Hack-attack 1.3
  79. X#       VAX 11/780 BSD4.2 "ARC" utility
  80. X#
  81. X# Originals from Dan Lanciani, James Turner, and others...
  82. X#
  83. X# Modified to support squashing, also added targets for the time routine
  84. X# library.  -- Howard Chu, hyc@umix.cc.umich.edu, 4-11-88
  85. X#
  86. X# Modified again by John Gilmore & Howard Chu, July 1988.
  87. X#
  88. X# I put SRCDIR on a real disk on the ST, but copy the makefile to a
  89. X# RAMdisk and compile from there. Makes things go a bit quicker...
  90. X# This has to be done in the shell, to get the trailing backslash
  91. X# specified correctly. e.g., setenv SRCDIR='d:\src\arc\'
  92. XSRCDIR = 
  93. X
  94. XHEADER = $(SRCDIR)arc.h $(SRCDIR)arcs.h
  95. X
  96. X# Add a ".TTP" suffix to the executable files on an ST.
  97. X#PROG = .ttp
  98. XPROG =
  99. X
  100. X# TWSLIB is only needed on Unix systems. Likewise for TWHEAD.
  101. X#TWSLIB =
  102. X#TWHEAD =
  103. XTWSLIB = libtws.a
  104. XTWHEAD = tws.h
  105. X
  106. X# For MWC 3.0 on the Atari ST, use:
  107. X#CFLAGS = -VCOMPAC -VPEEP
  108. XCFLAGS = -O
  109. X
  110. XOBJS = arc.o arcadd.o arccode.o arccvt.o arcdata.o arcdel.o arcdos.o \
  111. Xarcext.o arcio.o arclst.o arclzw.o arcmatch.o arcpack.o arcrun.o \
  112. Xarcsq.o arcsqs.o arcsvc.o arctst.o arcunp.o arcusq.o arcmisc.o
  113. X
  114. XMOBJ = marc.o arcdata.o arcdos.o arcio.o arcmatch.o arcmisc.o
  115. X
  116. Xarc$(PROG):    $(OBJS) $(TWSLIB)
  117. X    $(CC) -o arc$(PROG) $(OBJS) $(TWSLIB)
  118. X
  119. Xmarc$(PROG):    $(MOBJ) $(TWSLIB)
  120. X    $(CC) -o marc$(PROG) $(MOBJ) $(TWSLIB)
  121. X
  122. Xclean:
  123. X    -rm *.o arc$(PROG) marc$(PROG) $(TWSLIB)
  124. X
  125. Xarc.o:    $(SRCDIR)arc.c    $(HEADER)
  126. X    $(CC) $(CFLAGS) -c $(SRCDIR)arc.c
  127. Xmarc.o:    $(SRCDIR)marc.c    $(HEADER)
  128. X    $(CC) $(CFLAGS) -c $(SRCDIR)marc.c
  129. Xarcadd.o:    $(SRCDIR)arcadd.c    $(HEADER)
  130. X    $(CC) $(CFLAGS) -c $(SRCDIR)arcadd.c
  131. Xarccode.o:    $(SRCDIR)arccode.c    $(HEADER)
  132. X    $(CC) $(CFLAGS) -c $(SRCDIR)arccode.c
  133. Xarccvt.o:    $(SRCDIR)arccvt.c    $(HEADER)
  134. X    $(CC) $(CFLAGS) -c $(SRCDIR)arccvt.c
  135. Xarcdata.o:    $(SRCDIR)arcdata.c    $(HEADER)
  136. X    $(CC) $(CFLAGS) -c $(SRCDIR)arcdata.c
  137. Xarcdel.o:    $(SRCDIR)arcdel.c    $(HEADER)
  138. X    $(CC) $(CFLAGS) -c $(SRCDIR)arcdel.c
  139. Xarcdir.o:    $(SRCDIR)arcdir.c    $(HEADER)
  140. X    $(CC) $(CFLAGS) -c $(SRCDIR)arcdir.c
  141. Xarcdos.o:    $(SRCDIR)arcdos.c    $(HEADER) $(TWHEAD)
  142. X    $(CC) $(CFLAGS) -c $(SRCDIR)arcdos.c
  143. Xarcext.o:    $(SRCDIR)arcext.c    $(HEADER)
  144. X    $(CC) $(CFLAGS) -c $(SRCDIR)arcext.c
  145. Xarcio.o:    $(SRCDIR)arcio.c    $(HEADER)
  146. X    $(CC) $(CFLAGS) -c $(SRCDIR)arcio.c
  147. Xarclst.o:    $(SRCDIR)arclst.c    $(HEADER)
  148. X    $(CC) $(CFLAGS) -c $(SRCDIR)arclst.c
  149. Xarclzw.o:    $(SRCDIR)arclzw.c    $(HEADER)
  150. X    $(CC) $(CFLAGS) -c $(SRCDIR)arclzw.c
  151. Xarcmatch.o:    $(SRCDIR)arcmatch.c    $(HEADER)
  152. X    $(CC) $(CFLAGS) -c $(SRCDIR)arcmatch.c
  153. Xarcmisc.o:    $(SRCDIR)arcmisc.c    $(HEADER)
  154. X    $(CC) $(CFLAGS) -c $(SRCDIR)arcmisc.c
  155. Xarcpack.o:    $(SRCDIR)arcpack.c    $(HEADER)
  156. X    $(CC) $(CFLAGS) -c $(SRCDIR)arcpack.c
  157. Xarcrun.o:    $(SRCDIR)arcrun.c    $(HEADER)
  158. X    $(CC) $(CFLAGS) -c $(SRCDIR)arcrun.c
  159. Xarcsq.o:    $(SRCDIR)arcsq.c    $(HEADER)
  160. X    $(CC) $(CFLAGS) -c $(SRCDIR)arcsq.c
  161. Xarcsqs.o:    $(SRCDIR)arcsqs.c    $(HEADER)
  162. X    $(CC) $(CFLAGS) -c $(SRCDIR)arcsqs.c
  163. Xarcsvc.o:    $(SRCDIR)arcsvc.c    $(HEADER)
  164. X    $(CC) $(CFLAGS) -c $(SRCDIR)arcsvc.c
  165. Xarctst.o:    $(SRCDIR)arctst.c    $(HEADER)
  166. X    $(CC) $(CFLAGS) -c $(SRCDIR)arctst.c
  167. Xarcunp.o:    $(SRCDIR)arcunp.c    $(HEADER)
  168. X    $(CC) $(CFLAGS) -c $(SRCDIR)arcunp.c
  169. Xarcusq.o:    $(SRCDIR)arcusq.c    $(HEADER)
  170. X    $(CC) $(CFLAGS) -c $(SRCDIR)arcusq.c
  171. X
  172. Xlibtws.a:
  173. X    make -f Make.tws libtws.a
  174. ________This_Is_The_END________
  175. if test `wc -c < Makefile` -ne     3163; then
  176.     echo 'shar: Makefile was damaged during transit (should have been     3163 bytes)'
  177. fi
  178. fi        ; : end of overwriting check
  179. echo 'x - Sysvarcstuf'
  180. if test -f Sysvarcstuf; then echo 'shar: not overwriting Sysvarcstuf'; else
  181. sed 's/^X//' << '________This_Is_The_END________' > Sysvarcstuf
  182. X#--------------------------------CUT HERE-------------------------------------
  183. X#! /bin/sh
  184. X#
  185. X# This is a shell archive.  Save this into a file, edit it
  186. X# and delete all lines above this comment.  Then give this
  187. X# file to sh by executing the command "sh file".  The files
  188. X# will be extracted into the current directory owned by
  189. X# you with default permissions.
  190. X#
  191. X# The files contained herein are:
  192. X#
  193. X# -rw-r--r--  1 hyc           539 Jul 22 16:30 README
  194. X# -rw-r--r--  1 hyc           787 Jul 22 15:10 getwd.c
  195. X# -rw-r--r--  1 hyc           280 Jul 22 16:14 rename.c
  196. X# -rw-r--r--  1 hyc          2353 Jul 22 15:55 scandir.3
  197. X# -rw-r--r--  1 hyc          1875 Jul 22 15:55 scandir.c
  198. X# -rw-r--r--  1 hyc           397 Jul 22 15:10 utimes.c
  199. X#
  200. Xecho 'x - README'
  201. Xif test -f README; then echo 'shar: not overwriting README'; else
  202. Xsed 's/^X//' << '________This_Is_The_END________' > README
  203. XXThe enclosed files should be sufficient for bringing up ARC on a Sys V R3
  204. XXsystem. As Jon mentions, Doug Gwyn's directory routines are needed for
  205. XXSys V R2. The enclosed copy of scandir is new, as far as I can tell, and
  206. XXI've removed the (unneeded) ftw.? files. Also added a rename() routine,
  207. XXcourtesy of Janet Walz. (And an addition from Rich Salz.)
  208. XX
  209. XX[see comp.sources.unix, volume 9, for gwyn-dir-lib...]
  210. XX
  211. XXThanks again to Jon Zeeff, Janet Walz, and Rich Salz for their help.
  212. XX  -- Howard Chu
  213. XX    hyc@umix.cc.umich.edu
  214. XX    {uunet,rutgers}!umix!hyc
  215. X________This_Is_The_END________
  216. Xif test `wc -c < README` -ne      539; then
  217. X    echo 'shar: README was damaged during transit (should have been      539 bytes)'
  218. Xfi
  219. Xfi        ; : end of overwriting check
  220. Xecho 'x - getwd.c'
  221. Xif test -f getwd.c; then echo 'shar: not overwriting getwd.c'; else
  222. Xsed 's/^X//' << '________This_Is_The_END________' > getwd.c
  223. XX/*
  224. XX * 4.2bsd getwd simulation for Sys V.3
  225. XX */
  226. XX
  227. XX#include <stdio.h>
  228. XX
  229. XX#define SYSV3
  230. XX
  231. XX#define MAXWD 1024         /* limited by 4.2 getwd(2) */
  232. XX
  233. XX#ifdef SYSV3
  234. XX
  235. XXchar *getcwd();
  236. XX
  237. XXchar *
  238. XXgetwd(path)
  239. XXchar *path;
  240. XX{
  241. XX    return(getcwd(path,MAXWD));
  242. XX}
  243. XX
  244. XX#else
  245. XX
  246. XX/*
  247. XX * 4.2bsd getwd simulation for Sys V.2
  248. XX */
  249. XX
  250. XX#include <stdio.h>
  251. XX
  252. XX#define MAXWD 1024         /* limited by 4.2 getwd(2) */
  253. XX
  254. XXchar *
  255. XXgetwd(path)
  256. XXchar *path;
  257. XX{
  258. XX     char *nlp;
  259. XX     FILE *fp;
  260. XX     FILE *popen();
  261. XX     char *strrchr();
  262. XX
  263. XX    putenv("IFS= \t\n");
  264. XX     fp = popen("PATH=/bin:/usr/bin pwd", "r");
  265. XX     if (fp == NULL)
  266. XX         return 0;
  267. XX     if (fgets(path, MAXWD, fp) == NULL) {
  268. XX         (void) pclose(fp);
  269. XX         return 0;
  270. XX     }
  271. XX     if ((nlp = strrchr(path, '\n')) != NULL)
  272. XX         *nlp = '\0';
  273. XX     (void) pclose(fp);
  274. XX     return path;
  275. XX}
  276. XX#endif
  277. XX
  278. X________This_Is_The_END________
  279. Xif test `wc -c < getwd.c` -ne      787; then
  280. X    echo 'shar: getwd.c was damaged during transit (should have been      787 bytes)'
  281. Xfi
  282. Xfi        ; : end of overwriting check
  283. Xecho 'x - rename.c'
  284. Xif test -f rename.c; then echo 'shar: not overwriting rename.c'; else
  285. Xsed 's/^X//' << '________This_Is_The_END________' > rename.c
  286. XX/*
  287. XX * substitute for BSD/SVR3 rename() system call, from
  288. XX * Janet Walz, walz@mimsy.umd.edu & Rich Salz, rsalz@pineapple.bbn.com
  289. XX */
  290. XX
  291. XXint rename(oldname,newname)
  292. XXchar *oldname,*newname;
  293. XX{
  294. XX    (void)unlink(newname);
  295. XX    if(link(oldname,newname))
  296. XX        return(-1);
  297. XX    return(unlink(oldname));
  298. XX}
  299. X________This_Is_The_END________
  300. Xif test `wc -c < rename.c` -ne      280; then
  301. X    echo 'shar: rename.c was damaged during transit (should have been      280 bytes)'
  302. Xfi
  303. Xfi        ; : end of overwriting check
  304. Xecho 'x - scandir.3'
  305. Xif test -f scandir.3; then echo 'shar: not overwriting scandir.3'; else
  306. Xsed 's/^X//' << '________This_Is_The_END________' > scandir.3
  307. XX.TH SCANDIR 3
  308. XX.\" $Header: scandir.3,v 1.1 87/12/29 21:35:54 rsalz Exp $
  309. XX.SH NAME
  310. XXscandir, alphasort \- scan a directory
  311. XX.SH SYNOPSIS
  312. XX.nf
  313. XX.ft B
  314. XX#include <sys/types.h>
  315. XX#include <sys/dirent.h>
  316. XX
  317. XXint
  318. XXscandir(name, list, selector, sorter)
  319. XX.in +4n
  320. XXchar *name;
  321. XXstruct dirent ***list;
  322. XXint (*selector)();
  323. XXint (*sorter)();
  324. XX.in -4n
  325. XX
  326. XXint
  327. XXalphasort(d1, d2)
  328. XX.in +4n
  329. XXstruct dirent **d1;
  330. XXstruct dirent **d2;
  331. XX.in -4n
  332. XX.ft R
  333. XX.fi
  334. XX.SH DESCRIPTION
  335. XX.I Scandir
  336. XXreads the directory
  337. XX.I name
  338. XXand builds a NULL\-terminated array of pointers to the entries found
  339. XXin that directory.
  340. XXThis array is put into the location pointed to by the
  341. XX.I list
  342. XXparameter.
  343. XX.PP
  344. XXIf the
  345. XX.I selector
  346. XXparameter is non\-NULL, it is taken to be a pointer to a function called
  347. XXwith each entry, to determine whether or not it should be included in
  348. XXthe returned list.
  349. XXIf the parameter is NULL, all entries are included.
  350. XX.PP
  351. XXAs an added feature, the entries can be sorted (with
  352. XX.IR qsort (3))
  353. XXbefore the list is returned.
  354. XXIf the
  355. XX.I sorter
  356. XXparameter is non\-NULL, it is passed to qsort to use as the comparison
  357. XXfunction.
  358. XXThe
  359. XX.I alphasort
  360. XXroutine is provided to sort the array alphabetically.
  361. XX.PP
  362. XXThe array pointed to by
  363. XX.I list
  364. XXand the items it points to are all space obtained through
  365. XX.IR malloc (3),
  366. XXand their storage can be reclaimed as shown in the example below.
  367. XX.SH "EXAMPLE"
  368. XXHere is a small
  369. XX.IR ls (1)\-like
  370. XXprogram:
  371. XX.ne 50
  372. XX.RS
  373. XX.nf
  374. XX#include <stdio.h>
  375. XX#include <sys/types.h>
  376. XX#include <sys/stat.h>
  377. XX#include <sys/dir.h>
  378. XX
  379. XXextern int alphasort();
  380. XX
  381. XXstatic int
  382. XXfilesonly(e)
  383. XX    struct dirent *e;
  384. XX{
  385. XX    struct stat sb;
  386. XX
  387. XX    return(stat(e->d_name, &sb) >= 0 && (sb.st_mode & S_IFMT) == S_IFREG);
  388. XX}
  389. XX
  390. XXmain(ac, av)
  391. XX    int ac;
  392. XX    char *av[];
  393. XX{
  394. XX    register int i;
  395. XX    register int j;
  396. XX    struct dirent **list;
  397. XX
  398. XX    if (ac != 2) {
  399. XX        fprintf(stderr, "usage: %s dirname\n", av[0]);
  400. XX        exit(1);
  401. XX    }
  402. XX    if (chdir(av[1]) < 0) {
  403. XX        perror(av[1]);
  404. XX        exit(1);
  405. XX    }
  406. XX    if ((i = scandir(".", &list, filesonly, alphasort)) < 0) {
  407. XX        perror("Error reading directory");
  408. XX        exit(1);
  409. XX    }
  410. XX    for (j = 0; j < i; j++)
  411. XX        printf("%s\n", list[j]->d_name);
  412. XX    for (j = 0; j < i; j++)
  413. XX        free((char *)list[j]);
  414. XX    free((char *)list);
  415. XX    exit(0);
  416. XX}
  417. XX.fi
  418. XX.RE
  419. XX.SH "SEE ALSO"
  420. XXdirectory(3), qsort(3)
  421. XX.SH DIAGNOSTICS
  422. XXReturns the number of entries in the ``list,'' or \-1 if the directory
  423. XXcould not be opened or a memory allocation failed.
  424. XX.SH BUGS
  425. XXThe routine can be slightly wasteful of space.
  426. X________This_Is_The_END________
  427. Xif test `wc -c < scandir.3` -ne     2353; then
  428. X    echo 'shar: scandir.3 was damaged during transit (should have been     2353 bytes)'
  429. Xfi
  430. Xfi        ; : end of overwriting check
  431. Xecho 'x - scandir.c'
  432. Xif test -f scandir.c; then echo 'shar: not overwriting scandir.c'; else
  433. Xsed 's/^X//' << '________This_Is_The_END________' > scandir.c
  434. XX/*
  435. XX**  SCANDIR
  436. XX**  Scan a directory, collecting all (selected) items into a an array.
  437. XX*/
  438. XX#include <stdio.h>
  439. XX#include <sys/types.h>
  440. XX#include <dirent.h>
  441. XX
  442. XX#ifdef    RCSID
  443. XXstatic char RCS[] = "$Header: scandir.c,v 1.1 87/12/29 21:35:56 rsalz Exp $";
  444. XX#endif    /* RCSID */
  445. XX
  446. XX/* Initial guess at directory size. */
  447. XX#define INITIAL_SIZE    20
  448. XX
  449. XX/* A convenient shorthand. */
  450. XXtypedef struct dirent     ENTRY;
  451. XX        
  452. XX#define DIRSIZ(d) (sizeof(struct dirent) + strlen(d->d_name) + 1) 
  453. XX
  454. XX/* Linked in later. */
  455. XXextern char        *malloc();
  456. XXextern char        *realloc();
  457. XXextern char        *strcpy();
  458. XX
  459. XX
  460. XXint
  461. XXscandir(Name, List, Selector, Sorter)
  462. XX    char          *Name;
  463. XX    ENTRY        ***List;
  464. XX    int             (*Selector)();
  465. XX    int             (*Sorter)();
  466. XX{
  467. XX    register ENTRY     **names;
  468. XX    register ENTRY      *E;
  469. XX    register DIR      *Dp;
  470. XX    register int       i;
  471. XX    register int       size;
  472. XX
  473. XX    /* Get initial list space and open directory. */
  474. XX    size = INITIAL_SIZE;
  475. XX    if ((names = (ENTRY **)malloc(size * sizeof names[0])) == NULL
  476. XX     || (Dp = opendir(Name)) == NULL)
  477. XX    return(-1);
  478. XX
  479. XX    /* Read entries in the directory. */
  480. XX    for (i = 0; E = readdir(Dp); )
  481. XX    if (Selector == NULL || (*Selector)(E)) {
  482. XX        /* User wants them all, or he wants this one. */
  483. XX        if (++i >= size) {
  484. XX        size <<= 1;
  485. XX        names = (ENTRY **)realloc((char *)names, size * sizeof names[0]);
  486. XX        if (names == NULL) {
  487. XX            closedir(Dp);
  488. XX            return(-1);
  489. XX        }
  490. XX        }
  491. XX
  492. XX        /* Copy the entry. */
  493. XX        if ((names[i - 1] = (ENTRY *)malloc(DIRSIZ(E))) == NULL) { 
  494. XX        closedir(Dp);
  495. XX        return(-1);
  496. XX        }
  497. XX        names[i - 1]->d_ino = E->d_ino;
  498. XX        names[i - 1]->d_reclen = E->d_reclen;
  499. XX     /*   names[i - 1]->d_namlen = E->d_namlen; */
  500. XX        (void)strcpy(names[i - 1]->d_name, E->d_name);
  501. XX    }
  502. XX
  503. XX    /* Close things off. */
  504. XX    names[i] = NULL;
  505. XX    *List = names;
  506. XX    closedir(Dp);
  507. XX
  508. XX    /* Sort? */
  509. XX    if (i && Sorter)
  510. XX    qsort((char *)names, i, sizeof names[0], Sorter);
  511. XX
  512. XX    return(i);
  513. XX}
  514. X________This_Is_The_END________
  515. Xif test `wc -c < scandir.c` -ne     1875; then
  516. X    echo 'shar: scandir.c was damaged during transit (should have been     1875 bytes)'
  517. Xfi
  518. Xfi        ; : end of overwriting check
  519. Xecho 'x - utimes.c'
  520. Xif test -f utimes.c; then echo 'shar: not overwriting utimes.c'; else
  521. Xsed 's/^X//' << '________This_Is_The_END________' > utimes.c
  522. XX
  523. XX/* bsd utimes emulation for Sys V */
  524. XX/* by Jon Zeeff */
  525. XX
  526. XX#include <sys/types.h>
  527. XX
  528. XXstruct utimbuf {
  529. XX     time_t  actime;
  530. XX     time_t  modtime;
  531. XX};
  532. XX
  533. XXstruct timeval {
  534. XX     long    tv_sec;
  535. XX     long    tv_usec;
  536. XX};
  537. XX
  538. XXutimes(path,tvp)
  539. XXchar *path;
  540. XXstruct timeval tvp[2];
  541. XX{
  542. XX
  543. XXstruct utimbuf times;
  544. XX
  545. XXtimes.actime = (time_t) tvp[0].tv_sec;
  546. XXtimes.modtime = (time_t) tvp[1].tv_sec;
  547. XX
  548. XXreturn utime(path,times);
  549. XX
  550. XX}
  551. X________This_Is_The_END________
  552. Xif test `wc -c < utimes.c` -ne      397; then
  553. X    echo 'shar: utimes.c was damaged during transit (should have been      397 bytes)'
  554. Xfi
  555. Xfi        ; : end of overwriting check
  556. Xexit 0
  557. ________This_Is_The_END________
  558. if test `wc -c < Sysvarcstuf` -ne     9367; then
  559.     echo 'shar: Sysvarcstuf was damaged during transit (should have been     9367 bytes)'
  560. fi
  561. fi        ; : end of overwriting check
  562. echo 'x - patches'
  563. if test -f patches; then echo 'shar: not overwriting patches'; else
  564. sed 's/^X//' << '________This_Is_The_END________' > patches
  565. Xdiff -c /usr2/polymnia/hyc/News/arc/Make.tws arc/Make.tws
  566. X*** /usr2/polymnia/hyc/News/arc/Make.tws    Wed Jul  6 02:26:14 1988
  567. X--- arc/Make.tws    Sun Jul 31 18:29:28 1988
  568. X***************
  569. X*** 22,33 ****
  570. X  
  571. X  libtws.a:    dtime.o dtimep.o lexstring.o
  572. X          ar r libtws.a dtime.o dtimep.o lexstring.o
  573. X! # The following amusing bullshit makes sure that ranlib
  574. X! # gets executed if it is present, no matter which shell
  575. X! # make uses.  If there's a better way to do this, someone
  576. X! # please tell me!
  577. X!         -if test -r /usr/bin/ranlib ; then ranlib libtws.a ; fi
  578. X!         -if ( -r /usr/bin/ranlib ) ranlib libtws.a
  579. X  
  580. X  dtime.o:    dtime.c tws.h
  581. X  
  582. X--- 22,29 ----
  583. X  
  584. X  libtws.a:    dtime.o dtimep.o lexstring.o
  585. X          ar r libtws.a dtime.o dtimep.o lexstring.o
  586. X! #Hope it goes, but no big deal if not. -- hyc
  587. X!         -ranlib libtws.a
  588. X  
  589. X  dtime.o:    dtime.c tws.h
  590. X  
  591. Xdiff -c /usr2/polymnia/hyc/News/arc/arc.c arc/arc.c
  592. X*** /usr2/polymnia/hyc/News/arc/arc.c    Wed Jul  6 02:26:55 1988
  593. X--- arc/arc.c    Sun Jul 31 18:43:40 1988
  594. X***************
  595. X*** 1,5 ****
  596. X  /*
  597. X!  * $Header: arc.c,v 1.10 88/06/17 15:22:48 hyc Locked $
  598. X   */
  599. X  
  600. X  /*  ARC - Archive utility
  601. X--- 1,5 ----
  602. X  /*
  603. X!  * $Header: arc.c,v 1.12 88/07/31 18:39:50 hyc Exp $
  604. X   */
  605. X  
  606. X  /*  ARC - Archive utility
  607. X***************
  608. X*** 73,88 ****
  609. X  #include <stdio.h>
  610. X  #include "arc.h"
  611. X  
  612. X  int        strlen();
  613. X  void        addarc(), delarc(), extarc(), lstarc(), tstarc(), cvtarc(), runarc();
  614. X  void        abort();
  615. X  #if    MTS
  616. X  void        etoa();
  617. X  #endif
  618. X  #if    GEMDOS
  619. X! long        _stksize = 24576;
  620. X  #endif
  621. X  char        *strcpy(), *strcat();
  622. X  
  623. X  static char   **lst;        /* files list */
  624. X  static int    lnum;        /* length of files list */
  625. X--- 73,95 ----
  626. X  #include <stdio.h>
  627. X  #include "arc.h"
  628. X  
  629. X+ #if    UNIX
  630. X+ #include <sys/types.h>
  631. X+ #include <sys/stat.h>
  632. X+ #endif
  633. X+ 
  634. X  int        strlen();
  635. X  void        addarc(), delarc(), extarc(), lstarc(), tstarc(), cvtarc(), runarc();
  636. X  void        abort();
  637. X+ static    void    expandlst();
  638. X  #if    MTS
  639. X  void        etoa();
  640. X  #endif
  641. X  #if    GEMDOS
  642. X! long        _stksize = 65536L;
  643. X  #endif
  644. X  char        *strcpy(), *strcat();
  645. X+ char        *makefnam();    /* filename fixup routine */
  646. X  
  647. X  static char   **lst;        /* files list */
  648. X  static int    lnum;        /* length of files list */
  649. X***************
  650. X*** 93,99 ****
  651. X  {
  652. X      char        opt = 0;/* selected action */
  653. X      char           *a;    /* option pointer */
  654. X-     char           *makefnam();    /* filename fixup routine */
  655. X      void        upper();/* case conversion routine */
  656. X      char           *index();/* string index utility */
  657. X      char           *envfind();    /* environment searcher */
  658. X--- 100,105 ----
  659. X***************
  660. X*** 101,111 ****
  661. X--- 107,121 ----
  662. X      char           *arctemp2, *calloc(), *mktemp();
  663. X  #if    GEMDOS
  664. X      void        exitpause();
  665. X+     int        append;
  666. X  #endif
  667. X  #if    MTS
  668. X      fortran void    guinfo();
  669. X      char        gotinf[4];
  670. X  #endif
  671. X+ #if    UNIX
  672. X+     struct    stat    sbuf;
  673. X+ #endif
  674. X  
  675. X      if (num < 3) {
  676. X          printf("ARC - Archive utility, Version 5.21, created on 04/22/87 at 15:05:21\n");
  677. X***************
  678. X*** 198,207 ****
  679. X          if (arctemp[n - 1] != CUTOFF)
  680. X              arctemp[n] = CUTOFF;
  681. X      }
  682. X  #if    !MSDOS
  683. X!     strcat(arctemp, mktemp("AXXXXXX"));
  684. X  #else
  685. X      strcat(arctemp, "$ARCTEMP");
  686. X  #endif
  687. X  #else
  688. X      guinfo("SHFSEP    ", gotinf);
  689. X--- 208,224 ----
  690. X          if (arctemp[n - 1] != CUTOFF)
  691. X              arctemp[n] = CUTOFF;
  692. X      }
  693. X+ #if    UNIX
  694. X+     else    strcpy(arctemp, "/tmp/");
  695. X+ #endif
  696. X  #if    !MSDOS
  697. X!     {
  698. X!         static char tempname[] = "AXXXXXX";
  699. X!         strcat(arctemp, mktemp(tempname));
  700. X!     }
  701. X  #else
  702. X      strcat(arctemp, "$ARCTEMP");
  703. X+     arctemp2 = NULL;
  704. X  #endif
  705. X  #else
  706. X      guinfo("SHFSEP    ", gotinf);
  707. X***************
  708. X*** 223,229 ****
  709. X  #endif
  710. X  
  711. X      /* create archive names, supplying defaults */
  712. X!     makefnam(arg[2], ".arc", arcname);
  713. X      /* makefnam(".$$$",arcname,newname); */
  714. X      sprintf(newname, "%s.arc", arctemp);
  715. X      makefnam(".BAK", arcname, bakname);
  716. X--- 240,253 ----
  717. X  #endif
  718. X  
  719. X      /* create archive names, supplying defaults */
  720. X! #if    UNIX
  721. X!     if (!stat(arg[2],&sbuf))
  722. X!         strcpy(arcname,arg[2]);
  723. X!     else
  724. X!         makefnam(arg[2],".arc",arcname);
  725. X! #else
  726. X!     makefnam(arg[2], ".ARC", arcname);
  727. X! #endif
  728. X      /* makefnam(".$$$",arcname,newname); */
  729. X      sprintf(newname, "%s.arc", arctemp);
  730. X      makefnam(".BAK", arcname, bakname);
  731. X***************
  732. X*** 298,306 ****
  733. X--- 322,346 ----
  734. X      for (n = 0; n < lnum;) {/* expand indirect references */
  735. X          if (*lst[n] == '@')
  736. X              expandlst(n);
  737. X+ #if    GEMDOS        /* redirect stdout from the desktop...*/
  738. X+         else if (*lst[n] == '>') {
  739. X+             arctemp2 = (++lst[n]);
  740. X+             lst[n] = lst[lnum-1];    /* delete this entry */
  741. X+             lnum--;
  742. X+             if (arctemp2[0] == '>') {
  743. X+                 append = 1;
  744. X+                 arctemp2++;
  745. X+             }
  746. X+             else    append = 0;
  747. X+         }
  748. X+ #endif
  749. X          else
  750. X              n++;
  751. X      }
  752. X+ #if    GEMDOS
  753. X+     if (arctemp2)
  754. X+         freopen(arctemp2,append ? "a" : "w",stdout);
  755. X+ #endif
  756. X  
  757. X      /* act on whatever action command was given */
  758. X  
  759. X***************
  760. X*** 349,355 ****
  761. X  #endif
  762. X      return nerrs;
  763. X  }
  764. X! static
  765. X  expandlst(n)            /* expand an indirect reference */
  766. X      int        n;    /* number of entry to expand */
  767. X  {
  768. X--- 389,395 ----
  769. X  #endif
  770. X      return nerrs;
  771. X  }
  772. X! static    void
  773. X  expandlst(n)            /* expand an indirect reference */
  774. X      int        n;    /* number of entry to expand */
  775. X  {
  776. Xdiff -c /usr2/polymnia/hyc/News/arc/arc.h arc/arc.h
  777. X*** /usr2/polymnia/hyc/News/arc/arc.h    Wed Jul  6 02:26:56 1988
  778. X--- arc/arc.h    Sun Jul 31 18:45:33 1988
  779. X***************
  780. X*** 1,5 ****
  781. X  /*
  782. X!  * $Header: arc.h,v 1.7 88/06/01 17:51:06 hyc Locked $
  783. X   */
  784. X  
  785. X  #undef    MSDOS
  786. X--- 1,5 ----
  787. X  /*
  788. X!  * $Header: arc.h,v 1.9 88/07/31 18:43:18 hyc Exp $
  789. X   */
  790. X  
  791. X  #undef    MSDOS
  792. X***************
  793. X*** 27,32 ****
  794. X--- 27,34 ----
  795. X  #if    MSDOS || GEMDOS
  796. X  #define    DOS    1
  797. X  #define    CUTOFF    '\\'
  798. X+ #define    OPEN_R    "rb"
  799. X+ #define    OPEN_W    "wb"
  800. X  #endif
  801. X  
  802. X  #if    !MSDOS
  803. X***************
  804. X*** 37,53 ****
  805. X  #if    BSD || SYSV
  806. X  #define    UNIX    1
  807. X  #define    CUTOFF    '/'
  808. X  #include <ctype.h>
  809. X  #endif
  810. X  
  811. X  #if    MTS
  812. X! #define rindex strrchr
  813. X! #define index strchr
  814. X! #undef  USEGFINFO        /* define this to use GFINFO for directory */
  815. X! #define USECATSCAN        /* scanning, else use CATSCAN/FILEINFO... */
  816. X  #define    CUTOFF    sepchr[0]
  817. X  #endif
  818. X  
  819. X  /*  ARC - Archive utility - ARC Header
  820. X    
  821. X      Version 2.17, created on 04/22/87 at 13:09:43
  822. X--- 39,60 ----
  823. X  #if    BSD || SYSV
  824. X  #define    UNIX    1
  825. X  #define    CUTOFF    '/'
  826. X+ #define    OPEN_R    "r"
  827. X+ #define    OPEN_W    "w"
  828. X  #include <ctype.h>
  829. X  #endif
  830. X  
  831. X  #if    MTS
  832. X! #define    USEGFINFO    0    /* define this to use GFINFO for directory */
  833. X! #define    USECATSCAN    1    /* scanning, else use CATSCAN/FILEINFO... */
  834. X  #define    CUTOFF    sepchr[0]
  835. X  #endif
  836. X  
  837. X+ #if    MTS || SYSV
  838. X+ #define    rindex    strrchr
  839. X+ #define    index    strchr
  840. X+ #endif
  841. X+ 
  842. X  /*  ARC - Archive utility - ARC Header
  843. X    
  844. X      Version 2.17, created on 04/22/87 at 13:09:43
  845. X***************
  846. X*** 69,75 ****
  847. X  #define ARCVER 9        /* archive header version code   */
  848. X  #define STRLEN 100        /* system standard string length */
  849. X  #define FNLEN 13        /* file name length              */
  850. X! #define MAXARG 25        /* maximum number of arguments   */
  851. X  
  852. X  #ifndef DONT_DEFINE        /* Defined by arcdata.c */
  853. X  #include "arcs.h"
  854. X--- 76,82 ----
  855. X  #define ARCVER 9        /* archive header version code   */
  856. X  #define STRLEN 100        /* system standard string length */
  857. X  #define FNLEN 13        /* file name length              */
  858. X! #define MAXARG 400        /* maximum number of arguments   */
  859. X  
  860. X  #ifndef DONT_DEFINE        /* Defined by arcdata.c */
  861. X  #include "arcs.h"
  862. Xdiff -c /usr2/polymnia/hyc/News/arc/arcadd.c arc/arcadd.c
  863. X*** /usr2/polymnia/hyc/News/arc/arcadd.c    Wed Jul  6 02:26:57 1988
  864. X--- arc/arcadd.c    Sun Jul 31 18:47:27 1988
  865. X***************
  866. X*** 1,5 ****
  867. X  /*
  868. X!  * $Header: arcadd.c,v 1.8 88/06/13 00:31:15 hyc Locked $
  869. X   */
  870. X  
  871. X  /*
  872. X--- 1,5 ----
  873. X  /*
  874. X!  * $Header: arcadd.c,v 1.9 88/07/31 18:45:14 hyc Exp $
  875. X   */
  876. X  
  877. X  /*
  878. X***************
  879. X*** 231,237 ****
  880. X      int             upd = 0;/* true if replacing an entry */
  881. X  
  882. X  #if    !MTS
  883. X!     if (!(f = fopen(path, "rb")))
  884. X  #else
  885. X      if (image)
  886. X          f = fopen(path, "rb");
  887. X--- 231,237 ----
  888. X      int             upd = 0;/* true if replacing an entry */
  889. X  
  890. X  #if    !MTS
  891. X!     if (!(f = fopen(path, OPEN_R)))
  892. X  #else
  893. X      if (image)
  894. X          f = fopen(path, "rb");
  895. X***************
  896. X*** 246,251 ****
  897. X--- 246,280 ----
  898. X          }
  899. X          return;
  900. X      }
  901. X+ #if    !DOS
  902. X+     if (strlen(name) >= FNLEN) {
  903. X+         if (warn) {
  904. X+             char    buf[STRLEN];
  905. X+             printf("WARNING: File %s name too long!\n", name);
  906. X+             name[FNLEN-1]='\0';
  907. X+             while(1) {
  908. X+                 printf("  Truncate to %s (y/n)? ", name);
  909. X+                 fflush(stdout);
  910. X+                 fgets(buf, STRLEN, stdin);
  911. X+                 *buf = toupper(*buf);
  912. X+                 if (*buf == 'Y' || *buf == 'N')
  913. X+                     break;
  914. X+             }
  915. X+             if (*buf == 'N') {
  916. X+                 printf("Skipping...\n");
  917. X+                 fclose(f);
  918. X+                 return;
  919. X+             }
  920. X+         }
  921. X+         else {
  922. X+             if (note)
  923. X+                 printf("Skipping file: %s - name too long.\n",
  924. X+                     name);
  925. X+             fclose(f);
  926. X+             return;
  927. X+         }
  928. X+     }
  929. X+ #endif
  930. X      strcpy(nhdr.name, name);/* save name */
  931. X      nhdr.size = 0;        /* clear out size storage */
  932. X      nhdr.crc = 0;        /* clear out CRC check storage */
  933. X***************
  934. X*** 257,269 ****
  935. X      int    inlen;
  936. X      struct    GDDSECT    *region;
  937. X  
  938. X!     region=gdinfo(f->_fd);
  939. X      inlen=region->GDINLEN;
  940. X!     buffer=malloc(inlen);   /* maximum line length */
  941. X      setbuf(f,buffer);        
  942. X      f->_bufsiz=inlen;        
  943. X!     f->_mods|=0x00040000;   /* Don't do "$continue with" */
  944. X!     f->_mods&=0xfff7ffff;   /* turn it off, if set... */
  945. X      }
  946. X      getstamp(path, &nhdr.date, &nhdr.time);
  947. X  #endif
  948. X--- 286,298 ----
  949. X      int    inlen;
  950. X      struct    GDDSECT    *region;
  951. X  
  952. X!     region=gdinfo(f->_fd._fdub);
  953. X      inlen=region->GDINLEN;
  954. X!     buffer=malloc(inlen);    /* maximum line length */
  955. X      setbuf(f,buffer);        
  956. X      f->_bufsiz=inlen;        
  957. X!     f->_mods|=_NOIC;    /* Don't do "$continue with" */
  958. X!     f->_mods&=~_IC;        /* turn it off, if set... */
  959. X      }
  960. X      getstamp(path, &nhdr.date, &nhdr.time);
  961. X  #endif
  962. X***************
  963. X*** 325,331 ****
  964. X      hdrver = ARCVER;        /* anything but end marker */
  965. X      writehdr(&nhdr, new);    /* write out header skeleton */
  966. X      pack(f, new, &nhdr);    /* pack file into archive */
  967. X-     strcpy(nhdr.name, name);
  968. X      fseek(new, starts, 0);    /* move back to header skeleton */
  969. X      writehdr(&nhdr, new);    /* write out real header */
  970. X      fseek(new, nhdr.size, 1);    /* skip over data to next header */
  971. X--- 354,359 ----
  972. Xdiff -c /usr2/polymnia/hyc/News/arc/arcdata.c arc/arcdata.c
  973. X*** /usr2/polymnia/hyc/News/arc/arcdata.c    Wed Jul  6 02:26:59 1988
  974. X--- arc/arcdata.c    Sun Jul 31 18:48:38 1988
  975. X***************
  976. X*** 1,5 ****
  977. X  /*
  978. X!  * $Header: arcdata.c,v 1.6 88/06/01 19:17:58 hyc Locked $
  979. X   */
  980. X  
  981. X  /*  ARC - Archive utility - ARCDATA
  982. X--- 1,5 ----
  983. X  /*
  984. X!  * $Header: arcdata.c,v 1.7 88/07/31 18:47:22 hyc Exp $
  985. X   */
  986. X  
  987. X  /*  ARC - Archive utility - ARCDATA
  988. Xdiff -c /usr2/polymnia/hyc/News/arc/arcdos.c arc/arcdos.c
  989. X*** /usr2/polymnia/hyc/News/arc/arcdos.c    Wed Jul  6 02:27:00 1988
  990. X--- arc/arcdos.c    Sun Jul 31 18:49:42 1988
  991. X***************
  992. X*** 1,5 ****
  993. X  /*
  994. X!  * $Header: arcdos.c,v 1.5 88/06/13 00:40:49 hyc Locked $
  995. X   */
  996. X  
  997. X  /*
  998. X--- 1,5 ----
  999. X  /*
  1000. X!  * $Header: arcdos.c,v 1.6 88/07/31 18:48:09 hyc Exp $
  1001. X   */
  1002. X  
  1003. X  /*
  1004. X***************
  1005. X*** 35,40 ****
  1006. X--- 35,41 ----
  1007. X  #endif
  1008. X  
  1009. X  #if    SYSV
  1010. X+ #include <sys/times.h>
  1011. X  struct timeval {
  1012. X      long tv_sec;
  1013. X      long tv_usec;
  1014. X***************
  1015. X*** 78,100 ****
  1016. X      *time = ret[0];
  1017. X  #endif
  1018. X  #if    UNIX
  1019. X!     char           *ctime();
  1020. X!     struct stat    *buf;
  1021. X!     int             day, hr, min, sec, yr, imon;
  1022. X!     static char     mon[4], *mons[12] = {
  1023. X!                    "Jan", "Feb", "Mar", "Apr", "May", "Jun",
  1024. X!                     "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
  1025. X!     };
  1026. X  
  1027. X!     buf = (struct stat *) malloc(sizeof(struct stat));
  1028. X!     fstat(fileno(f), buf);
  1029. X! 
  1030. X!     sscanf(ctime(&(buf->st_mtime)), "%*4s%3s%d%d:%d:%d%d", mon, &day, &hr, &min,
  1031. X!            &sec, &yr);
  1032. X!     for (imon = 0; imon < 12 && strcmp(mon, mons[imon]); imon++);
  1033. X! 
  1034. X!     *date = (unsigned short) (((yr - 1980) << 9) + ((imon + 1) << 5) + day);
  1035. X!     *time = (unsigned short) ((hr << 11) + (min << 5) + sec / 2);
  1036. X  #endif
  1037. X  #if    MTS
  1038. X      fortran         timein(),
  1039. X--- 79,93 ----
  1040. X      *time = ret[0];
  1041. X  #endif
  1042. X  #if    UNIX
  1043. X!     struct stat    buf;
  1044. X!     struct tm    *localtime(), *t;
  1045. X  
  1046. X!     fstat(fileno(f), &buf);
  1047. X!     t=localtime(&(buf.st_mtime));
  1048. X!     *date = (unsigned short) (((t->tm_year - 80) << 9) +
  1049. X!                 ((t->tm_mon + 1) << 5) + t->tm_mday);
  1050. X!     *time = (unsigned short) ((t->tm_hour << 11) +
  1051. X!                 (t->tm_min << 5) + t->tm_sec / 2);
  1052. X  #endif
  1053. X  #if    MTS
  1054. X      fortran         timein(),
  1055. Xdiff -c /usr2/polymnia/hyc/News/arc/arcext.c arc/arcext.c
  1056. X*** /usr2/polymnia/hyc/News/arc/arcext.c    Wed Jul  6 02:27:01 1988
  1057. X--- arc/arcext.c    Fri Jul 22 14:53:29 1988
  1058. X***************
  1059. X*** 155,161 ****
  1060. X          }
  1061. X      }
  1062. X  #if    !MTS
  1063. X!     if (!(f = fopen(fix, "wb")))
  1064. X  #else
  1065. X      {
  1066. X          fortran         create();
  1067. X--- 155,161 ----
  1068. X          }
  1069. X      }
  1070. X  #if    !MTS
  1071. X!     if (!(f = fopen(fix, OPEN_W)))
  1072. X  #else
  1073. X      {
  1074. X          fortran         create();
  1075. Xdiff -c /usr2/polymnia/hyc/News/arc/arcio.c arc/arcio.c
  1076. X*** /usr2/polymnia/hyc/News/arc/arcio.c    Wed Jul  6 02:27:02 1988
  1077. X--- arc/arcio.c    Sun Jul 31 18:50:20 1988
  1078. X***************
  1079. X*** 1,5 ****
  1080. X  /*
  1081. X!  * $Header: arcio.c,v 1.7 88/06/02 16:27:32 hyc Locked $
  1082. X   */
  1083. X  
  1084. X  /*  ARC - Archive utility - ARCIO
  1085. X--- 1,5 ----
  1086. X  /*
  1087. X!  * $Header: arcio.c,v 1.9 88/07/31 18:49:19 hyc Exp $
  1088. X   */
  1089. X  
  1090. X  /*  ARC - Archive utility - ARCIO
  1091. X***************
  1092. X*** 102,112 ****
  1093. X  #if    MTS
  1094. X      (void) atoe(hdr->name, strlen(hdr->name));
  1095. X  #endif
  1096. X!     for (i = 0; i<4; hdr->size<<=8, hdr->size += dummy[16-i], i++);
  1097. X      hdr->date = (short) ((dummy[18] << 8) + dummy[17]);
  1098. X      hdr->time = (short) ((dummy[20] << 8) + dummy[19]);
  1099. X      hdr->crc = (short) ((dummy[22] << 8) + dummy[21]);
  1100. X!     for (i = 0; i<4; hdr->length<<=8, hdr->length += dummy[26-i], i++);
  1101. X  #endif
  1102. X  
  1103. X      if (hdr->date > olddate
  1104. X--- 102,112 ----
  1105. X  #if    MTS
  1106. X      (void) atoe(hdr->name, strlen(hdr->name));
  1107. X  #endif
  1108. X!     for (i = 0, hdr->size=0; i<4; hdr->size<<=8, hdr->size += dummy[16-i], i++);
  1109. X      hdr->date = (short) ((dummy[18] << 8) + dummy[17]);
  1110. X      hdr->time = (short) ((dummy[20] << 8) + dummy[19]);
  1111. X      hdr->crc = (short) ((dummy[22] << 8) + dummy[21]);
  1112. X!     for (i = 0, hdr->length=0; i<4; hdr->length<<=8, hdr->length += dummy[26-i], i++);
  1113. X  #endif
  1114. X  
  1115. X      if (hdr->date > olddate
  1116. X***************
  1117. X*** 175,187 ****
  1118. X      FILE           *t;    /* file to write to */
  1119. X  {
  1120. X      c &= 0xff;
  1121. X!     if (t)
  1122. X  #if    UNIX
  1123. X          fputc(c, t);
  1124. X  #else
  1125. X          if (fputc(c, t) == EOF)
  1126. X              abort("Write fail (disk full?)");
  1127. X  #endif
  1128. X  }
  1129. X  
  1130. X  /*
  1131. X--- 175,190 ----
  1132. X      FILE           *t;    /* file to write to */
  1133. X  {
  1134. X      c &= 0xff;
  1135. X!     if (t) {
  1136. X  #if    UNIX
  1137. X          fputc(c, t);
  1138. X+         if (ferror(t))
  1139. X+             abort("Write failed");
  1140. X  #else
  1141. X          if (fputc(c, t) == EOF)
  1142. X              abort("Write fail (disk full?)");
  1143. X  #endif
  1144. X+     }
  1145. X  }
  1146. X  
  1147. X  /*
  1148. Xdiff -c /usr2/polymnia/hyc/News/arc/arclzw.c arc/arclzw.c
  1149. X*** /usr2/polymnia/hyc/News/arc/arclzw.c    Wed Jul  6 02:27:19 1988
  1150. X--- arc/arclzw.c    Sun Jul 31 18:50:49 1988
  1151. X***************
  1152. X*** 1,5 ****
  1153. X  /*
  1154. X!  * $Header: arclzw.c,v 1.4 88/06/01 16:27:59 hyc Locked $
  1155. X   */
  1156. X  
  1157. X  /*
  1158. X--- 1,5 ----
  1159. X  /*
  1160. X!  * $Header: arclzw.c,v 1.6 88/07/31 18:49:49 hyc Exp $
  1161. X   */
  1162. X  
  1163. X  /*
  1164. X***************
  1165. X*** 59,65 ****
  1166. X      unsigned char   follower;    /* char following string */
  1167. X      unsigned short  next;    /* ptr to next in collision list */
  1168. X      unsigned short  predecessor;    /* code for preceeding string */
  1169. X! };            /* string_tab[TABSIZE];    /* the code string table */
  1170. X  
  1171. X  
  1172. X  /* definitions for the new dynamic Lempel-Zev crunching */
  1173. X--- 59,65 ----
  1174. X      unsigned char   follower;    /* char following string */
  1175. X      unsigned short  next;    /* ptr to next in collision list */
  1176. X      unsigned short  predecessor;    /* code for preceeding string */
  1177. X! };            /* string_tab[TABSIZE];       the code string table */
  1178. X  
  1179. X  
  1180. X  /* definitions for the new dynamic Lempel-Zev crunching */
  1181. Xdiff -c /usr2/polymnia/hyc/News/arc/arcmatch.c arc/arcmatch.c
  1182. X*** /usr2/polymnia/hyc/News/arc/arcmatch.c    Wed Jul  6 02:27:20 1988
  1183. X--- arc/arcmatch.c    Sun Jul 31 18:51:22 1988
  1184. X***************
  1185. X*** 1,5 ****
  1186. X  /*
  1187. X!  * $Header: arcmatch.c,v 1.5 88/06/01 19:41:08 hyc Locked $
  1188. X   */
  1189. X  
  1190. X  /*
  1191. X--- 1,5 ----
  1192. X  /*
  1193. X!  * $Header: arcmatch.c,v 1.6 88/07/31 18:50:18 hyc Exp $
  1194. X   */
  1195. X  
  1196. X  /*
  1197. X***************
  1198. X*** 67,72 ****
  1199. X--- 67,77 ----
  1200. X      upper(t);        /* avoid case problems */
  1201. X  #endif    /* UNIX */
  1202. X  #if    GEMDOS
  1203. X+     char *strstr(), *i;    /* allow "*.*" to mean '*' */
  1204. X+     if (i=strstr(t,"*.*")) {
  1205. X+         i++;
  1206. X+         *i='\0';
  1207. X+     }
  1208. X      return(pnmatch(n, t, 0));
  1209. X  #else
  1210. X      /* first match name part */
  1211. Xdiff -c /usr2/polymnia/hyc/News/arc/arcmisc.c arc/arcmisc.c
  1212. X*** /usr2/polymnia/hyc/News/arc/arcmisc.c    Wed Jul  6 02:27:21 1988
  1213. X--- arc/arcmisc.c    Sun Jul 31 18:52:44 1988
  1214. X***************
  1215. X*** 1,6 ****
  1216. X  /*
  1217. X   * Miscellaneous routines to get ARC running on non-MSDOS systems...
  1218. X!  * $Header: arcmisc.c,v 1.7 88/06/12 19:23:13 hyc Locked $ 
  1219. X   */
  1220. X  
  1221. X  #include <stdio.h>
  1222. X--- 1,6 ----
  1223. X  /*
  1224. X   * Miscellaneous routines to get ARC running on non-MSDOS systems...
  1225. X!  * $Header: arcmisc.c,v 1.8 88/07/31 18:50:56 hyc Exp $ 
  1226. X   */
  1227. X  
  1228. X  #include <stdio.h>
  1229. X***************
  1230. X*** 55,61 ****
  1231. X  #include <sys/types.h>
  1232. X  #include <sys/dir.h>
  1233. X  #include <sys/stat.h>
  1234. X!     int    rename();
  1235. X  #endif
  1236. X  
  1237. X  #if    SYSV
  1238. X--- 55,61 ----
  1239. X  #include <sys/types.h>
  1240. X  #include <sys/dir.h>
  1241. X  #include <sys/stat.h>
  1242. X!     int    rename(), unlink();
  1243. X  #endif
  1244. X  
  1245. X  #if    SYSV
  1246. X***************
  1247. X*** 65,72 ****
  1248. X  #define DIRECT direct
  1249. X  #endif
  1250. X  
  1251. X  char           *strcpy(), *strcat(), *malloc();
  1252. X! int             strlen();
  1253. X  
  1254. X  int
  1255. X  move(oldnam, newnam)
  1256. X--- 65,85 ----
  1257. X  #define DIRECT direct
  1258. X  #endif
  1259. X  
  1260. X+ #if    BSD
  1261. X+ char    *
  1262. X+ memset(s, c, n)        /* oops. Thought it was standard BSD, but my Sun */
  1263. X+     char    *s;    /* fooled me again. -- hyc */
  1264. X+     int    c, n;
  1265. X+ {
  1266. X+     register int i;
  1267. X+     for(i=0;i<n;i++)
  1268. X+         s[i]=c;
  1269. X+     return(s);
  1270. X+ }
  1271. X+ #endif
  1272. X+ 
  1273. X  char           *strcpy(), *strcat(), *malloc();
  1274. X! int             strlen(), strcmp(), match();
  1275. X  
  1276. X  int
  1277. X  move(oldnam, newnam)
  1278. X***************
  1279. X*** 73,79 ****
  1280. X--- 86,94 ----
  1281. X      char           *oldnam, *newnam;
  1282. X  {
  1283. X      FILE           *fopen(), *old, *new;
  1284. X+ #if    !MTS
  1285. X      struct stat     oldstat;
  1286. X+ #endif
  1287. X      char           *strcpy();
  1288. X      void        filecopy();
  1289. X  #if    GEMDOS
  1290. X***************
  1291. X*** 81,99 ****
  1292. X  #else
  1293. X      if (rename(oldnam, newnam))
  1294. X  #endif
  1295. X      {
  1296. X          if (stat(oldnam, &oldstat))    /* different partition? */
  1297. X              return (-1);
  1298. X!         old = fopen(oldnam, "rb");
  1299. X          if (old == NULL)
  1300. X              return (-1);
  1301. X!         new = fopen(newnam, "wb");
  1302. X          if (new == NULL)
  1303. X              return (-1);
  1304. X          filecopy(old, new, oldstat.st_size);
  1305. X!         unlink(oldnam);
  1306. X      }
  1307. X      return 0;
  1308. X  }
  1309. X  
  1310. X  static void
  1311. X--- 96,118 ----
  1312. X  #else
  1313. X      if (rename(oldnam, newnam))
  1314. X  #endif
  1315. X+ #if    !MTS
  1316. X      {
  1317. X          if (stat(oldnam, &oldstat))    /* different partition? */
  1318. X              return (-1);
  1319. X!         old = fopen(oldnam, OPEN_R);
  1320. X          if (old == NULL)
  1321. X              return (-1);
  1322. X!         new = fopen(newnam, OPEN_W);
  1323. X          if (new == NULL)
  1324. X              return (-1);
  1325. X          filecopy(old, new, oldstat.st_size);
  1326. X!         return(unlink(oldnam));
  1327. X      }
  1328. X      return 0;
  1329. X+ #else
  1330. X+     return(-1);
  1331. X+ #endif
  1332. X  }
  1333. X  
  1334. X  static void
  1335. X***************
  1336. X*** 270,276 ****
  1337. X      int             alphasort();
  1338. X      int             scandir();
  1339. X  #endif                /* UNIX */
  1340. X!     int             fmatch();
  1341. X      static int      Nnum = 0, ii;
  1342. X      char        *rindex();
  1343. X  
  1344. X--- 289,295 ----
  1345. X      int             alphasort();
  1346. X      int             scandir();
  1347. X  #endif                /* UNIX */
  1348. X!     int             fmatch(), free();
  1349. X      static int      Nnum = 0, ii;
  1350. X      char        *rindex();
  1351. X  
  1352. Xdiff -c /usr2/polymnia/hyc/News/arc/arcpack.c arc/arcpack.c
  1353. X*** /usr2/polymnia/hyc/News/arc/arcpack.c    Wed Jul  6 02:27:22 1988
  1354. X--- arc/arcpack.c    Sun Jul 31 18:53:25 1988
  1355. X***************
  1356. X*** 1,5 ****
  1357. X  /*
  1358. X!  * $Header: arcpack.c,v 1.9 88/06/02 16:27:36 hyc Locked $
  1359. X   */
  1360. X  
  1361. X  /*  ARC - Archive utility - ARCPACK
  1362. X--- 1,5 ----
  1363. X  /*
  1364. X!  * $Header: arcpack.c,v 1.11 88/07/31 18:52:08 hyc Exp $
  1365. X   */
  1366. X  
  1367. X  /*  ARC - Archive utility - ARCPACK
  1368. X***************
  1369. X*** 24,30 ****
  1370. X  #endif
  1371. X  
  1372. X  void    setcode(), sqinit_cm(), sqputc_cm(), init_cm(), putc_cm();
  1373. X! void    filecopy(), abort(), putc_tst();
  1374. X  int    getch(), addcrc();
  1375. X  
  1376. X  /* stuff for non-repeat packing */
  1377. X--- 24,30 ----
  1378. X  #endif
  1379. X  
  1380. X  void    setcode(), sqinit_cm(), sqputc_cm(), init_cm(), putc_cm();
  1381. X! void    filecopy(), abort(), putc_tst(), init_sq(), scan_sq();
  1382. X  int    getch(), addcrc();
  1383. X  
  1384. X  /* stuff for non-repeat packing */
  1385. X***************
  1386. X*** 155,161 ****
  1387. X      /* standard cleanups common to all methods */
  1388. X  
  1389. X      if (note)
  1390. X!         printf("done. (%ld%%)\n",100L - (100L*hdr->size)/hdr->length);
  1391. X  }
  1392. X  
  1393. X  /*
  1394. X--- 155,162 ----
  1395. X      /* standard cleanups common to all methods */
  1396. X  
  1397. X      if (note)
  1398. X!         printf("done. (%ld%%)\n",hdr->length == 0 ?
  1399. X!                 0L : 100L - (100L*hdr->size)/hdr->length);
  1400. X  }
  1401. X  
  1402. X  /*
  1403. Xdiff -c /usr2/polymnia/hyc/News/arc/arcrun.c arc/arcrun.c
  1404. X*** /usr2/polymnia/hyc/News/arc/arcrun.c    Wed Jul  6 02:27:22 1988
  1405. X--- arc/arcrun.c    Sun Jul 31 18:53:59 1988
  1406. X***************
  1407. X*** 1,5 ****
  1408. X  /*
  1409. X!  * $Header: arcrun.c,v 1.3 88/06/01 19:57:16 hyc Locked $
  1410. X   */
  1411. X  
  1412. X  /*
  1413. X--- 1,5 ----
  1414. X  /*
  1415. X!  * $Header: arcrun.c,v 1.4 88/07/31 18:52:50 hyc Exp $
  1416. X   */
  1417. X  
  1418. X  /*
  1419. X***************
  1420. X*** 22,27 ****
  1421. X--- 22,29 ----
  1422. X  #include "arc.h"
  1423. X  
  1424. X  void    rempath(), openarc(), closearc(), abort();
  1425. X+ int    readhdr(), match(), unpack();
  1426. X+ static    void    runfile();
  1427. X  char    *strcat();
  1428. X  
  1429. X  void
  1430. X***************
  1431. X*** 33,39 ****
  1432. X      char           *makefnam();    /* filename fixer */
  1433. X      char            buf[STRLEN];    /* filename buffer */
  1434. X      FILE           *fopen();/* file opener */
  1435. X-     int             runfile();
  1436. X      char           *dummy[2];
  1437. X  
  1438. X      dummy[0]="dummy";
  1439. X--- 35,40 ----
  1440. X***************
  1441. X*** 56,62 ****
  1442. X      closearc(0);        /* close archive after changes */
  1443. X  }
  1444. X  
  1445. X! static          int
  1446. X  runfile(hdr, num, arg)        /* run a file */
  1447. X      struct heads   *hdr;    /* pointer to header data */
  1448. X      int             num;    /* number of arguments */
  1449. X--- 57,63 ----
  1450. X      closearc(0);        /* close archive after changes */
  1451. X  }
  1452. X  
  1453. X! static  void
  1454. X  runfile(hdr, num, arg)        /* run a file */
  1455. X      struct heads   *hdr;    /* pointer to header data */
  1456. X      int             num;    /* number of arguments */
  1457. X***************
  1458. X*** 120,126 ****
  1459. X      if (warn)
  1460. X          if (tmp = fopen(buf, "r"))
  1461. X              abort("Temporary file %s already exists", buf);
  1462. X!     if (!(tmp = fopen(buf, "wb")))
  1463. X          abort("Unable to create temporary file %s", buf);
  1464. X  
  1465. X      if (note)
  1466. X--- 121,127 ----
  1467. X      if (warn)
  1468. X          if (tmp = fopen(buf, "r"))
  1469. X              abort("Temporary file %s already exists", buf);
  1470. X!     if (!(tmp = fopen(buf, OPEN_W)))
  1471. X          abort("Unable to create temporary file %s", buf);
  1472. X  
  1473. X      if (note)
  1474. Xdiff -c /usr2/polymnia/hyc/News/arc/arcsq.c arc/arcsq.c
  1475. X*** /usr2/polymnia/hyc/News/arc/arcsq.c    Wed Jul  6 02:27:24 1988
  1476. X--- arc/arcsq.c    Sun Jul 31 18:54:48 1988
  1477. X***************
  1478. X*** 1,5 ****
  1479. X  /*
  1480. X!  * $Header: arcsq.c,v 1.2 88/06/02 16:27:38 hyc Locked $
  1481. X   */
  1482. X  
  1483. X  /*
  1484. X--- 1,5 ----
  1485. X  /*
  1486. X!  * $Header: arcsq.c,v 1.3 88/07/31 18:53:32 hyc Exp $
  1487. X   */
  1488. X  
  1489. X  /*
  1490. X***************
  1491. X*** 65,71 ****
  1492. X  static int      cbitsrem;    /* # of code string bits left */
  1493. X  static unsigned short ccode;    /* current code right justified */
  1494. X  
  1495. X! int 
  1496. X  init_sq()
  1497. X  {                /* prepare for scanning pass */
  1498. X      int             i;    /* node index */
  1499. X--- 65,73 ----
  1500. X  static int      cbitsrem;    /* # of code string bits left */
  1501. X  static unsigned short ccode;    /* current code right justified */
  1502. X  
  1503. X! static    void    scale(), heap(), adjust(), bld_tree(), init_enc(), put_int();
  1504. X! static    int    cmptrees(), buildenc(), maxchar();
  1505. X! void 
  1506. X  init_sq()
  1507. X  {                /* prepare for scanning pass */
  1508. X      int             i;    /* node index */
  1509. X***************
  1510. X*** 86,92 ****
  1511. X          valcount[i] = 0;
  1512. X  }
  1513. X  
  1514. X! int 
  1515. X  scan_sq(c)            /* add a byte to the tables */
  1516. X      int             c;    /* byte to add */
  1517. X  {
  1518. X--- 88,94 ----
  1519. X          valcount[i] = 0;
  1520. X  }
  1521. X  
  1522. X! void 
  1523. X  scan_sq(c)            /* add a byte to the tables */
  1524. X      int             c;    /* byte to add */
  1525. X  {
  1526. X***************
  1527. X*** 113,123 ****
  1528. X      unsigned short    ceiling;/* limit for scaling */
  1529. X      long            size = 0;    /* predicted size */
  1530. X      int             numnodes;    /* # of nodes in simplified tree */
  1531. X-     int             scale();
  1532. X-     int             heap();
  1533. X-     int             bld_tree();
  1534. X-     int             buildenc();
  1535. X-     int             init_enc();
  1536. X  
  1537. X      scan_sq(EOF);        /* signal end of input */
  1538. X  
  1539. X--- 115,120 ----
  1540. X***************
  1541. X*** 188,194 ****
  1542. X   * integer. Rescaling is used if necessary to limit the code length. 
  1543. X   */
  1544. X  
  1545. X! static int 
  1546. X  scale(ceil)
  1547. X      unsigned short    ceil;    /* upper limit on total weight */
  1548. X  {
  1549. X--- 185,191 ----
  1550. X   * integer. Rescaling is used if necessary to limit the code length. 
  1551. X   */
  1552. X  
  1553. X! static    void
  1554. X  scale(ceil)
  1555. X      unsigned short    ceil;    /* upper limit on total weight */
  1556. X  {
  1557. X***************
  1558. X*** 236,247 ****
  1559. X   * rescaling. 
  1560. X   */
  1561. X  
  1562. X! static int 
  1563. X  heap(list, length)
  1564. X      int             list[], length;
  1565. X  {
  1566. X      register int    i;
  1567. X-     int             adjust();
  1568. X  
  1569. X      for (i = (length - 2) / 2; i >= 0; --i)
  1570. X          adjust(list, i, length - 1);
  1571. X--- 233,243 ----
  1572. X   * rescaling. 
  1573. X   */
  1574. X  
  1575. X! static    void
  1576. X  heap(list, length)
  1577. X      int             list[], length;
  1578. X  {
  1579. X      register int    i;
  1580. X  
  1581. X      for (i = (length - 2) / 2; i >= 0; --i)
  1582. X          adjust(list, i, length - 1);
  1583. X***************
  1584. X*** 249,260 ****
  1585. X  
  1586. X  /* Make a heap from a heap with a new top */
  1587. X  
  1588. X! static int 
  1589. X  adjust(list, top, bottom)
  1590. X      int             list[], top, bottom;
  1591. X  {
  1592. X      register int    k, temp;
  1593. X-     int             cmptrees();
  1594. X  
  1595. X      k = 2 * top + 1;    /* left child of top */
  1596. X      temp = list[top];    /* remember root node of top tree */
  1597. X--- 245,255 ----
  1598. X  
  1599. X  /* Make a heap from a heap with a new top */
  1600. X  
  1601. X! static    void
  1602. X  adjust(list, top, bottom)
  1603. X      int             list[], top, bottom;
  1604. X  {
  1605. X      register int    k, temp;
  1606. X  
  1607. X      k = 2 * top + 1;    /* left child of top */
  1608. X      temp = list[top];    /* remember root node of top tree */
  1609. X***************
  1610. X*** 282,288 ****
  1611. X   * comparison rules in previous comments. 
  1612. X   */
  1613. X  
  1614. X! static int 
  1615. X  cmptrees(a, b)
  1616. X      int             a, b;    /* root nodes of trees */
  1617. X  {
  1618. X--- 277,283 ----
  1619. X   * comparison rules in previous comments. 
  1620. X   */
  1621. X  
  1622. X! static    int 
  1623. X  cmptrees(a, b)
  1624. X      int             a, b;    /* root nodes of trees */
  1625. X  {
  1626. X***************
  1627. X*** 308,314 ****
  1628. X   * element and reheaping the shorter list. 
  1629. X   */
  1630. X  
  1631. X! static int 
  1632. X  bld_tree(list, len)
  1633. X      int             list[];
  1634. X  int             len;
  1635. X--- 303,309 ----
  1636. X   * element and reheaping the shorter list. 
  1637. X   */
  1638. X  
  1639. X! static    void
  1640. X  bld_tree(list, len)
  1641. X      int             list[];
  1642. X  int             len;
  1643. X***************
  1644. X*** 316,322 ****
  1645. X      register int    freenode;    /* next free node in tree */
  1646. X      register struct nd *frnp;    /* free node pointer */
  1647. X      int             lch, rch;    /* temps for left, right children */
  1648. X-     int             maxchar();
  1649. X  
  1650. X      /*
  1651. X       * Initialize index to next available (non-leaf) node. Lower numbered
  1652. X--- 311,316 ----
  1653. X***************
  1654. X*** 365,371 ****
  1655. X      return a > b ? a : b;
  1656. X  }
  1657. X  
  1658. X! static int 
  1659. X  init_enc()
  1660. X  {
  1661. X      register int    i;
  1662. X--- 359,365 ----
  1663. X      return a > b ? a : b;
  1664. X  }
  1665. X  
  1666. X! static    void
  1667. X  init_enc()
  1668. X  {
  1669. X      register int    i;
  1670. X***************
  1671. X*** 421,431 ****
  1672. X      return NULL;        /* it worked if we reach here */
  1673. X  }
  1674. X  
  1675. X! static int 
  1676. X  put_int(n, f)            /* output an integer */
  1677. X      short        n;    /* integer to output */
  1678. X      FILE           *f;    /* file to put it to */
  1679. X  {
  1680. X      putc_pak(n & 0xff, f);    /* first the low byte */
  1681. X      putc_pak(n >> 8, f);    /* then the high byte */
  1682. X  }
  1683. X--- 415,427 ----
  1684. X      return NULL;        /* it worked if we reach here */
  1685. X  }
  1686. X  
  1687. X! static    void
  1688. X  put_int(n, f)            /* output an integer */
  1689. X      short        n;    /* integer to output */
  1690. X      FILE           *f;    /* file to put it to */
  1691. X  {
  1692. X+     void        putc_pak();
  1693. X+ 
  1694. X      putc_pak(n & 0xff, f);    /* first the low byte */
  1695. X      putc_pak(n >> 8, f);    /* then the high byte */
  1696. X  }
  1697. X***************
  1698. X*** 481,486 ****
  1699. X--- 477,483 ----
  1700. X  {
  1701. X      int             rbyte;    /* Result byte value */
  1702. X      int             need;    /* number of bits */
  1703. X+     int        getc_ncr();
  1704. X  
  1705. X      rbyte = 0;
  1706. X      need = 8;        /* build one byte per call */
  1707. Xdiff -c /usr2/polymnia/hyc/News/arc/arcsqs.c arc/arcsqs.c
  1708. X*** /usr2/polymnia/hyc/News/arc/arcsqs.c    Wed Jul  6 02:27:43 1988
  1709. X--- arc/arcsqs.c    Sun Jul 31 18:55:21 1988
  1710. X***************
  1711. X*** 1,5 ****
  1712. X  /*
  1713. X!  * $Header: arcsqs.c,v 1.2 88/06/01 16:31:39 hyc Locked $
  1714. X   */
  1715. X  
  1716. X  /*  ARC - Archive utility - SQUASH
  1717. X--- 1,5 ----
  1718. X  /*
  1719. X!  * $Header: arcsqs.c,v 1.3 88/07/31 18:54:14 hyc Exp $
  1720. X   */
  1721. X  
  1722. X  /*  ARC - Archive utility - SQUASH
  1723. X***************
  1724. X*** 12,18 ****
  1725. X  */
  1726. X  
  1727. X  /*
  1728. X!  * $Header: arcsqs.c,v 1.2 88/06/01 16:31:39 hyc Locked $
  1729. X   */
  1730. X  
  1731. X  #include <stdio.h>
  1732. X--- 12,18 ----
  1733. X  */
  1734. X  
  1735. X  /*
  1736. X!  * $Header: arcsqs.c,v 1.3 88/07/31 18:54:14 hyc Exp $
  1737. X   */
  1738. X  
  1739. X  #include <stdio.h>
  1740. Xdiff -c /usr2/polymnia/hyc/News/arc/arcsvc.c arc/arcsvc.c
  1741. X*** /usr2/polymnia/hyc/News/arc/arcsvc.c    Wed Jul  6 02:27:44 1988
  1742. X--- arc/arcsvc.c    Sun Jul 31 18:55:55 1988
  1743. X***************
  1744. X*** 1,5 ****
  1745. X  /*
  1746. X!  * $Header: arcsvc.c,v 1.8 88/06/13 00:42:59 hyc Locked $
  1747. X   */
  1748. X  
  1749. X  /*  ARC - Archive utility - ARCSVC
  1750. X--- 1,5 ----
  1751. X  /*
  1752. X!  * $Header: arcsvc.c,v 1.9 88/07/31 18:54:55 hyc Exp $
  1753. X   */
  1754. X  
  1755. X  /*  ARC - Archive utility - ARCSVC
  1756. X***************
  1757. X*** 31,37 ****
  1758. X  {
  1759. X      FILE           *fopen();/* file opener */
  1760. X  
  1761. X!     if (!(arc = fopen(arcname, "rb"))) {
  1762. X          if (chg) {
  1763. X              if (note)
  1764. X                  printf("Creating new archive: %s\n", arcname);
  1765. X--- 31,37 ----
  1766. X  {
  1767. X      FILE           *fopen();/* file opener */
  1768. X  
  1769. X!     if (!(arc = fopen(arcname, OPEN_R))) {
  1770. X          if (chg) {
  1771. X              if (note)
  1772. X                  printf("Creating new archive: %s\n", arcname);
  1773. X***************
  1774. X*** 45,51 ****
  1775. X          int inlen;
  1776. X          struct GDDSECT *region;
  1777. X  
  1778. X!         region=gdinfo(arc->_fd);
  1779. X          inlen=region->GDINLEN;
  1780. X          buffer=malloc(inlen);
  1781. X          setbuf(arc, buffer);
  1782. X--- 45,51 ----
  1783. X          int inlen;
  1784. X          struct GDDSECT *region;
  1785. X  
  1786. X!         region=gdinfo(arc->_fd._fdub);
  1787. X          inlen=region->GDINLEN;
  1788. X          buffer=malloc(inlen);
  1789. X          setbuf(arc, buffer);
  1790. X***************
  1791. X*** 53,59 ****
  1792. X      }
  1793. X  #endif
  1794. X      if (chg) {        /* if opening for changes */
  1795. X!         if (!(new = fopen(newname, "wb")))
  1796. X              abort("Cannot create archive copy: %s", newname);
  1797. X  
  1798. X      changing = chg;        /* note if open for changes */
  1799. X--- 53,59 ----
  1800. X      }
  1801. X  #endif
  1802. X      if (chg) {        /* if opening for changes */
  1803. X!         if (!(new = fopen(newname, OPEN_W)))
  1804. X              abort("Cannot create archive copy: %s", newname);
  1805. X  
  1806. X      changing = chg;        /* note if open for changes */
  1807. X***************
  1808. X*** 66,73 ****
  1809. X  {
  1810. X      if (arc) {        /* if we had an initial archive */
  1811. X          fclose(arc);
  1812. X-         if (kludge)    /* kludge to update timestamp */
  1813. X  #if    !MTS
  1814. X              setstamp(arcname, olddate, oldtime);
  1815. X  #endif
  1816. X      }
  1817. X--- 66,73 ----
  1818. X  {
  1819. X      if (arc) {        /* if we had an initial archive */
  1820. X          fclose(arc);
  1821. X  #if    !MTS
  1822. X+         if (kludge)    /* kludge to update timestamp */
  1823. X              setstamp(arcname, olddate, oldtime);
  1824. X  #endif
  1825. X      }
  1826. Xdiff -c /usr2/polymnia/hyc/News/arc/marc.c arc/marc.c
  1827. X*** /usr2/polymnia/hyc/News/arc/marc.c    Wed Jul  6 02:27:53 1988
  1828. X--- arc/marc.c    Fri Jul 22 14:59:11 1988
  1829. X***************
  1830. X*** 25,30 ****
  1831. X--- 25,35 ----
  1832. X  #include <stdio.h>
  1833. X  #include "arc.h"
  1834. X  
  1835. X+ #if    UNIX
  1836. X+ #include <sys/types.h>
  1837. X+ #include <sys/stat.h>
  1838. X+ #endif
  1839. X+ 
  1840. X  FILE *src;                   /* source archive */
  1841. X  char srcname[STRLEN];               /* source archive name */
  1842. X  
  1843. X***************
  1844. X*** 46,52 ****
  1845. X--- 51,61 ----
  1846. X      void exitpause();
  1847. X  #endif
  1848. X      int n;                   /* index */
  1849. X+ #if    UNIX
  1850. X+     struct    stat    sbuf;
  1851. X+ #endif
  1852. X  
  1853. X+ 
  1854. X      if(nargs<3)
  1855. X      {     printf("MARC - Archive merger, Version 5.21, created on 04/22/87 at 15:05:10\n");
  1856. X  /*     printf("(C) COPYRIGHT 1985,86,87 by System Enhancement Associates;");
  1857. X***************
  1858. X*** 96,102 ****
  1859. X              arctemp[n] = CUTOFF;
  1860. X      }
  1861. X  #if    !MSDOS
  1862. X!     strcat(arctemp, mktemp("AXXXXXX"));
  1863. X  #else
  1864. X      strcat(arctemp, "$ARCTEMP");
  1865. X  #endif
  1866. X--- 105,117 ----
  1867. X              arctemp[n] = CUTOFF;
  1868. X      }
  1869. X  #if    !MSDOS
  1870. X!     {
  1871. X!         static char tempname[] = "AXXXXXX";
  1872. X! #if     UNIX
  1873. X!         strcpy(arctemp, "/tmp/");
  1874. X! #endif  /*UNIX*/
  1875. X!         strcat(arctemp, mktemp(tempname));
  1876. X!     }
  1877. X  #else
  1878. X      strcat(arctemp, "$ARCTEMP");
  1879. X  #endif
  1880. X***************
  1881. X*** 109,127 ****
  1882. X      arctemp[0] = tmpchr[0];
  1883. X  #endif
  1884. X  
  1885. X!     makefnam(arg[1],".arc",arcname);   /* fix up archive names */
  1886. X!     makefnam(arg[2],".arc",srcname);
  1887. X  /*    makefnam(".$$$",arcname,newname);*/
  1888. X      sprintf(newname,"%s.arc",arctemp);
  1889. X- 
  1890. X- #if    !UNIX
  1891. X-     upper(arcname); upper(srcname); upper(newname);
  1892. X  #endif
  1893. X  
  1894. X!     arc = fopen(arcname,"rb");           /* open the archives */
  1895. X!     if(!(src=fopen(srcname,"rb")))
  1896. X       abort("Cannot read source archive %s",srcname);
  1897. X!     if(!(new=fopen(newname,"wb")))
  1898. X       abort("Cannot create new archive %s",newname);
  1899. X  
  1900. X      if(!arc)
  1901. X--- 124,149 ----
  1902. X      arctemp[0] = tmpchr[0];
  1903. X  #endif
  1904. X  
  1905. X! #if    UNIX
  1906. X!     if (!stat(arg[1],&sbuf))
  1907. X!         strcpy(arcname,arg[1]);
  1908. X!     else
  1909. X!         makefnam(arg[1],".arc",arcname);
  1910. X!     if (!stat(arg[2],&sbuf))
  1911. X!         strcpy(srcname,arg[2]);
  1912. X!     else
  1913. X!         makefnam(arg[2],".arc",srcname);
  1914. X! #else
  1915. X!     makefnam(arg[1],".ARC",arcname);   /* fix up archive names */
  1916. X!     makefnam(arg[2],".ARC",srcname);
  1917. X  /*    makefnam(".$$$",arcname,newname);*/
  1918. X      sprintf(newname,"%s.arc",arctemp);
  1919. X  #endif
  1920. X  
  1921. X!     arc = fopen(arcname,OPEN_R);           /* open the archives */
  1922. X!     if(!(src=fopen(srcname,OPEN_R)))
  1923. X       abort("Cannot read source archive %s",srcname);
  1924. X!     if(!(new=fopen(newname,OPEN_W)))
  1925. X       abort("Cannot create new archive %s",newname);
  1926. X  
  1927. X      if(!arc)
  1928. ________This_Is_The_END________
  1929. if test `wc -c < patches` -ne    32469; then
  1930.     echo 'shar: patches was damaged during transit (should have been    32469 bytes)'
  1931. fi
  1932. fi        ; : end of overwriting check
  1933. exit 0
  1934. --
  1935.   /
  1936.  /_ , ,_.                      Howard Chu
  1937. / /(_/(__                University of Michigan
  1938.     /           Computing Center          College of LS&A
  1939.    '              Unix Project          Information Systems
  1940.  
  1941.  
  1942.