[comp.bugs.4bsd] Tar

gww@beatnix.UUCP (Gary Winiger) (03/13/88)

Subject: Tar(1) cannot be positioned. +Fix:
Index:	bin/tar.c, man1/tar.1 4.3BSD

Description:
	When a tar(1) aborts for some reason, there is no way to 
	restart it from when it left off.
Repeat-By:
	Abort a tar x and try to restart it.
Fix:
	Elxsi has added a new flag to tar(1), -K.  K will skip an archive
	until the named file is found and then extract or list the remainder
	of the archive.  We found this to be quite useful when an extract from
	a large archive aborted.  We didn't have to reextract all the files
	that had already been extracted.

Enjoy.

Gary..
{ucbvax!sun,lll-lcc!lll-tis,amdahl!altos86,bridge2}!elxsi!gww

#	This is a shell archive.
#	Remove everything above and including the cut line.
#	Then run the rest of the file through sh.
-----cut here-----cut here-----cut here-----cut here-----
#!/bin/sh
# shar:	Shell Archiver
#	Run the following text with /bin/sh to create:
#	tar.c.diff
#	tar.1.diff
# This archive created: Thu Dec 18 18:01:33 1986
echo shar: extracting tar.c.diff '(1794 characters)'
sed 's/^XX//' << \SHAR_EOF > tar.c.diff
XX*** /tmp/,RCSt1002165	Thu Dec 18 17:47:28 1986
XX--- tar.c	Thu Dec 18 17:17:38 1986
XX***************
XX*** 1,5 ****
XX--- 1,8 ----
XX  /*
XX   * $Log:	tar.c,v $
XX+  * Revision 1.2  86/12/18  17:16:26  gww
XX+  * Add -K flag to start extracting (-x) or listing (-t) at the named file.
XX+  * 
XX   * Revision 1.1  86/12/17  18:14:47  gww
XX   * Initial revision
XX   * 
XX***************
XX*** 17,23 ****
XX  #endif not lint
XX  
XX  #ifndef lint
XX! static char *ERcsId = "$Header: tar.c,v 1.1 86/12/17 18:14:47 gww Exp $ ENIX BSD";
XX  static char sccsid[] = "@(#)tar.c	5.7 (Berkeley) 4/26/86";
XX  #endif not lint
XX  
XX--- 20,26 ----
XX  #endif not lint
XX  
XX  #ifndef lint
XX! static char *ERcsId = "$Header: tar.c,v 1.2 86/12/18 17:16:26 gww Exp $ ENIX BSD";
XX  static char sccsid[] = "@(#)tar.c	5.7 (Berkeley) 4/26/86";
XX  #endif not lint
XX  
XX***************
XX*** 85,90 ****
XX--- 88,95 ----
XX  int	hflag;
XX  int	Bflag;
XX  int	Fflag;
XX+ int	Kflag;	/* Start at the Named file.  Ie, skip all files up to, but */
XX+ 		/* not including the named file.  Get all files thereafter.*/
XX  
XX  int	mt;
XX  int	term;
XX***************
XX*** 244,249 ****
XX--- 249,258 ----
XX  			Fflag++;
XX  			break;
XX  
XX+ 		case 'K':
XX+ 			Kflag++;
XX+ 			break;
XX+ 
XX  		default:
XX  			fprintf(stderr, "tar: %c: unknown option\n", *cp);
XX  			usage();
XX***************
XX*** 1052,1059 ****
XX  	if (*argv == 0)
XX  		return (1);
XX  	for (cp = argv; *cp; cp++)
XX! 		if (prefix(*cp, dblock.dbuf.name))
XX  			return (1);
XX  	passtape();
XX  	return (0);
XX  }
XX--- 1061,1074 ----
XX  	if (*argv == 0)
XX  		return (1);
XX  	for (cp = argv; *cp; cp++)
XX! 		if (prefix(*cp, dblock.dbuf.name)) {
XX! 				if (Kflag)
XX! 				    /* Kflag means 'start' at the given */
XX! 				    /* file.  Now that we've found it   */
XX! 				    /* let 'er rip!			*/
XX! 				    *argv = 0;
XX  			return (1);
XX+ 		}
XX  	passtape();
XX  	return (0);
XX  }
SHAR_EOF
if test 1794 -ne "`wc -c tar.c.diff`"
then
echo shar: error transmitting tar.c.diff '(should have been 1794 characters)'
fi
echo shar: extracting tar.1.diff '(990 characters)'
sed 's/^XX//' << \SHAR_EOF > tar.1.diff
XX*** /tmp/,RCSt1002158	Thu Dec 18 17:46:51 1986
XX--- tar.1	Thu Dec 18 17:46:18 1986
XX***************
XX*** 1,6 ****
XX! .\"	$Header: tar.1,v 1.1 86/12/18 17:20:18 gww Exp $ ENIX BSD
XX  .\"
XX  .\" $Log:	tar.1,v $
XX  .\" Revision 1.1  86/12/18  17:20:18  gww
XX  .\" Initial revision
XX  .\" 
XX--- 1,9 ----
XX! .\"	$Header: tar.1,v 1.2 86/12/18 17:45:53 gww Exp $ ENIX BSD
XX  .\"
XX  .\" $Log:	tar.1,v $
XX+ .\" Revision 1.2  86/12/18  17:45:53  gww
XX+ .\" Add description of -K flag.
XX+ .\" 
XX  .\" Revision 1.1  86/12/18  17:20:18  gww
XX  .\" Initial revision
XX  .\" 
XX***************
XX*** 163,168 ****
XX--- 166,179 ----
XX  and from /etc, one might use
XX  .ti +0.5i
XX  tar c -C /usr include -C / etc
XX+ .TP 10
XX+ .B K
XX+ Forces
XX+ .I tar
XX+ to skip all files up to the first file named.
XX+ This file and all the files that follow on the archive are extracted
XX+ (key letter `x') or listed (key letter `t').
XX+ This option is useful for beginning in the middle of an archive.
XX  .PP
XX  Previous restrictions dealing with
XX  .IR tar 's
SHAR_EOF
if test 990 -ne "`wc -c tar.1.diff`"
then
echo shar: error transmitting tar.1.diff '(should have been 990 characters)'
fi
#	End of shell archive
exit 0