Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/pkg_install/info Don't look for files at all unless...



details:   https://anonhg.NetBSD.org/src/rev/f65499638fe7
branches:  trunk
changeset: 570378:f65499638fe7
user:      erh <erh%NetBSD.org@localhost>
date:      Wed Oct 06 15:40:11 2004 +0000

description:
Don't look for files at all unless -. is specified.  Allows pkg_info to
work if there happens to be a uninstalled package present in the current
directory.

diffstat:

 usr.sbin/pkg_install/info/perform.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (53 lines):

diff -r 551cb9586965 -r f65499638fe7 usr.sbin/pkg_install/info/perform.c
--- a/usr.sbin/pkg_install/info/perform.c       Wed Oct 06 15:39:19 2004 +0000
+++ b/usr.sbin/pkg_install/info/perform.c       Wed Oct 06 15:40:11 2004 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: perform.c,v 1.55 2004/08/18 19:10:15 he Exp $  */
+/*     $NetBSD: perform.c,v 1.56 2004/10/06 15:40:11 erh Exp $ */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.23 1997/10/13 15:03:53 jkh Exp";
 #else
-__RCSID("$NetBSD: perform.c,v 1.55 2004/08/18 19:10:15 he Exp $");
+__RCSID("$NetBSD: perform.c,v 1.56 2004/10/06 15:40:11 erh Exp $");
 #endif
 #endif
 
@@ -58,7 +58,7 @@
                        strlcpy(fname, cp, sizeof(fname));
                        isTMP = TRUE;
                }
-       } else if (fexists(pkg) && isfile(pkg)) {
+       } else if (usedot && fexists(pkg) && isfile(pkg)) {
                int     len;
 
                if (*pkg != '/') {
@@ -72,7 +72,7 @@
                        strlcpy(fname, pkg, sizeof(fname));
                }
                cp = fname;
-       } else {
+       } else if (usedot) {
                if ((cp = fileFindByPath(pkg)) != NULL) {
                        strncpy(fname, cp, FILENAME_MAX);
                }
@@ -126,6 +126,7 @@
                                if (Flags & SHOW_REQUIRE)       { strcat(flist, REQUIRE_FNAME);         strcat(flist, " "); }
                                /* PRESERVE_FNAME? */
 #endif                         
+                               strcat(flist, PRESERVE_FNAME); strcat(flist, " ");
 
                                if (stat(fname, &sb) == FAIL) {
                                        warnx("can't stat package file '%s'", fname);
@@ -161,7 +162,8 @@
                        }
 
                        /* No match */
-                       warnx("can't find package `%s' installed or in a file!", pkg);
+                       warnx("can't find package `%s' installed%s!", pkg,
+                                 usedot ? " or in a file" : "");
                        return 1;
                }
                if (chdir(log_dir) == FAIL) {



Home | Main Index | Thread Index | Old Index