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 | |
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')
-rw-r--r-- | usr.sbin/pkg_install/create/perform.c | 8 | ||||
-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 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/lib.h | 7 |
5 files changed, 31 insertions, 26 deletions
diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c index 2d21c427288..825503c9512 100644 --- a/usr.sbin/pkg_install/create/perform.c +++ b/usr.sbin/pkg_install/create/perform.c @@ -1,7 +1,7 @@ -/* $OpenBSD: perform.c,v 1.6 1998/10/13 23:09:50 marc Exp $ */ +/* $OpenBSD: perform.c,v 1.7 1998/11/19 04:12:55 espie Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: perform.c,v 1.6 1998/10/13 23:09:50 marc Exp $"; +static const char *rcsid = "$OpenBSD: perform.c,v 1.7 1998/11/19 04:12:55 espie Exp $"; #endif /* @@ -52,6 +52,10 @@ pkg_perform(char **pkgs) if (Verbose && !PlistOnly) printf("Creating package %s\n", pkg); get_dash_string(&Comment); + if (strlen(Comment) > MAXINDEXSIZE && !PlistOnly) { + warnx("Comment string is over %d characters long:\n%s", + MAXINDEXSIZE, Comment); + } get_dash_string(&Desc); if (!strcmp(Contents, "-")) pkg_in = stdin; 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 */ diff --git a/usr.sbin/pkg_install/lib/lib.h b/usr.sbin/pkg_install/lib/lib.h index 2e658b44aad..c2368fa78d4 100644 --- a/usr.sbin/pkg_install/lib/lib.h +++ b/usr.sbin/pkg_install/lib/lib.h @@ -1,4 +1,4 @@ -/* $OpenBSD: lib.h,v 1.3 1998/10/13 23:09:53 marc Exp $ */ +/* $OpenBSD: lib.h,v 1.4 1998/11/19 04:12:55 espie Exp $ */ /* * FreeBSD install - a package for the installation and maintainance @@ -78,6 +78,11 @@ /* The name of the "prefix" environment variable given to scripts */ #define PKG_PREFIX_VNAME "PKG_PREFIX" +/* maximum size of comment that will fit on one line */ +#ifndef MAXINDEXSIZE +#define MAXINDEXSIZE 60 +#endif + /* enumerated constants for plist entry types */ typedef enum pl_ent_t { PLIST_SHOW_ALL = -1, |