diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2001-04-08 16:45:49 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2001-04-08 16:45:49 +0000 |
commit | 5a14ac2a8fbdc64a6e5a1d31d891a4f0eee033d6 (patch) | |
tree | e31007d42dcc89fb9503a1c900c02a5f4ddcb019 /usr.sbin/pkg_install/info | |
parent | 40d86c85d5851915c47abba5df4f515c693af109 (diff) |
Better error messages: pwarnx function, which works like pwarn, except
it shows a current package name along with the program name, e.g.,
pkg_add(foo-3.0): some error occurred.
A few messages now bear redundant pkgnames, which is much better than
doing pkg_add * and being informed that something went slightly wrong
somewhere...
Diffstat (limited to 'usr.sbin/pkg_install/info')
-rw-r--r-- | usr.sbin/pkg_install/info/main.c | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_install/info/perform.c | 16 | ||||
-rw-r--r-- | usr.sbin/pkg_install/info/show.c | 8 |
3 files changed, 16 insertions, 14 deletions
diff --git a/usr.sbin/pkg_install/info/main.c b/usr.sbin/pkg_install/info/main.c index 55411bc39c9..ff89924ed21 100644 --- a/usr.sbin/pkg_install/info/main.c +++ b/usr.sbin/pkg_install/info/main.c @@ -1,7 +1,7 @@ -/* $OpenBSD: main.c,v 1.12 1999/02/28 18:55:25 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.13 2001/04/08 16:45:47 espie Exp $ */ #ifndef lint -static char *rcsid = "$OpenBSD: main.c,v 1.12 1999/02/28 18:55:25 deraadt Exp $"; +static char *rcsid = "$OpenBSD: main.c,v 1.13 2001/04/08 16:45:47 espie Exp $"; #endif /* @@ -148,7 +148,7 @@ main(int argc, char **argv) /* If no packages, yelp */ if (pkgs == start && !AllInstalled && !CheckPkg) - warnx("missing package name(s)"), usage(); + pwarnx("missing package name(s)"), usage(); *pkgs = NULL; return pkg_perform(start); } diff --git a/usr.sbin/pkg_install/info/perform.c b/usr.sbin/pkg_install/info/perform.c index f8c84efeb88..f9fe41d7e73 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.8 2000/04/10 18:44:31 espie Exp $ */ +/* $OpenBSD: perform.c,v 1.9 2001/04/08 16:45:47 espie Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: perform.c,v 1.8 2000/04/10 18:44:31 espie Exp $"; +static const char *rcsid = "$OpenBSD: perform.c,v 1.9 2001/04/08 16:45:47 espie Exp $"; #endif /* This is OpenBSD pkg_install, based on: @@ -79,6 +79,8 @@ pkg_do(char *pkg) int code = 0; char *pkg2 = 0; /* hold full name of package, storage to free */ + set_pkg(pkg); + if (isURL(pkg)) { if ((cp = fileGetURL(NULL, pkg)) != NULL) { strcpy(fname, cp); @@ -113,13 +115,13 @@ pkg_do(char *pkg) * be very optimistic. */ if (stat(fname, &sb) == FAIL) { - warnx("can't stat package file '%s'", fname); + pwarnx("can't stat package file '%s'", fname); code = 1; goto bail; } Home = make_playpen(PlayPen, PlayPenSize, sb.st_size / 2); if (unpack(fname, "+*")) { - warnx("error during unpacking, no info for '%s' available", pkg); + pwarnx("error during unpacking, no info for '%s' available", pkg); code = 1; goto bail; } @@ -139,13 +141,13 @@ pkg_do(char *pkg) pkg); if (!fexists(log_dir) && ! (pkg2 = find_prefix(log_dir, sizeof(log_dir), tmp, pkg))) { - warnx("can't find package `%s' installed or in a file!", pkg); + pwarnx("can't find package `%s' installed or in a file!", pkg); return 1; } if (pkg2) pkg = pkg2; if (chdir(log_dir) == FAIL) { - warnx("can't change directory to '%s'!", log_dir); + pwarnx("can't change directory to '%s'!", log_dir); free(pkg2); return 1; } @@ -163,7 +165,7 @@ pkg_do(char *pkg) plist.head = plist.tail = NULL; fp = fopen(CONTENTS_FNAME, "r"); if (!fp) { - warnx("unable to open %s file", CONTENTS_FNAME); + pwarnx("unable to open %s file", CONTENTS_FNAME); code = 1; goto bail; } diff --git a/usr.sbin/pkg_install/info/show.c b/usr.sbin/pkg_install/info/show.c index b172f16c38a..7c988cd419b 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.8 2000/04/10 18:44:31 espie Exp $ */ +/* $OpenBSD: show.c,v 1.9 2001/04/08 16:45:47 espie Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: show.c,v 1.8 2000/04/10 18:44:31 espie Exp $"; +static const char *rcsid = "$OpenBSD: show.c,v 1.9 2001/04/08 16:45:47 espie Exp $"; #endif /* @@ -93,7 +93,7 @@ show_index(char *title, char *fname) printf("%s%-18s ", InfoPrefix, title); } if ((fp = fopen(fname, "r")) == (FILE *) NULL) { - warnx("show_file (%s): can't open '%s' for reading", title, fname); + pwarnx("show_file (%s): can't open '%s' for reading", title, fname); } else { if (fgets(line, MAXINDEXSIZE+1, fp)) { @@ -159,7 +159,7 @@ show_plist(char *title, package_t *plist, pl_ent_t type) printf(Quiet ? showv[p->type].sh_quiet : showv[p->type].sh_verbose, p->name); break; default: - warnx("unknown command type %d (%s)", p->type, p->name); + pwarnx("unknown command type %d (%s)", p->type, p->name); } (void) fputc('\n', stdout); } |