diff options
author | Marco S Hyman <marc@cvs.openbsd.org> | 1998-10-13 23:09:55 +0000 |
---|---|---|
committer | Marco S Hyman <marc@cvs.openbsd.org> | 1998-10-13 23:09:55 +0000 |
commit | 5151819038ae07cb40007b9af6f62b7a1233e1f8 (patch) | |
tree | 1da90b6e2032cccea62e8374ca25f7816dcd1948 /usr.sbin/pkg_install/add/main.c | |
parent | eb96b5bdfeaf891a861a757eab37a1348f1a030a (diff) |
Sync with recent NetBSD changes:
- use snprintf in place of sprintf
- code cleanup
- Package -> package_t, PackingList -> plist_t
Also: remove files that haven't been linked in a while
Pass -q to mtree so it is quiet in the presence of symlinks
Diffstat (limited to 'usr.sbin/pkg_install/add/main.c')
-rw-r--r-- | usr.sbin/pkg_install/add/main.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c index 9ee9284d359..42f8d2d20f6 100644 --- a/usr.sbin/pkg_install/add/main.c +++ b/usr.sbin/pkg_install/add/main.c @@ -1,7 +1,7 @@ -/* $OpenBSD: main.c,v 1.8 1998/09/07 22:30:13 marc Exp $ */ +/* $OpenBSD: main.c,v 1.9 1998/10/13 23:09:49 marc Exp $ */ #ifndef lint -static char *rcsid = "$OpenBSD: main.c,v 1.8 1998/09/07 22:30:13 marc Exp $"; +static char *rcsid = "$OpenBSD: main.c,v 1.9 1998/10/13 23:09:49 marc Exp $"; #endif /* @@ -122,9 +122,19 @@ main(int argc, char **argv) else if (isURL(*argv)) /* preserve URLs */ pkgs[ch] = strcpy(pkgnames[ch], *argv); else { /* expand all pathnames to fullnames */ + char *s; + if (fexists(*argv)) /* refers to a file directly */ pkgs[ch] = realpath(*argv, pkgnames[ch]); - else { /* look for the file in the expected places */ + else if (ispkgpattern(*argv) + && (s=findbestmatchingname(dirname_of(*argv), + basename_of(*argv))) > 0) { + if (Verbose) + printf("Using %s for %s\n",s, *argv); + + pkgs[ch] = realpath(s, pkgnames[ch]); + } else { + /* look for the file(pattern) in the expected places */ if (!(cp = fileFindByPath(NULL, *argv))) warnx("can't find package '%s'", *argv); else |