Module Name: othersrc
Committed By: agc
Date: Tue May 10 06:41:26 UTC 2011
Modified Files:
othersrc/external/bsd/gensetlist: gensetlist.c
Log Message:
Occasional MAN definitions can hold multiple pages (see src/bin/pax for one
example).
Change the parsing of the contents of MAN definitions so that both single
and multiple definitions of man pages can be recognised.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/gensetlist/gensetlist.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: othersrc/external/bsd/gensetlist/gensetlist.c
diff -u othersrc/external/bsd/gensetlist/gensetlist.c:1.2 othersrc/external/bsd/gensetlist/gensetlist.c:1.3
--- othersrc/external/bsd/gensetlist/gensetlist.c:1.2 Mon May 9 14:47:15 2011
+++ othersrc/external/bsd/gensetlist/gensetlist.c Tue May 10 06:41:26 2011
@@ -111,6 +111,7 @@
static regex_t bindir;
static regex_t libdir;
static regex_t mandir;
+ static regex_t subman;
static regex_t mlinks;
static regex_t shlib;
static regex_t incs;
@@ -124,7 +125,8 @@
if (!compiled) {
(void) regcomp(&lib, "^[ \t]*LIB[ \t]*=[ \t]*([^ \t]+)", REG_EXTENDED);
(void) regcomp(&libdir, "^[ \t]*LIBDIR[ \t]*=[ \t]*([^ \t]+)", REG_EXTENDED);
- (void) regcomp(&man, "^[ \t]*MAN[ \t]*([+]?=)[ \t]*([^ \t]+)", REG_EXTENDED);
+ (void) regcomp(&man, "^[ \t]*MAN[ \t]*=", REG_EXTENDED);
+ (void) regcomp(&subman, "^[ \t]*([^ \t]+)", REG_EXTENDED);
(void) regcomp(&prog, "^[ \t]*PROG[ \t]*=[ \t]*([^ \t]+)", REG_EXTENDED);
(void) regcomp(&bindir, "^[ \t]*BINDIR[ \t]*=[ \t]*([^ \t]+)", REG_EXTENDED);
(void) regcomp(&mandir, "^[ \t]*MANDIR[ \t]*=[ \t]*([^ \t]+)", REG_EXTENDED);
@@ -151,10 +153,14 @@
return 1;
}
if (regexec(&man, in, 10, matches, 0) == 0) {
- (void) asprintf(&vars->mans[vars->manc++],
- "%.*s",
- (int)(matches[2].rm_eo - matches[2].rm_so),
- &in[(int)matches[2].rm_so]);
+ for (cp = &in[(int)matches[0].rm_eo] ;
+ regexec(&subman, cp, 10, matches, 0) == 0 ;
+ cp += matches[0].rm_eo) {
+ (void) asprintf(&vars->mans[vars->manc++],
+ "%.*s",
+ (int)(matches[1].rm_eo - matches[1].rm_so),
+ &cp[(int)matches[1].rm_so]);
+ }
return 1;
}
if (regexec(&prog, in, 10, matches, 0) == 0) {