Source-Changes-HG archive

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

[src/trunk]: src/libexec/makewhatis Handle ".Xr" commands with text after the...



details:   https://anonhg.NetBSD.org/src/rev/d0440bb7f447
branches:  trunk
changeset: 520956:d0440bb7f447
user:      tron <tron%NetBSD.org@localhost>
date:      Mon Jan 21 12:21:31 2002 +0000

description:
Handle ".Xr" commands with text after the section number probably.
This fixes PR bin/15253 by Thomas Klausner.

diffstat:

 libexec/makewhatis/makewhatis.c |  18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diffs (47 lines):

diff -r 163d29c1e388 -r d0440bb7f447 libexec/makewhatis/makewhatis.c
--- a/libexec/makewhatis/makewhatis.c   Mon Jan 21 12:09:40 2002 +0000
+++ b/libexec/makewhatis/makewhatis.c   Mon Jan 21 12:21:31 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: makewhatis.c,v 1.18 2002/01/11 18:33:03 christos Exp $ */
+/*     $NetBSD: makewhatis.c,v 1.19 2002/01/21 12:21:31 tron Exp $     */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
 #endif /* not lint */
 
 #ifndef lint
-__RCSID("$NetBSD: makewhatis.c,v 1.18 2002/01/11 18:33:03 christos Exp $");
+__RCSID("$NetBSD: makewhatis.c,v 1.19 2002/01/21 12:21:31 tron Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -444,16 +444,26 @@
                        from++;
 
                if ((sect = findwhitespace(from)) != NULL) {
-                       size_t   length;
+                       size_t  length;
+                       char    *trail;
 
                        *sect++ = '\0';
+                       if ((trail = findwhitespace(sect)) != NULL)
+                               *trail++ = '\0';
                        length = strlen(from);
                        (void) memmove(line, from, length);
                        line[length++] = '(';
                        to = &line[length];
                        length = strlen(sect);
                        (void) memmove(to, sect, length);
-                       (void) strcpy(&to[length], ")");
+                       if (trail == NULL) {
+                               (void) strcpy(&to[length], ")");
+                       } else {
+                               to += length;
+                               *to++ = ')';
+                               length = strlen(trail);
+                               (void) memmove(to, trail, length + 1);
+                       }
                }
        }
 



Home | Main Index | Thread Index | Old Index