summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2000-04-10 18:44:32 +0000
committerMarc Espie <espie@cvs.openbsd.org>2000-04-10 18:44:32 +0000
commit013f9b5d417a4cfc4e73e15e03e68c3acc198b16 (patch)
tree8a9ae0cb79ee9d9369aec8e2967b80ed0fde998c
parentf526b7a422b787f313a98283489287182aef7f12 (diff)
Speed up simple pkg_info: don't retrieve information we don't use.
Improve pkg list display slightly, insert space between pkg name and info always (requested by aaron@).
-rw-r--r--usr.sbin/pkg_install/info/perform.c30
-rw-r--r--usr.sbin/pkg_install/info/show.c6
2 files changed, 18 insertions, 18 deletions
diff --git a/usr.sbin/pkg_install/info/perform.c b/usr.sbin/pkg_install/info/perform.c
index 282d569d377..f8c84efeb88 100644
--- a/usr.sbin/pkg_install/info/perform.c
+++ b/usr.sbin/pkg_install/info/perform.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: perform.c,v 1.7 1999/02/27 13:40:24 espie Exp $ */
+/* $OpenBSD: perform.c,v 1.8 2000/04/10 18:44:31 espie Exp $ */
#ifndef lint
-static const char *rcsid = "$OpenBSD: perform.c,v 1.7 1999/02/27 13:40:24 espie Exp $";
+static const char *rcsid = "$OpenBSD: perform.c,v 1.8 2000/04/10 18:44:31 espie Exp $";
#endif
/* This is OpenBSD pkg_install, based on:
@@ -152,18 +152,6 @@ pkg_do(char *pkg)
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.
@@ -171,6 +159,18 @@ pkg_do(char *pkg)
if (Flags & SHOW_INDEX) {
show_index(pkg, COMMENT_FNAME);
} else {
+ /* 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);
+
/* Start showing the package contents */
if (!Quiet)
printf("%sInformation for %s:\n\n", InfoPrefix, pkg);
@@ -196,8 +196,8 @@ pkg_do(char *pkg)
show_files("Files:\n", &plist);
if (!Quiet)
puts(InfoPrefix);
+ free_plist(&plist);
}
- free_plist(&plist);
bail:
free(pkg2);
leave_playpen(Home);
diff --git a/usr.sbin/pkg_install/info/show.c b/usr.sbin/pkg_install/info/show.c
index 2e24c8d8364..b172f16c38a 100644
--- a/usr.sbin/pkg_install/info/show.c
+++ b/usr.sbin/pkg_install/info/show.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: show.c,v 1.7 1999/03/08 02:01:02 marc Exp $ */
+/* $OpenBSD: show.c,v 1.8 2000/04/10 18:44:31 espie Exp $ */
#ifndef lint
-static const char *rcsid = "$OpenBSD: show.c,v 1.7 1999/03/08 02:01:02 marc Exp $";
+static const char *rcsid = "$OpenBSD: show.c,v 1.8 2000/04/10 18:44:31 espie Exp $";
#endif
/*
@@ -90,7 +90,7 @@ show_index(char *title, char *fname)
strcpy(line, "???\n");
if (!Quiet) {
- printf("%s%-19s", InfoPrefix, title);
+ printf("%s%-18s ", InfoPrefix, title);
}
if ((fp = fopen(fname, "r")) == (FILE *) NULL) {
warnx("show_file (%s): can't open '%s' for reading", title, fname);