diff options
| author | hubertf <hubertf@NetBSD.org> | 1997-10-16 00:31:32 +0000 |
|---|---|---|
| committer | hubertf <hubertf@NetBSD.org> | 1997-10-16 00:31:32 +0000 |
| commit | d0245e3952ee6e22ffeffe67e2c7dbf2ae7d93ed (patch) | |
| tree | 287265b6040901fa5e180bad2048c0160cca569c /usr.sbin/pkg_install/info | |
| parent | bc6479768b704b0477d2f52afcd91dc620e0a6a7 (diff) | |
First cut on importing pkg_install as of FreeBSD 971013:
- warn()/err() instead of whinge()/barf()
- Update RCS Id strings
- Update manpages (mostly)
Diffstat (limited to 'usr.sbin/pkg_install/info')
| -rw-r--r-- | usr.sbin/pkg_install/info/main.c | 51 | ||||
| -rw-r--r-- | usr.sbin/pkg_install/info/perform.c | 17 | ||||
| -rw-r--r-- | usr.sbin/pkg_install/info/pkg_info.1 | 14 | ||||
| -rw-r--r-- | usr.sbin/pkg_install/info/show.c | 11 |
4 files changed, 36 insertions, 57 deletions
diff --git a/usr.sbin/pkg_install/info/main.c b/usr.sbin/pkg_install/info/main.c index 309eb223f96..aad44035ae1 100644 --- a/usr.sbin/pkg_install/info/main.c +++ b/usr.sbin/pkg_install/info/main.c @@ -1,10 +1,10 @@ -/* $NetBSD: main.c,v 1.2 1997/06/05 12:59:39 agc Exp $ */ +/* $NetBSD: main.c,v 1.3 1997/10/16 00:32:08 hubertf Exp $ */ #ifndef lint #if 0 -static char *rcsid = "from FreeBSD Id: main.c,v 1.13 1997/03/31 05:10:50 imp Exp"; +static char *rcsid = "from FreeBSD Id: main.c,v 1.14 1997/10/08 07:47:26 charnier Exp"; #else -static char *rcsid = "$NetBSD: main.c,v 1.2 1997/06/05 12:59:39 agc Exp $"; +static char *rcsid = "$NetBSD: main.c,v 1.3 1997/10/16 00:32:08 hubertf Exp $"; #endif #endif @@ -29,6 +29,7 @@ static char *rcsid = "$NetBSD: main.c,v 1.2 1997/06/05 12:59:39 agc Exp $"; * */ +#include <err.h> #include "lib.h" #include "info.h" @@ -41,12 +42,13 @@ char *InfoPrefix = ""; char PlayPen[FILENAME_MAX]; char *CheckPkg = NULL; +static void usage __P((void)); + int main(int argc, char **argv) { int ch; char **pkgs, **start; - char *prog_name = argv[0]; pkgs = start = argv; while ((ch = getopt(argc, argv, Options)) != -1) @@ -129,7 +131,7 @@ main(int argc, char **argv) case 'h': case '?': default: - usage(prog_name, NULL); + usage(); break; } @@ -146,42 +148,17 @@ main(int argc, char **argv) /* If no packages, yelp */ if (pkgs == start && !AllInstalled && !CheckPkg) - usage(prog_name, "Missing package name(s)"); + warnx("missing package name(s)"), usage(); *pkgs = NULL; return pkg_perform(start); } -void -usage(const char *name, const char *fmt, ...) +static void +usage() { - va_list args; - - va_start(args, fmt); - if (fmt) { - fprintf(stderr, "%s: ", name); - vfprintf(stderr, fmt, args); - fprintf(stderr, "\n\n"); - } - va_end(args); - fprintf(stderr, "Usage: %s [args] pkg [ .. pkg ]\n", name); - fprintf(stderr, "Where args are one or more of:\n\n"); - fprintf(stderr, "-a show all installed packages (if any)\n"); - fprintf(stderr, "-I print 'index' of packages\n"); - fprintf(stderr, "-c print `one line comment'\n"); - fprintf(stderr, "-d print description\n"); - fprintf(stderr, "-D print install notice\n"); - fprintf(stderr, "-f show packing list\n"); - fprintf(stderr, "-i show install script\n"); - fprintf(stderr, "-k show deinstall script\n"); - fprintf(stderr, "-r show requirements script\n"); - fprintf(stderr, "-R show packages depending on this package\n"); - fprintf(stderr, "-p show prefix\n"); - fprintf(stderr, "-l <str> Prefix each info catagory with <str>\n"); - fprintf(stderr, "-L show intalled files\n"); - fprintf(stderr, "-q minimal output (``quiet'' mode)\n"); - fprintf(stderr, "-v show all information\n"); - fprintf(stderr, "-t temp use temp as template for mktemp()\n"); - fprintf(stderr, "-e pkg returns 0 if pkg is installed, 1 otherwise\n"); - fprintf(stderr, "\n[no args = -c -d -R]\n"); + fprintf(stderr, "%s\n%s\n%s\n", + "usage: pkg_info [-cdDikrRpLqImv] [-e package] [-l prefix]", + " pkg-name [pkg-name ...]", + " pkg_info -a [flags]"); exit(1); } diff --git a/usr.sbin/pkg_install/info/perform.c b/usr.sbin/pkg_install/info/perform.c index 29021a78470..38a155f0791 100644 --- a/usr.sbin/pkg_install/info/perform.c +++ b/usr.sbin/pkg_install/info/perform.c @@ -1,10 +1,10 @@ -/* $NetBSD: perform.c,v 1.2 1997/06/05 12:59:40 agc Exp $ */ +/* $NetBSD: perform.c,v 1.3 1997/10/16 00:32:09 hubertf Exp $ */ #ifndef lint #if 0 -static const char *rcsid = "from FreeBSD Id: perform.c,v 1.21 1997/02/22 16:09:42 peter Exp"; +static const char *rcsid = "from FreeBSD Id: perform.c,v 1.23 1997/10/13 15:03:53 jkh Exp"; #else -static const char *rcsid = "$NetBSD: perform.c,v 1.2 1997/06/05 12:59:40 agc Exp $"; +static const char *rcsid = "$NetBSD: perform.c,v 1.3 1997/10/16 00:32:09 hubertf Exp $"; #endif #endif @@ -118,13 +118,13 @@ pkg_do(char *pkg) * be very optimistic. */ if (stat(fname, &sb) == FAIL) { - whinge("Can't stat package file '%s'.", fname); + warnx("can't stat package file '%s'", fname); code = 1; goto bail; } Home = make_playpen(PlayPen, sb.st_size / 2); if (unpack(fname, "+*")) { - whinge("Error during unpacking, no info for '%s' available.", pkg); + warnx("error during unpacking, no info for '%s' available", pkg); code = 1; goto bail; } @@ -136,11 +136,11 @@ pkg_do(char *pkg) sprintf(log_dir, "%s/%s", (tmp = getenv(PKG_DBDIR)) ? tmp : DEF_LOG_DIR, pkg); if (!fexists(log_dir)) { - whinge("Can't find package `%s' installed or in a file!", pkg); + warnx("can't find package `%s' installed or in a file!", pkg); return 1; } if (chdir(log_dir) == FAIL) { - whinge("Can't change directory to '%s'!", log_dir); + warnx("can't change directory to '%s'!", log_dir); return 1; } installed = TRUE; @@ -150,7 +150,7 @@ pkg_do(char *pkg) plist.head = plist.tail = NULL; fp = fopen(CONTENTS_FNAME, "r"); if (!fp) { - whinge("Unable to open %s file.", CONTENTS_FNAME); + warnx("unable to open %s file", CONTENTS_FNAME); code = 1; goto bail; } @@ -207,4 +207,5 @@ void cleanup(int sig) { leave_playpen(Home); + exit(1); } diff --git a/usr.sbin/pkg_install/info/pkg_info.1 b/usr.sbin/pkg_install/info/pkg_info.1 index 5f7a44ca32b..b5e18b0ab30 100644 --- a/usr.sbin/pkg_install/info/pkg_info.1 +++ b/usr.sbin/pkg_install/info/pkg_info.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkg_info.1,v 1.3 1997/06/09 15:24:38 agc Exp $ +.\" $NetBSD: pkg_info.1,v 1.4 1997/10/16 00:32:10 hubertf Exp $ .\" .\" FreeBSD install - a package for the installation and maintainance .\" of non-core utilities. @@ -19,10 +19,10 @@ .\" .Dd November 25, 1994 .Dt pkg_info 1 -.Os FreeBSD 2.0 +.Os FreeBSD .Sh NAME .Nm pkg_info -.Nd a utility for displaying information on software packages. +.Nd a utility for displaying information on software packages .Sh SYNOPSIS .Nm pkg_info .Op Fl cdDikrRpLqImv @@ -41,7 +41,7 @@ with the .Xr pkg_create 1 command. .Sh OPTIONS -The following command line options are supported. +The following command line options are supported: .Bl -tag -width indent .It Ar pkg-name ... The named packages are described. A package name may either be the name of @@ -50,7 +50,7 @@ URL to an ftp available package. .It Fl a Show all currently installed packages. .It Fl v -Turns on verbose output. +Turn on verbose output. .It Fl p Show the installation prefix for each package. .It Fl q @@ -80,14 +80,14 @@ are generated. If the package identified by .Ar pkg-name is currently installed, return 0, otherwise return 1. This option -allows you easily to test for the presence of another (perhaps +allows you to easily test for the presence of another (perhaps prerequisite) package from a script. .It Fl l Ar str Prefix each information category header (see .Fl q ) shown with .Ar str . -This is primarily of use to front-end programs which want to request a +This is primarily of use to front-end programs who want to request a lot of different information fields at once for a package, but don't necessary want the output intermingled in such a way that they can't organize it. This lets you add a special token to the start of diff --git a/usr.sbin/pkg_install/info/show.c b/usr.sbin/pkg_install/info/show.c index f3dfde3f55b..1d390b2bad5 100644 --- a/usr.sbin/pkg_install/info/show.c +++ b/usr.sbin/pkg_install/info/show.c @@ -1,10 +1,10 @@ -/* $NetBSD: show.c,v 1.3 1997/10/11 20:26:22 hubertf Exp $ */ +/* $NetBSD: show.c,v 1.4 1997/10/16 00:32:12 hubertf Exp $ */ #ifndef lint #if 0 -static const char *rcsid = "from FreeBSD Id: show.c,v 1.10 1997/02/22 16:09:43 peter Exp"; +static const char *rcsid = "from FreeBSD Id: show.c,v 1.11 1997/10/08 07:47:38 charnier Exp"; #else -static const char *rcsid = "$NetBSD: show.c,v 1.3 1997/10/11 20:26:22 hubertf Exp $"; +static const char *rcsid = "$NetBSD: show.c,v 1.4 1997/10/16 00:32:12 hubertf Exp $"; #endif #endif @@ -61,7 +61,7 @@ show_index(char *title, char *fname) printf("%s%s", InfoPrefix, title); fp = fopen(fname, "r"); if (!fp) { - whinge("show_file: Can't open '%s' for reading.", fname); + warnx("show_file: can't open '%s' for reading", fname); return; } if(fgets(line, MAXINDEXSIZE+1, fp)) { @@ -164,7 +164,8 @@ show_plist(char *title, Package *plist, plist_t type) break; default: - barf("Unknown command type %d (%s)\n", p->type, p->name); + cleanup(0); + errx(2, "unknown command type %d (%s)", p->type, p->name); break; } p = p->next; |
