Unpack files with #.
[rsc] --rw-rw-r-- M 484762 glenda sys 22101 Dec 18 07:04 sys/src/cmd/tar.c
/n/sourcesdump/2005/1218/plan9/sys/src/cmd/tar.c:634,643 -
/n/sourcesdump/2005/1219/plan9/sys/src/cmd/tar.c:634,653
ulong blksleft, blksread;
Hdr *hbp;
Dir *dir;
+ String *name = nil;
+ if (shortf[0] == '#') {
+ name = s_new();
+ s_append(name, "./");
+ s_append(name, shortf);
+ shortf = s_to_c(name);
+ }
+
fd = open(shortf, OREAD);
if (fd < 0) {
fprint(2, "%s: can't open %s: %r\n", argv0, file);
+ if (name)
+ s_free(name);
return;
}
dir = dirfstat(fd);
/n/sourcesdump/2005/1218/plan9/sys/src/cmd/tar.c:650,655 -
/n/sourcesdump/2005/1219/plan9/sys/src/cmd/tar.c:660,667
putbackblk(ar);
free(dir);
close(fd);
+ if (name)
+ s_free(name);
return;
}
putblk(ar);
/n/sourcesdump/2005/1218/plan9/sys/src/cmd/tar.c:679,684 -
/n/sourcesdump/2005/1219/plan9/sys/src/cmd/tar.c:691,698
if (verbose)
fprint(2, "%s\n", file);
}
+ if (name)
+ s_free(name);
}
static char *
/n/sourcesdump/2005/1218/plan9/sys/src/cmd/tar.c:783,789 -
/n/sourcesdump/2005/1219/plan9/sys/src/cmd/tar.c:797,803
{
int len;
static char *last;
-
+
/*
* Always print about files. Only print about directories
* we haven't printed about. (Assumes archive is ordered
/n/sourcesdump/2005/1218/plan9/sys/src/cmd/tar.c:805,811 -
/n/sourcesdump/2005/1219/plan9/sys/src/cmd/tar.c:819,825
}
fprint(2, "%s: can't create %s: %r\n", argv0, s);
}
-
+
static int
makedir(char *s)
{
/n/sourcesdump/2005/1218/plan9/sys/src/cmd/tar.c:826,832 -
/n/sourcesdump/2005/1219/plan9/sys/src/cmd/tar.c:840,846
{
int err;
char *p;
-
+
p = s;
err = 0;
while (!err && (p = strchr(p+1, '/')) != nil) {
|