Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/man Set the string to NUL instread of providing an n...



details:   https://anonhg.NetBSD.org/src/rev/20134eaaad0b
branches:  trunk
changeset: 788710:20134eaaad0b
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jul 18 16:01:25 2013 +0000

description:
Set the string to NUL instread of providing an new empty string (from uwe)

diffstat:

 usr.bin/man/man.c |  16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diffs (70 lines):

diff -r 356c7c8379fb -r 20134eaaad0b usr.bin/man/man.c
--- a/usr.bin/man/man.c Thu Jul 18 15:59:27 2013 +0000
+++ b/usr.bin/man/man.c Thu Jul 18 16:01:25 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: man.c,v 1.48 2013/07/18 15:39:08 christos Exp $        */
+/*     $NetBSD: man.c,v 1.49 2013/07/18 16:01:25 christos Exp $        */
 
 /*
  * Copyright (c) 1987, 1993, 1994, 1995
@@ -40,7 +40,7 @@
 #if 0
 static char sccsid[] = "@(#)man.c      8.17 (Berkeley) 1/31/95";
 #else
-__RCSID("$NetBSD: man.c,v 1.48 2013/07/18 15:39:08 christos Exp $");
+__RCSID("$NetBSD: man.c,v 1.49 2013/07/18 16:01:25 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -122,8 +122,6 @@
 static const char *getclass(const char *);
 static void printmanpath(struct manstate *);
 
-static char EMPTY[1];
-
 /*
  * main function
  */
@@ -587,14 +585,14 @@
                                if (!mp->all) {
                                        /* Delete any other matches. */
                                        while (++cnt< pg->gl_pathc)
-                                               pg->gl_pathv[cnt] = EMPTY;
+                                               *pg->gl_pathv[cnt] = '\0';
                                        break;
                                }
                                continue;
                        }
 
                        /* It's not a man page, forget about it. */
-                       pg->gl_pathv[cnt] = EMPTY;
+                       *pg->gl_pathv[cnt] = '\0';
                }
 
   notfound:
@@ -643,7 +641,7 @@
                        if (mp->pathsearch) {
                                p = strstr(pg->gl_pathv[cnt], mp->pathsearch);
                                if (!p || strchr(p, '/') == NULL) {
-                                       pg->gl_pathv[cnt] = EMPTY; /* zap! */
+                                       *pg->gl_pathv[cnt] = '\0'; /* zap! */
                                        continue;
                                }
                        }
@@ -682,14 +680,14 @@
                                if (!mp->all) {
                                        /* Delete any other matches. */
                                        while (++cnt< pg->gl_pathc)
-                                               pg->gl_pathv[cnt] = EMPTY;
+                                               *pg->gl_pathv[cnt] = '\0';
                                        break;
                                }
                                continue;
                        }
 
                        /* It's not a man page, forget about it. */
-                       pg->gl_pathv[cnt] = EMPTY;
+                       *pg->gl_pathv[cnt] = '\0';
                }
 
                if (anyfound && !mp->all)



Home | Main Index | Thread Index | Old Index