diff options
author | Marc Espie <espie@cvs.openbsd.org> | 1998-11-19 04:12:56 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 1998-11-19 04:12:56 +0000 |
commit | d6f5dbf5092347a35cb3f66847e1db079417d02a (patch) | |
tree | 72708eff171c4ac949f8ad975b4e52fbdd1e72b4 /usr.sbin/pkg_install/info | |
parent | ab504293aa6252be025e2a3a473cce168923c75a (diff) |
- fix pkg_info to give more rational summary when COMMENTS files are weird.
- warn when COMMENT > 60 characters.
*** In one month we turn this into an error -> fix packages files ***
Diffstat (limited to 'usr.sbin/pkg_install/info')
-rw-r--r-- | usr.sbin/pkg_install/info/info.h | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_install/info/perform.c | 9 | ||||
-rw-r--r-- | usr.sbin/pkg_install/info/show.c | 27 |
3 files changed, 19 insertions, 23 deletions
diff --git a/usr.sbin/pkg_install/info/info.h b/usr.sbin/pkg_install/info/info.h index 32cdc68cc71..6e7623b52c5 100644 --- a/usr.sbin/pkg_install/info/info.h +++ b/usr.sbin/pkg_install/info/info.h @@ -1,4 +1,4 @@ -/* $OpenBSD: info.h,v 1.2 1998/10/13 23:09:51 marc Exp $ */ +/* $OpenBSD: info.h,v 1.3 1998/11/19 04:12:55 espie Exp $ */ /* * FreeBSD install - a package for the installation and maintainance @@ -23,10 +23,6 @@ #ifndef _INST_INFO_H_INCLUDE #define _INST_INFO_H_INCLUDE -#ifndef MAXINDEXSIZE -#define MAXINDEXSIZE 60 -#endif - #ifndef MAXNAMESIZE #define MAXNAMESIZE 20 #endif diff --git a/usr.sbin/pkg_install/info/perform.c b/usr.sbin/pkg_install/info/perform.c index 5f9cf1011a3..b1cb852a98a 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.5 1998/10/13 23:09:51 marc Exp $ */ +/* $OpenBSD: perform.c,v 1.6 1998/11/19 04:12:55 espie Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: perform.c,v 1.5 1998/10/13 23:09:51 marc Exp $"; +static const char *rcsid = "$OpenBSD: perform.c,v 1.6 1998/11/19 04:12:55 espie Exp $"; #endif /* @@ -132,10 +132,7 @@ pkg_do(char *pkg) * any sense. */ if (Flags & SHOW_INDEX) { - char tmp[FILENAME_MAX]; - - snprintf(tmp, FILENAME_MAX, "%-19s ", pkg); - show_index(tmp, COMMENT_FNAME); + show_index(pkg, COMMENT_FNAME); } else { /* Start showing the package contents */ if (!Quiet) diff --git a/usr.sbin/pkg_install/info/show.c b/usr.sbin/pkg_install/info/show.c index 582d06a21d1..df068142fee 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.4 1998/10/13 23:09:51 marc Exp $ */ +/* $OpenBSD: show.c,v 1.5 1998/11/19 04:12:55 espie Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: show.c,v 1.4 1998/10/13 23:09:51 marc Exp $"; +static const char *rcsid = "$OpenBSD: show.c,v 1.5 1998/11/19 04:12:55 espie Exp $"; #endif /* @@ -87,21 +87,24 @@ show_index(char *title, char *fname) FILE *fp; char line[MAXINDEXSIZE+2]; + strcpy(line, "???\n"); + if (!Quiet) { - printf("%s%s", InfoPrefix, title); + printf("%s%-19s", InfoPrefix, title); } if ((fp = fopen(fname, "r")) == (FILE *) NULL) { - warnx("show_file: can't open '%s' for reading", fname); - return; - } - if (fgets(line, MAXINDEXSIZE+1, fp)) { - if (line[MAXINDEXSIZE-1] != '\n') { - line[MAXINDEXSIZE] = '\n'; + warnx("show_file (%s): can't open '%s' for reading", title, fname); + } + else { + if (fgets(line, MAXINDEXSIZE+1, fp)) { + if (line[MAXINDEXSIZE-1] != '\n') { + line[MAXINDEXSIZE] = '\n'; + } + line[MAXINDEXSIZE+1] = 0; } - line[MAXINDEXSIZE+1] = 0; - (void) fputs(line, stdout); + (void) fclose(fp); } - (void) fclose(fp); + (void) fputs(line, stdout); } /* Show a packing list item type. If type is PLIST_SHOW_ALL, show all */ |