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.16:



details:   https://anonhg.NetBSD.org/src/rev/043cd60431a0
branches:  netbsd-1-4
changeset: 469387:043cd60431a0
user:      he <he%NetBSD.org@localhost>
date:      Mon Sep 13 22:16:22 1999 +0000

description:
Pull up revision 1.16:
  Bring closer to /usr/share/misc/style with the aid of indent(1).  (hubertf)

diffstat:

 usr.sbin/pkg_install/info/show.c |  232 ++++++++++++++++++++------------------
 1 files changed, 120 insertions(+), 112 deletions(-)

diffs (truncated from 320 to 300 lines):

diff -r 0cad52329d05 -r 043cd60431a0 usr.sbin/pkg_install/info/show.c
--- a/usr.sbin/pkg_install/info/show.c  Mon Sep 13 22:14:30 1999 +0000
+++ b/usr.sbin/pkg_install/info/show.c  Mon Sep 13 22:16:22 1999 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: show.c,v 1.12.2.1 1999/08/22 18:09:19 he Exp $ */
+/*     $NetBSD: show.c,v 1.12.2.2 1999/09/13 22:16:22 he Exp $ */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: show.c,v 1.11 1997/10/08 07:47:38 charnier Exp";
 #else
-__RCSID("$NetBSD: show.c,v 1.12.2.1 1999/08/22 18:09:19 he Exp $");
+__RCSID("$NetBSD: show.c,v 1.12.2.2 1999/09/13 22:16:22 he Exp $");
 #endif
 #endif
 
@@ -62,43 +62,46 @@
 #include "lib.h"
 #include "info.h"
 
-/* structure to define entries for the "show table" */
+/* Structure to define entries for the "show table" */
 typedef struct show_t {
-       pl_ent_t        sh_type;        /* type of entry */
-       char            *sh_quiet;      /* message when quiet */
-       char            *sh_verbose;    /* message when verbose */
-} show_t;
+       pl_ent_t sh_type;       /* type of entry */
+       char   *sh_quiet;       /* message when quiet */
+       char   *sh_verbose;     /* message when verbose */
+}       show_t;
 
-/* the entries in this table must be ordered the same as pl_ent_t constants */
-static show_t  showv[] = {
-       {       PLIST_FILE,     "%s",           "File: %s" },
-       {       PLIST_CWD,      "@cwd %s",      "\tCWD to: %s" },
-       {       PLIST_CMD,      "@exec %s",     "\tEXEC '%s'" },
-       {       PLIST_CHMOD,    "@chmod %s",    "\tCHMOD to %s" },
-       {       PLIST_CHOWN,    "@chown %s",    "\tCHOWN to %s" },
-       {       PLIST_CHGRP,    "@chgrp %s",    "\tCHGRP to %s" },
-       {       PLIST_COMMENT,  "@comment %s",  "\tComment: %s" },
-       {       PLIST_IGNORE,   NULL,   NULL },
-       {       PLIST_NAME,     "@name %s",     "\tPackage name: %s" },
-       {       PLIST_UNEXEC,   "@unexec %s",   "\tUNEXEC '%s'" },
-       {       PLIST_SRC,      "@src: %s",     "\tSRC to: %s" },
-       {       PLIST_DISPLAY,  "@display %s",  "\tInstall message file: %s" },
-       {       PLIST_PKGDEP,   "@pkgdep %s",   "\tPackage depends on: %s" },
-       {       PLIST_MTREE,    "@mtree %s",    "\tPackage mtree file: %s" },
-       {       PLIST_DIR_RM,   "@dirrm %s",    "\tDeinstall directory remove: %s" },
-       {       PLIST_IGNORE_INST,      "@ignore_inst ??? doesn't belong here",
-               "\tIgnore next file installation directive (doesn't belong)" },
-       {       PLIST_OPTION,   "@option %s",   "\tPackage has option: %s" },
-       {       PLIST_PKGCFL,   "@pkgcfl %s",   "\tPackage conflicts with: %s" },
-       {       -1,             NULL,            NULL }
+/*
+ * The entries in this table must be ordered the same as
+ * pl_ent_t constants
+ */
+static show_t showv[] = {
+       {PLIST_FILE, "%s", "File: %s"},
+       {PLIST_CWD, "@cwd %s", "\tCWD to: %s"},
+       {PLIST_CMD, "@exec %s", "\tEXEC '%s'"},
+       {PLIST_CHMOD, "@chmod %s", "\tCHMOD to %s"},
+       {PLIST_CHOWN, "@chown %s", "\tCHOWN to %s"},
+       {PLIST_CHGRP, "@chgrp %s", "\tCHGRP to %s"},
+       {PLIST_COMMENT, "@comment %s", "\tComment: %s"},
+       {PLIST_IGNORE, NULL, NULL},
+       {PLIST_NAME, "@name %s", "\tPackage name: %s"},
+       {PLIST_UNEXEC, "@unexec %s", "\tUNEXEC '%s'"},
+       {PLIST_SRC, "@src: %s", "\tSRC to: %s"},
+       {PLIST_DISPLAY, "@display %s", "\tInstall message file: %s"},
+       {PLIST_PKGDEP, "@pkgdep %s", "\tPackage depends on: %s"},
+       {PLIST_MTREE, "@mtree %s", "\tPackage mtree file: %s"},
+       {PLIST_DIR_RM, "@dirrm %s", "\tDeinstall directory remove: %s"},
+       {PLIST_IGNORE_INST, "@ignore_inst ??? doesn't belong here",
+       "\tIgnore next file installation directive (doesn't belong)"},
+       {PLIST_OPTION, "@option %s", "\tPackage has option: %s"},
+       {PLIST_PKGCFL, "@pkgcfl %s", "\tPackage conflicts with: %s"},
+       {-1, NULL, NULL}
 };
 
 void
 show_file(char *title, char *fname)
 {
-       FILE *fp;
-       char line[1024];
-       int n;
+       FILE   *fp;
+       char    line[1024];
+       int     n;
 
        if (!Quiet) {
                printf("%s%s", InfoPrefix, title);
@@ -111,16 +114,16 @@
                }
                (void) fclose(fp);
        }
-       printf("\n");   /* just in case */
+       printf("\n");           /* just in case */
 }
 
 void
 show_index(char *title, char *fname)
 {
-       FILE *fp;
-       char *line;
-       size_t linelen;
-       size_t maxline = termwidth;
+       FILE   *fp;
+       char   *line;
+       size_t  linelen;
+       size_t  maxline = termwidth;
 
        if (!Quiet) {
                printf("%s%s", InfoPrefix, title);
@@ -131,7 +134,7 @@
                return;
        }
        if ((line = fgetln(fp, &linelen))) {
-               line[linelen - 1] = '\0'; /* tromp newline & terminate string */
+               line[linelen - 1] = '\0';       /* tromp newline & terminate string */
                if (termwidth && (linelen > maxline)) {
                        /* XXX -1 if term does NOT have xn (or xenl) quirk */
                        line[maxline] = '\0';
@@ -141,76 +144,80 @@
        (void) fclose(fp);
 }
 
-/* Show a packing list item type.  If type is PLIST_SHOW_ALL, show all */
+/*
+ * Show a packing list item type.  If type is PLIST_SHOW_ALL, show all
+ */
 void
 show_plist(char *title, package_t *plist, pl_ent_t type)
 {
-    plist_t *p;
-    Boolean ign;
-
-    if (!Quiet) {
-       printf("%s%s", InfoPrefix, title);
-    }
-    for (ign = FALSE, p = plist->head; p ; p = p->next) {
-       if (p->type == type || type == PLIST_SHOW_ALL) {
-               switch(p->type) {
-               case PLIST_FILE:
-                       printf(Quiet ? showv[p->type].sh_quiet : showv[p->type].sh_verbose, p->name);
-                       if (ign) {
-                               if (!Quiet) {
-                                       printf(" (ignored)");
-                               }
-                               ign = FALSE;
-                       }
-                       break;
-               case PLIST_CHMOD:
-               case PLIST_CHOWN:
-               case PLIST_CHGRP:
-                       printf(Quiet ? showv[p->type].sh_quiet : showv[p->type].sh_verbose,
-                               p->name ? p->name : "(clear default)");
-                       break;
-               case PLIST_IGNORE:
-                       ign = TRUE;
-                       break;
-               case PLIST_IGNORE_INST:
-                       printf(Quiet ? showv[p->type].sh_quiet : showv[p->type].sh_verbose, p->name);
-                       ign = TRUE;
-                       break;
-               case PLIST_CWD:
-               case PLIST_CMD:
-               case PLIST_SRC:
-               case PLIST_UNEXEC:
-               case PLIST_COMMENT:
-               case PLIST_NAME:
-               case PLIST_DISPLAY:
-               case PLIST_PKGDEP:
-               case PLIST_MTREE:
-               case PLIST_DIR_RM:
-               case PLIST_OPTION:
-               case PLIST_PKGCFL:
-                       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);
-               }
-               (void) fputc('\n', stdout);
-       }
-    }
-}
-
-/* Show all files in the packing list (except ignored ones) */
-void
-show_files(char *title, package_t *plist)
-{
-       plist_t *p;
-       Boolean ign;
-       char    *dir = ".";
+       plist_t *p;
+       Boolean ign;
 
        if (!Quiet) {
                printf("%s%s", InfoPrefix, title);
        }
-       for (ign = FALSE, p = plist->head; p ; p = p->next) {
-               switch(p->type) {
+       for (ign = FALSE, p = plist->head; p; p = p->next) {
+               if (p->type == type || type == PLIST_SHOW_ALL) {
+                       switch (p->type) {
+                       case PLIST_FILE:
+                               printf(Quiet ? showv[p->type].sh_quiet : showv[p->type].sh_verbose, p->name);
+                               if (ign) {
+                                       if (!Quiet) {
+                                               printf(" (ignored)");
+                                       }
+                                       ign = FALSE;
+                               }
+                               break;
+                       case PLIST_CHMOD:
+                       case PLIST_CHOWN:
+                       case PLIST_CHGRP:
+                               printf(Quiet ? showv[p->type].sh_quiet : showv[p->type].sh_verbose,
+                                   p->name ? p->name : "(clear default)");
+                               break;
+                       case PLIST_IGNORE:
+                               ign = TRUE;
+                               break;
+                       case PLIST_IGNORE_INST:
+                               printf(Quiet ? showv[p->type].sh_quiet : showv[p->type].sh_verbose, p->name);
+                               ign = TRUE;
+                               break;
+                       case PLIST_CWD:
+                       case PLIST_CMD:
+                       case PLIST_SRC:
+                       case PLIST_UNEXEC:
+                       case PLIST_COMMENT:
+                       case PLIST_NAME:
+                       case PLIST_DISPLAY:
+                       case PLIST_PKGDEP:
+                       case PLIST_MTREE:
+                       case PLIST_DIR_RM:
+                       case PLIST_OPTION:
+                       case PLIST_PKGCFL:
+                               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);
+                       }
+                       (void) fputc('\n', stdout);
+               }
+       }
+}
+
+/*
+ * Show all files in the packing list (except ignored ones)
+ */
+void
+show_files(char *title, package_t *plist)
+{
+       plist_t *p;
+       Boolean ign;
+       char   *dir = ".";
+
+       if (!Quiet) {
+               printf("%s%s", InfoPrefix, title);
+       }
+       for (ign = FALSE, p = plist->head; p; p = p->next) {
+               switch (p->type) {
                case PLIST_FILE:
                        if (!ign) {
                                printf("%s/%s\n", dir, p->name);
@@ -229,16 +236,18 @@
        }
 }
 
-/* Show dependencies (packages this pkg requires) */
+/*
+ * Show dependencies (packages this pkg requires)
+ */
 void
 show_depends(char *title, package_t *plist)
 {
-       plist_t *p;
-       int nodepends;
+       plist_t *p;
+       int     nodepends;
 
        nodepends = 1;
        for (p = plist->head; p && nodepends; p = p->next) {
-               switch(p->type) {
+               switch (p->type) {
                case PLIST_PKGDEP:
                        nodepends = 0;
                        break;
@@ -247,21 +256,20 @@
                }
        }
        if (nodepends)
-         return;
-       
+               return;
+



Home | Main Index | Thread Index | Old Index