Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!sri-spam!sri-unix!hplabs!sdcrdcf!usc-oberon!castor.usc.edu!blarson From: blarson@castor.usc.edu (Bob Larson) Newsgroups: comp.sys.m6809 Subject: Re: AR archive program for OS9 Message-ID: <421@castor.usc.edu> Date: Mon, 12-Jan-87 00:55:44 EST Article-I.D.: castor.421 Posted: Mon Jan 12 00:55:44 1987 Date-Received: Wed, 14-Jan-87 00:43:44 EST References: <1005@chinet.UUCP> Reply-To: blarson@castor.usc.edu.UUCP (Bob Larson) Organization: USC AIS, Los Angeles Lines: 161 The archiver Ar posted here has a number of minor problems. Ar.doc and ar.man are identical except for the number of blank lines at the end, so one may safely be deleted. The makefile.68 contains some machine dependencies. The /d0 needs to be changed to /h0 or where ever you keep your cmds directory, and adding the line "CFLAGS = -t=/r0" speeds up compilation. The -i flag may be added to the linking line if disk space, memory space, and loading time are more of a consideration than running time. Of course, comments and blank lines will increase the readability. Compiling it gives numerous error messages, mostly dealing with possible portability problems. There realy is no reason for not doing the code as portably as possible, so the context diffs are below. *** ar.c.orig --- ar.c ************** *** 5,11 #include#include "ar.h" FN *fnhead = (FN *)NULL; char *hid = HID, --- 6,12 ----- #include #include "ar.h" + extern char *index(), *rindex(), *malloc(), *strcat(), *strcpy(); FN *fnhead = (FN *)NULL; ************** *** 6,12 #include "ar.h" FN *fnhead = (FN *)NULL; char *hid = HID, *suf = SUF; --- 8,14 ----- extern char *index(), *rindex(), *malloc(), *strcat(), *strcpy(); + FN *fnhead = (FN *)NULL; char *hid = HID, *suf = SUF; ************** *** 289,295 dirfd = opndir(*p ? p : "."); if (*p) *r++ = '/'; /* set up for append */ ! while ((dirp = nextdir(dirfd)) != -1) if (patmatch(q, strhcpy(r, dirp->dir_name), TRUE)) if ((strucmp(p, archfile)) != 0) /* not self */ found += stash_name(p); --- 291,297 ----- dirfd = opndir(*p ? p : "."); if (*p) *r++ = '/'; /* set up for append */ ! while ((dirp = nextdir(dirfd)) != (DIRENT *)NULL) if (patmatch(q, strhcpy(r, dirp->dir_name), TRUE)) if ((strucmp(p, archfile)) != 0) /* not self */ found += stash_name(p); ************** *** 311,317 char *p; { static FN *fnp; ! char *q; if (*p == '/') fatal(1, "absolute path illegal <%s>\n", p); --- 313,319 ----- char *p; { static FN *fnp; ! FN *q; if (*p == '/') fatal(1, "absolute path illegal <%s>\n", p); ************** *** 315,321 if (*p == '/') fatal(1, "absolute path illegal <%s>\n", p); ! q = emalloc(sizeof(FN) + strlen(p)); if (fnhead == (FN *)NULL) fnhead = fnp = q; else --- 317,323 ----- if (*p == '/') fatal(1, "absolute path illegal <%s>\n", p); ! q = (FN *)emalloc(sizeof(FN) + strlen(p)); if (fnhead == (FN *)NULL) fnhead = fnp = q; else *** arsup.c.orig --- arsup.c ************** *** 158,165 *p++ = v; } - - #include /* ** special strcmp to ignore case */ --- 158,163 ----- *p++ = v; } /* ** special strcmp to ignore case */ *** dir.c.orig --- dir.c ************** *** 2,8 #include "ar.h" /* ! ** open a directory, returning an fd or -1 */ int --- 2,8 ----- #include "ar.h" /* ! ** open a directory, returning an fd or NULL */ int ************** *** 27,33 do { if (read(fd, &dent, sizeof(dent)) <= 0) ! return (-1); } while ((c = dent.dir_name[0]) == 0 || (c & 0x7f) == '.'); return (&dent); } --- 27,33 ----- do { if (read(fd, &dent, sizeof(dent)) <= 0) ! return (DIRENT *)0; } while ((c = dent.dir_name[0]) == 0 || (c & 0x7f) == '.'); return (&dent); } -- Bob Larson Arpa: Blarson@Usc-Eclb.Arpa Uucp: (several backbone sites)!sdcrdcf!usc-oberon!castor.usc.edu!blarson seismo!cit-vax!usc-oberon!castor.usc.edu!blarson