diff options
author | jkh <jkh@FreeBSD.org> | 1996-03-12 06:12:43 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1996-03-12 06:12:43 +0000 |
commit | 48236277c1f77ddd9cda6e7eb41539473aeb3cac (patch) | |
tree | 6fffba09e8c18c06746d8341febb872dbc4b0867 /usr.sbin/pkg_install/lib/file.c | |
parent | 0ac561df4815ac33db6c810777c626ea7458d1e0 (diff) | |
download | FreeBSD-src-48236277c1f77ddd9cda6e7eb41539473aeb3cac.zip FreeBSD-src-48236277c1f77ddd9cda6e7eb41539473aeb3cac.tar.gz |
Fix a couple of miscellaneous bugs and make pkg_add also support reading
from stdin.
Diffstat (limited to 'usr.sbin/pkg_install/lib/file.c')
-rw-r--r-- | usr.sbin/pkg_install/lib/file.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/usr.sbin/pkg_install/lib/file.c b/usr.sbin/pkg_install/lib/file.c index bddebab..19ce013 100644 --- a/usr.sbin/pkg_install/lib/file.c +++ b/usr.sbin/pkg_install/lib/file.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: file.c,v 1.19 1995/11/12 04:55:38 jkh Exp $"; +static const char *rcsid = "$Id: file.c,v 1.20 1996/02/19 02:35:56 mpp Exp $"; #endif /* @@ -432,17 +432,21 @@ unpack(char *pkg, char *flist) { char args[10], suffix[80], *cp; + args[0] = '\0'; /* * Figure out by a crude heuristic whether this or not this is probably * compressed. */ - args[0] = '\0'; - cp = rindex(pkg, '.'); - if (cp) { - strcpy(suffix, cp + 1); - if (index(suffix, 'z') || index(suffix, 'Z')) - strcpy(args, "-z"); + if (strcmp(pkg, "-")) { + cp = rindex(pkg, '.'); + if (cp) { + strcpy(suffix, cp + 1); + if (index(suffix, 'z') || index(suffix, 'Z')) + strcpy(args, "-z"); + } } + else + strcpy(args, "z"); strcat(args, "xpf"); if (vsystem("tar %s %s %s", args, pkg, flist ? flist : "")) { whinge("Tar extract of %s failed!", pkg); |