Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/catman The previous change didn't even compile due ...



details:   https://anonhg.NetBSD.org/src/rev/ce400ecc03c9
branches:  trunk
changeset: 472082:ce400ecc03c9
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Tue Apr 20 14:22:32 1999 +0000

description:
The previous change didn't even compile due to a warning.
Also, fix the same core dump in the case where there are no `_build' lines.
These should probably both emit a warning, so the user knows what happened.

diffstat:

 usr.sbin/catman/catman.c |  43 +++++++++++++++++++++++--------------------
 1 files changed, 23 insertions(+), 20 deletions(-)

diffs (61 lines):

diff -r 4121bbed3029 -r ce400ecc03c9 usr.sbin/catman/catman.c
--- a/usr.sbin/catman/catman.c  Tue Apr 20 13:53:53 1999 +0000
+++ b/usr.sbin/catman/catman.c  Tue Apr 20 14:22:32 1999 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: catman.c,v 1.12 1999/04/20 10:59:13 dante Exp $       */
+/*      $NetBSD: catman.c,v 1.13 1999/04/20 14:22:32 mycroft Exp $       */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -410,29 +410,32 @@
                snprintf(manpage, sizeof(manpage), "%s/%s", mandir, dp->d_name);
                snprintf(catpage, sizeof(catpage), "%s/%s", catdir, dp->d_name);
 
+               e_build = NULL;
                buildp = getlist("_build");
-               for(e_build = buildp->list.tqh_first; e_build;
-                               e_build = e_build->q.tqe_next) {
-                       splitentry(e_build->s, buildsuff, buildcmd);
-                       snprintf(match, sizeof(match), "*%s", buildsuff);
-                       if(!fnmatch(match, manpage, 0))
-                               break;
+               if(buildp) {
+                       for(e_build = buildp->list.tqh_first; e_build;
+                                       e_build = e_build->q.tqe_next) {
+                               splitentry(e_build->s, buildsuff, buildcmd);
+                               snprintf(match, sizeof(match), "*%s",
+                                                       buildsuff);
+                               if(!fnmatch(match, manpage, 0))
+                                       break;
+                       }
                }
 
-               if(e_build == NULL) {
+               if(e_build == NULL)
                        continue;
-               } else {
-                       e_crunch = NULL;
-                       if(crunchp = getlist("_crunch")) {
-                               for(e_crunch=crunchp->list.tqh_first; e_crunch;
-                                               e_crunch=e_crunch->q.tqe_next) {
-                                       splitentry(e_crunch->s, crunchsuff,
-                                                               crunchcmd);
-                                       snprintf(match, sizeof(match), "*%s",
-                                                               crunchsuff);
-                                       if(!fnmatch(match, manpage, 0))
-                                               break;
-                               }
+
+               e_crunch = NULL;
+               crunchp = getlist("_crunch");
+               if(crunchp) {
+                       for(e_crunch = crunchp->list.tqh_first; e_crunch;
+                                       e_crunch=e_crunch->q.tqe_next) {
+                               splitentry(e_crunch->s, crunchsuff, crunchcmd);
+                               snprintf(match, sizeof(match), "*%s",
+                                                       crunchsuff);
+                               if(!fnmatch(match, manpage, 0))
+                                       break;
                        }
                }
 



Home | Main Index | Thread Index | Old Index