From: espie Date: Mon, 10 Apr 2000 18:44:31 +0000 (+0000) Subject: Speed up simple pkg_info: don't retrieve information we don't use. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=edf8da2efe48d9e48825ed3e0fa6e93b9227986d;p=openbsd 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@). --- 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);