Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/usr.sbin/pkg_install/info Pull up revision 1.18:
details: https://anonhg.NetBSD.org/src/rev/8566f1ae9583
branches: netbsd-1-4
changeset: 469385:8566f1ae9583
user: he <he%NetBSD.org@localhost>
date: Mon Sep 13 22:12:03 1999 +0000
description:
Pull up revision 1.18:
Bring closer to /usr/share/misc/style with the aid of indent(1). (hubertf)
diffstat:
usr.sbin/pkg_install/info/main.c | 336 +++++++++++++++++++-------------------
1 files changed, 167 insertions(+), 169 deletions(-)
diffs (truncated from 405 to 300 lines):
diff -r 6aa2a90c477a -r 8566f1ae9583 usr.sbin/pkg_install/info/main.c
--- a/usr.sbin/pkg_install/info/main.c Mon Sep 13 22:10:48 1999 +0000
+++ b/usr.sbin/pkg_install/info/main.c Mon Sep 13 22:12:03 1999 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: main.c,v 1.16.2.1 1999/08/22 18:00:20 he Exp $ */
+/* $NetBSD: main.c,v 1.16.2.2 1999/09/13 22:12:03 he Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char *rcsid = "from FreeBSD Id: main.c,v 1.14 1997/10/08 07:47:26 charnier Exp";
#else
-__RCSID("$NetBSD: main.c,v 1.16.2.1 1999/08/22 18:00:20 he Exp $");
+__RCSID("$NetBSD: main.c,v 1.16.2.2 1999/09/13 22:12:03 he Exp $");
#endif
#endif
@@ -40,222 +40,220 @@
static char Options[] = "aBbcDde:fFIikLl:mpqRrvh";
-int Flags = 0;
-Boolean AllInstalled = FALSE;
-Boolean File2Pkg = FALSE;
-Boolean Quiet = FALSE;
-char *InfoPrefix = "";
-char PlayPen[FILENAME_MAX];
-size_t PlayPenSize = sizeof(PlayPen);
-char *CheckPkg = NULL;
-size_t termwidth = 0;
+int Flags = 0;
+Boolean AllInstalled = FALSE;
+Boolean File2Pkg = FALSE;
+Boolean Quiet = FALSE;
+char *InfoPrefix = "";
+char PlayPen[FILENAME_MAX];
+size_t PlayPenSize = sizeof(PlayPen);
+char *CheckPkg = NULL;
+size_t termwidth = 0;
lpkg_head_t pkgs;
static void
usage(void)
{
- fprintf(stderr, "%s\n%s\n%s\n",
- "usage: pkg_info [-BbcDdFfIikLmpqRrvh] [-e package] [-l prefix]",
- " pkg-name [pkg-name ...]",
- " pkg_info -a [flags]");
- exit(1);
+ fprintf(stderr, "%s\n%s\n%s\n",
+ "usage: pkg_info [-BbcDdFfIikLmpqRrvh] [-e package] [-l prefix]",
+ " pkg-name [pkg-name ...]",
+ " pkg_info -a [flags]");
+ exit(1);
}
int
find_fn(const char *pkg, char *data)
{
- lpkg_t *lpp;
+ lpkg_t *lpp;
- lpp=alloc_lpkg(pkg);
- TAILQ_INSERT_TAIL(&pkgs, lpp, lp_link);
+ lpp = alloc_lpkg(pkg);
+ TAILQ_INSERT_TAIL(&pkgs, lpp, lp_link);
- return 0;
+ return 0;
}
int
main(int argc, char **argv)
{
- int ch, rc;
- lpkg_t *lpp;
+ int ch, rc;
+ lpkg_t *lpp;
- while ((ch = getopt(argc, argv, Options)) != -1)
- switch(ch) {
- case 'a':
- AllInstalled = TRUE;
- break;
+ while ((ch = getopt(argc, argv, Options)) != -1)
+ switch (ch) {
+ case 'a':
+ AllInstalled = TRUE;
+ break;
- case 'B':
- Flags |= SHOW_BUILD_INFO;
- break;
-
- case 'b':
- Flags |= SHOW_BUILD_VERSION;
- break;
+ case 'B':
+ Flags |= SHOW_BUILD_INFO;
+ break;
- case 'c':
- Flags |= SHOW_COMMENT;
- break;
+ case 'b':
+ Flags |= SHOW_BUILD_VERSION;
+ break;
+
+ case 'c':
+ Flags |= SHOW_COMMENT;
+ break;
- case 'D':
- Flags |= SHOW_DISPLAY;
- break;
+ case 'D':
+ Flags |= SHOW_DISPLAY;
+ break;
- case 'd':
- Flags |= SHOW_DESC;
- break;
+ case 'd':
+ Flags |= SHOW_DESC;
+ break;
- case 'e':
- CheckPkg = optarg;
- break;
+ case 'e':
+ CheckPkg = optarg;
+ break;
- case 'f':
- Flags |= SHOW_PLIST;
- break;
+ case 'f':
+ Flags |= SHOW_PLIST;
+ break;
+
+ case 'F':
+ File2Pkg = 1;
+ break;
- case 'F':
- File2Pkg = 1;
- break;
+ case 'I':
+ Flags |= SHOW_INDEX;
+ break;
- case 'I':
- Flags |= SHOW_INDEX;
- break;
+ case 'i':
+ Flags |= SHOW_INSTALL;
+ break;
- case 'i':
- Flags |= SHOW_INSTALL;
- break;
+ case 'k':
+ Flags |= SHOW_DEINSTALL;
+ break;
- case 'k':
- Flags |= SHOW_DEINSTALL;
- break;
+ case 'L':
+ Flags |= SHOW_FILES;
+ break;
- case 'L':
- Flags |= SHOW_FILES;
- break;
+ case 'l':
+ InfoPrefix = optarg;
+ break;
- case 'l':
- InfoPrefix = optarg;
- break;
+ case 'm':
+ Flags |= SHOW_MTREE;
+ break;
- case 'm':
- Flags |= SHOW_MTREE;
- break;
+ case 'p':
+ Flags |= SHOW_PREFIX;
+ break;
- case 'p':
- Flags |= SHOW_PREFIX;
- break;
+ case 'q':
+ Quiet = TRUE;
+ break;
- case 'q':
- Quiet = TRUE;
- break;
+ case 'R':
+ Flags |= SHOW_REQBY;
+ break;
- case 'R':
- Flags |= SHOW_REQBY;
- break;
-
- case 'r':
- Flags |= SHOW_REQUIRE;
- break;
+ case 'r':
+ Flags |= SHOW_REQUIRE;
+ break;
- case 'v':
- Verbose = TRUE;
- /* Reasonable definition of 'everything' */
- Flags = SHOW_COMMENT | SHOW_DESC | SHOW_PLIST | SHOW_INSTALL |
- SHOW_DEINSTALL | SHOW_REQUIRE | SHOW_DISPLAY | SHOW_MTREE |
- SHOW_REQBY | SHOW_DEPENDS;
- break;
+ case 'v':
+ Verbose = TRUE;
+ /* Reasonable definition of 'everything' */
+ Flags = SHOW_COMMENT | SHOW_DESC | SHOW_PLIST | SHOW_INSTALL |
+ SHOW_DEINSTALL | SHOW_REQUIRE | SHOW_DISPLAY | SHOW_MTREE |
+ SHOW_REQBY | SHOW_DEPENDS;
+ break;
- case 'h':
- case '?':
- default:
- usage();
- /* NOTREACHED */
+ case 'h':
+ case '?':
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc == 0 && !Flags) {
+ /* No argument or flags specified - assume -Ia */
+ Flags = SHOW_INDEX;
+ AllInstalled = TRUE;
}
- argc -= optind;
- argv += optind;
+ /* Set some reasonable defaults */
+ if (!Flags)
+ Flags = SHOW_COMMENT | SHOW_DESC | SHOW_REQBY | SHOW_DEPENDS;
- if (argc == 0 && !Flags) {
- /* No argument or flags specified - assume -Ia */
- Flags = SHOW_INDEX;
- AllInstalled = TRUE;
- }
+ /* -Fe /filename -> change CheckPkg to real packagename */
+ if (CheckPkg && File2Pkg) {
+ char *s;
- /* Set some reasonable defaults */
- if (!Flags)
- Flags = SHOW_COMMENT | SHOW_DESC | SHOW_REQBY | SHOW_DEPENDS;
+ if (pkgdb_open(1) == -1)
+ err(1, "cannot open pkgdb");
+
+ s = pkgdb_retrieve(CheckPkg);
- /* -Fe /filename -> change CheckPkg to real packagename */
- if (CheckPkg && File2Pkg) {
- char *s;
-
- if (pkgdb_open(1)==-1) {
- err(1, "cannot open pkgdb");
+ if (s) {
+ CheckPkg = s;
+ } else {
+ errx(1, "No matching pkg for %s.", CheckPkg);
+ }
+
+ pkgdb_close();
}
- s=pkgdb_retrieve(CheckPkg);
-
- if (s)
- CheckPkg = s;
- else {
- errx(1, "No matching pkg for %s.", CheckPkg);
- }
-
Home |
Main Index |
Thread Index |
Old Index