summaryrefslogtreecommitdiff
path: root/libexec/makewhatis
diff options
context:
space:
mode:
authortron <tron@NetBSD.org>2002-01-21 12:21:31 +0000
committertron <tron@NetBSD.org>2002-01-21 12:21:31 +0000
commitace258d3b24d8a28ef2465adeada5b523f394b0c (patch)
treefb853dccd0ec628c3dc86c45de89446147f458b5 /libexec/makewhatis
parent6a44d2c6019b497153699788e7f1caa3911aee0a (diff)
Handle ".Xr" commands with text after the section number probably.
This fixes PR bin/15253 by Thomas Klausner.
Diffstat (limited to 'libexec/makewhatis')
-rw-r--r--libexec/makewhatis/makewhatis.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/libexec/makewhatis/makewhatis.c b/libexec/makewhatis/makewhatis.c
index 5607b218f5b..f9cb7c4e6eb 100644
--- a/libexec/makewhatis/makewhatis.c
+++ b/libexec/makewhatis/makewhatis.c
@@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1999 The NetBSD Foundation, Inc.\n\
#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 @@ manpreprocess(char *line)
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);
+ }
}
}