Source-Changes-HG archive

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

[src/trunk]: src/libexec/makewhatis Accept all kind of whitespaces when searc...



details:   https://anonhg.NetBSD.org/src/rev/8a8cbec050e6
branches:  trunk
changeset: 480056:8a8cbec050e6
user:      tron <tron%NetBSD.org@localhost>
date:      Fri Dec 31 14:50:16 1999 +0000

description:
Accept all kind of whitespaces when searching for the end of a nroff
macro.

diffstat:

 libexec/makewhatis/makewhatis.c |  30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)

diffs (95 lines):

diff -r 4262b42fdc19 -r 8a8cbec050e6 libexec/makewhatis/makewhatis.c
--- a/libexec/makewhatis/makewhatis.c   Fri Dec 31 14:28:03 1999 +0000
+++ b/libexec/makewhatis/makewhatis.c   Fri Dec 31 14:50:16 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: makewhatis.c,v 1.5 1999/12/31 14:28:03 tron Exp $      */
+/*     $NetBSD: makewhatis.c,v 1.6 1999/12/31 14:50:16 tron Exp $      */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
 #endif /* not lint */
 
 #ifndef lint
-__RCSID("$NetBSD: makewhatis.c,v 1.5 1999/12/31 14:28:03 tron Exp $");
+__RCSID("$NetBSD: makewhatis.c,v 1.6 1999/12/31 14:50:16 tron Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -74,6 +74,7 @@
 };
 
 int              main (int, char **);
+char           *findwhitespace(char *);
 char           *GetS(gzFile, char *, int);
 int             manpagesection (char *);
 int             addmanpage (manpage **, ino_t, char *);
@@ -158,6 +159,19 @@
 }
 
 char
+*findwhitespace(char *str)
+
+{
+       while (!isspace(*str))
+               if (*str++ == '\0') {
+                       str = NULL;
+                       break;
+               }
+
+       return str;
+}
+
+char
 *GetS(gzFile in, char *buffer, int length)
 
 {
@@ -398,7 +412,7 @@
                if (isspace(*from))
                        from++;
 
-               if ((sect = strchr(from, ' ')) != NULL) {
+               if ((sect = findwhitespace(from)) != NULL) {
                        int      length;
 
                        *sect++ = '\0';
@@ -434,10 +448,10 @@
                        ptr = &buffer[3];
                        if (isspace(*ptr))
                                ptr++;
-                       if ((ptr = strchr(ptr, ' ')) == NULL)
+                       if ((ptr = findwhitespace(ptr)) == NULL)
                                continue;
 
-                       if ((end = strchr(++ptr, ' ')) != NULL)
+                       if ((end = findwhitespace(++ptr)) != NULL)
                                *end = '\0';
 
                        free(section);
@@ -516,7 +530,7 @@
                                if (*ptr == '.') {
                                        char    *space;
 
-                                       if ((space = strchr(ptr, ' ')) == NULL)
+                                       if ((space = findwhitespace(ptr)) == NULL)
                                                ptr = "";
                                        else {
                                                space++;
@@ -548,7 +562,7 @@
                if (*buffer == '.') {
                        char    *space;
 
-                       if ((space = strchr(buffer, ' ')) == NULL) {
+                       if ((space = findwhitespace(buffer)) == NULL) {
                                free(section);
                                return NULL;
                        }
@@ -577,7 +591,7 @@
                        if (*ptr == '.') {
                                char    *space;
 
-                               if ((space = strchr(ptr, ' ')) == NULL) {
+                               if ((space = findwhitespace(ptr)) == NULL) {
                                        continue;
                                }
 



Home | Main Index | Thread Index | Old Index