ARC 5.21 Patch #3
Howard Chu
hyc at math.lsa.umich.edu
Thu Nov 17 08:59:31 AEST 1988
Howdy again... Just in case you've forgotten, there have actually been
4 other patches posted, numbered 1, 1b, 2, and 2b. Just for the sake of
self-consistency, even though this is the 5th patch I've posted, I'm
calling it number 3....
Just minor changes to 4 files:
Makefile - add a macro for SYS V users to make compiling easier. (no biggie.)
arc.c - tweak the Unix code that checks for existence of an archive name.
arcadd.c - remove skip'ed filenames from list of files. (Otherwise arc m
might delete a file that you skipped...)
arcpack.c - fixed a comment that was hiding an fflush().
Ok... feed this article to patch...
## Patch for Makefile
*** /tmp/,RCSt1a13128 Wed Nov 16 17:42:31 1988
--- Makefile Tue Nov 1 02:38:42 1988
***************
*** 40,50 ****
# tmclock is only needed on Unix systems...
TMCLOCK = tmclock.o
OBJS = arc.o arcadd.o arccode.o arccvt.o arcdata.o arcdel.o arcdos.o \
arcext.o arcio.o arclst.o arclzw.o arcmatch.o arcpack.o arcrun.o \
! arcsq.o arcsqs.o arcsvc.o arctst.o arcunp.o arcusq.o arcmisc.o
! MOBJ = marc.o arcdata.o arcdos.o arcio.o arcmatch.o arcmisc.o
arc$(PROG): $(OBJS) $(TMCLOCK)
$(CC) -o arc$(PROG) $(OBJS) $(TMCLOCK)
--- 40,54 ----
# tmclock is only needed on Unix systems...
TMCLOCK = tmclock.o
+ # Files needed for System V
+ #SYSVOBJ = getwd.o rename.o scandir.o utimes.o
+ SYSVOBJ =
+
OBJS = arc.o arcadd.o arccode.o arccvt.o arcdata.o arcdel.o arcdos.o \
arcext.o arcio.o arclst.o arclzw.o arcmatch.o arcpack.o arcrun.o \
! arcsq.o arcsqs.o arcsvc.o arctst.o arcunp.o arcusq.o arcmisc.o $(SYSVOBJ)
! MOBJ = marc.o arcdata.o arcdos.o arcio.o arcmatch.o arcmisc.o $(SYSVOBJ)
arc$(PROG): $(OBJS) $(TMCLOCK)
$(CC) -o arc$(PROG) $(OBJS) $(TMCLOCK)
## Patch for arc.c
*** /tmp/,RCSt1a12207 Wed Nov 16 17:24:45 1988
--- arc.c Fri Nov 11 15:33:07 1988
***************
*** 1,5 ****
/*
! * $Header: arc.c,v 1.12 88/07/31 18:39:50 hyc Exp $
*/
/* ARC - Archive utility
--- 1,5 ----
/*
! * $Header: arc.c,v 1.13 88/11/01 02:22:23 hyc Exp $
*/
/* ARC - Archive utility
***************
*** 241,249 ****
/* 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);
--- 241,252 ----
/* create archive names, supplying defaults */
#if UNIX
! if (!stat(arg[2],&sbuf)) {
! if ((sbuf.st_mode & S_IFMT) == S_IFDIR)
! makefnam(arg[2],".arc",arcname);
! else
! strcpy(arcname,arg[2]);
! } else
makefnam(arg[2],".arc",arcname);
#else
makefnam(arg[2], ".ARC", arcname);
## Patch for arcadd.c
*** /tmp/,RCSt1a13187 Wed Nov 16 17:44:51 1988
--- arcadd.c Wed Nov 16 17:39:59 1988
***************
*** 1,5 ****
/*
! * $Header: arcadd.c,v 1.9 88/07/31 18:45:14 hyc Exp $
*/
/*
--- 1,5 ----
/*
! * $Header: arcadd.c,v 1.10 88/11/16 17:43:25 hyc Exp $
*/
/*
***************
*** 21,27 ****
#include <mts.h>
#endif
! static void addfile();
char *strcpy();
int strcmp(), strlen(), free(), readhdr(), unlink();
#if UNIX
--- 21,27 ----
#include <mts.h>
#endif
! static int addfile();
char *strcpy();
int strcmp(), strlen(), free(), readhdr(), unlink();
#if UNIX
***************
*** 192,199 ****
}
openarc(1); /* open archive for changes */
! for (n = 0; n < nfiles; n++) /* add each file in the list */
! addfile(path[n], name[n], update, fresh);
/* now we must copy over all files that follow our additions */
--- 192,208 ----
}
openarc(1); /* open archive for changes */
! for (n = 0; n < nfiles;) { /* add each file in the list */
! if (addfile(path[n], name[n], update, fresh) < 0) {
! free(path[n]); /* remove this name if */
! free(name[n]); /* it wasn't added */
! for (m = n; m < nfiles-1 ; m++) {
! path[m] = path[m+1];
! name[m] = name[m+1];
! }
! nfiles--;
! } else n++;
! }
/* now we must copy over all files that follow our additions */
***************
*** 217,223 ****
return nfiles; /* say how many were added */
}
! static void
addfile(path, name, update, fresh) /* add named file to archive */
char *path; /* path name of file to add */
char *name; /* name of file to add */
--- 226,232 ----
return nfiles; /* say how many were added */
}
! static int
addfile(path, name, update, fresh) /* add named file to archive */
char *path; /* path name of file to add */
char *name; /* name of file to add */
***************
*** 244,250 ****
printf("Cannot read file: %s\n", path);
nerrs++;
}
! return;
}
#if !DOS
if (strlen(name) >= FNLEN) {
--- 253,259 ----
printf("Cannot read file: %s\n", path);
nerrs++;
}
! return(-1);
}
#if !DOS
if (strlen(name) >= FNLEN) {
***************
*** 263,269 ****
if (*buf == 'N') {
printf("Skipping...\n");
fclose(f);
! return;
}
}
else {
--- 272,278 ----
if (*buf == 'N') {
printf("Skipping...\n");
fclose(f);
! return(-1);
}
}
else {
***************
*** 271,277 ****
printf("Skipping file: %s - name too long.\n",
name);
fclose(f);
! return;
}
}
#endif
--- 280,286 ----
printf("Skipping file: %s - name too long.\n",
name);
fclose(f);
! return(-1);
}
}
#endif
***************
*** 310,316 ****
|| (nhdr.date == ohdr.date && nhdr.time <= ohdr.time)) {
fseek(arc, starts, 0);
fclose(f);
! return; /* skip if not newer */
}
}
}
--- 319,325 ----
|| (nhdr.date == ohdr.date && nhdr.time <= ohdr.time)) {
fseek(arc, starts, 0);
fclose(f);
! return(0);/* skip if !newer */
}
}
}
***************
*** 332,338 ****
} else if (fresh) { /* else if freshening */
fseek(arc, starts, 0); /* then do not add files */
fclose(f);
! return;
} else { /* else adding a new file */
if (note) {
printf("Adding file: %-12s ", name);
--- 341,347 ----
} else if (fresh) { /* else if freshening */
fseek(arc, starts, 0); /* then do not add files */
fclose(f);
! return(0);
} else { /* else adding a new file */
if (note) {
printf("Adding file: %-12s ", name);
***************
*** 343,349 ****
} else { /* no existing archive */
if (fresh) { /* cannot freshen nothing */
fclose(f);
! return;
} else if (note) { /* else adding a file */
printf("Adding file: %-12s ", name);
fflush(stdout);
--- 352,358 ----
} else { /* no existing archive */
if (fresh) { /* cannot freshen nothing */
fclose(f);
! return(0);
} else if (note) { /* else adding a file */
printf("Adding file: %-12s ", name);
fflush(stdout);
***************
*** 358,361 ****
--- 367,371 ----
writehdr(&nhdr, new); /* write out real header */
fseek(new, nhdr.size, 1); /* skip over data to next header */
fclose(f); /* all done with the file */
+ return(0);
}
## Patch for arcpack.c
*** /tmp/,RCSt1a12196 Wed Nov 16 17:20:57 1988
--- arcpack.c Wed Nov 16 17:14:27 1988
***************
*** 1,5 ****
/*
! * $Header: arcpack.c,v 1.11 88/07/31 18:52:08 hyc Exp $
*/
/* ARC - Archive utility - ARCPACK
--- 1,5 ----
/*
! * $Header: arcpack.c,v 1.12 88/11/16 17:18:06 hyc Exp $
*/
/* ARC - Archive utility - ARCPACK
***************
*** 129,136 ****
hdr->length = hdr->size = stdlen;
} else if (ncrlen < lzwlen && ncrlen < huflen) {
if (note) {
! printf("packing, "); /* pack with repeat
! fflush(stdout); * suppression */
}
hdrver = 3; /* note packing method */
hdr->size = ncrlen; /* set data length */
--- 129,136 ----
hdr->length = hdr->size = stdlen;
} else if (ncrlen < lzwlen && ncrlen < huflen) {
if (note) {
! printf("packing, "); /* pack with repeat */
! fflush(stdout); /* suppression */
}
hdrver = 3; /* note packing method */
hdr->size = ncrlen; /* set data length */
--
/
/_ , ,_. Howard Chu
/ /(_/(__ University of Michigan
/ Computing Center College of LS&A
' Unix Project Information Systems
More information about the Comp.sources.bugs
mailing list