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 read +CONTENTS files if not ...



details:   https://anonhg.NetBSD.org/src/rev/592c345fed31
branches:  trunk
changeset: 486226:592c345fed31
user:      hubertf <hubertf%NetBSD.org@localhost>
date:      Mon May 15 23:14:42 2000 +0000

description:
Don't read +CONTENTS files if not needed.

diffstat:

 usr.sbin/pkg_install/info/perform.c |  35 ++++++++++++++++++-----------------
 1 files changed, 18 insertions(+), 17 deletions(-)

diffs (77 lines):

diff -r 5af9e783c21f -r 592c345fed31 usr.sbin/pkg_install/info/perform.c
--- a/usr.sbin/pkg_install/info/perform.c       Mon May 15 20:37:56 2000 +0000
+++ b/usr.sbin/pkg_install/info/perform.c       Mon May 15 23:14:42 2000 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: perform.c,v 1.30 2000/01/19 23:28:31 hubertf Exp $     */
+/*     $NetBSD: perform.c,v 1.31 2000/05/15 23:14:42 hubertf 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.30 2000/01/19 23:28:31 hubertf Exp $");
+__RCSID("$NetBSD: perform.c,v 1.31 2000/05/15 23:14:42 hubertf Exp $");
 #endif
 #endif
 
@@ -48,8 +48,6 @@
        Boolean installed = FALSE, isTMP = FALSE;
        char    log_dir[FILENAME_MAX];
        char    fname[FILENAME_MAX];
-       package_t plist;
-       FILE   *fp;
        struct stat sb;
        char   *cp = NULL;
        int     code = 0;
@@ -134,18 +132,6 @@
                installed = TRUE;
        }
 
-       /* Suck in the contents list */
-       plist.head = plist.tail = NULL;
-       fp = fopen(CONTENTS_FNAME, "r");
-       if (!fp) {
-               warnx("unable to open %s file", CONTENTS_FNAME);
-               code = 1;
-               goto bail;
-       }
-       /* If we have a prefix, add it now */
-       read_plist(&plist, fp);
-       fclose(fp);
-
        /*
          * Index is special info type that has to override all others to make
          * any sense.
@@ -156,6 +142,21 @@
                (void) snprintf(tmp, sizeof(tmp), "%-19s ", pkg);
                show_index(tmp, COMMENT_FNAME);
        } else {
+               FILE   *fp;
+               package_t plist;
+               
+               /* Read the contents list */
+               plist.head = plist.tail = NULL;
+               fp = fopen(CONTENTS_FNAME, "r");
+               if (!fp) {
+                       warnx("unable to open %s file", CONTENTS_FNAME);
+                       code = 1;
+                       goto bail;
+               }
+               /* If we have a prefix, add it now */
+               read_plist(&plist, fp);
+               fclose(fp);
+
                /* Start showing the package contents */
                if (!Quiet) {
                        printf("%sInformation for %s:\n\n", InfoPrefix, pkg);
@@ -208,8 +209,8 @@
                if (!Quiet) {
                        puts(InfoPrefix);
                }
+               free_plist(&plist);
        }
-       free_plist(&plist);
 bail:
        leave_playpen(Home);
        if (isTMP)



Home | Main Index | Thread Index | Old Index