Source-Changes-HG archive

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

[src/trunk]: src/libexec/makewhatis Don't write leading white spaces and dire...



details:   https://anonhg.NetBSD.org/src/rev/aea3978aa4b2
branches:  trunk
changeset: 481213:aea3978aa4b2
user:      tron <tron%NetBSD.org@localhost>
date:      Mon Jan 24 23:03:54 2000 +0000

description:
Don't write leading white spaces and directory names to whatis file.

diffstat:

 libexec/makewhatis/makewhatis.c |  24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diffs (59 lines):

diff -r d19fe7417616 -r aea3978aa4b2 libexec/makewhatis/makewhatis.c
--- a/libexec/makewhatis/makewhatis.c   Mon Jan 24 22:38:21 2000 +0000
+++ b/libexec/makewhatis/makewhatis.c   Mon Jan 24 23:03:54 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: makewhatis.c,v 1.6 1999/12/31 14:50:16 tron Exp $      */
+/*     $NetBSD: makewhatis.c,v 1.7 2000/01/24 23:03:54 tron Exp $      */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
 #endif /* not lint */
 
 #ifndef lint
-__RCSID("$NetBSD: makewhatis.c,v 1.6 1999/12/31 14:50:16 tron Exp $");
+__RCSID("$NetBSD: makewhatis.c,v 1.7 2000/01/24 23:03:54 tron Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -237,6 +237,18 @@
        whatis *wi;
        int result;
 
+       while (isspace(*data))
+               data++;
+
+       if (*data == '/') {
+               char *ptr;
+
+               ptr = ++data;
+               while ((*ptr != '\0') && !isspace(*ptr))
+                       if (*ptr++ == '/')
+                               data = ptr;
+       }
+
        while ((wi = *tree) != NULL) {
                result=strcmp(data, wi->wi_data);
                if (result == 0) return 1;
@@ -394,6 +406,12 @@
                        case '\0':
                        case '-':
                                break;
+                       case 's':
+                               if ((*from=='+') || (*from=='-'))
+                                       from++;
+                               while (isdigit(*from))
+                                       from++;
+                               break;
                        default:
                                from++;
                        }
@@ -475,7 +493,7 @@
                int     length, offset;
 
                ptr = &buffer[3];
-               if (isspace(*ptr))
+               while (isspace(*ptr))
                        ptr++;
 
                length = strlen(ptr);



Home | Main Index | Thread Index | Old Index