version 1.45, 2012/03/23 05:45:45 |
version 1.46, 2012/03/23 06:52:17 |
|
|
|
|
usage: |
usage: |
fprintf(stderr, |
fprintf(stderr, |
"usage: %s [-avvv] [-C file] | dir ... | -t file ...\n" |
"usage: %s [-av] [-C file] | dir ... | -t file ...\n" |
" -d dir [file ...] | " |
" -d dir [file ...] | " |
"-u dir [file ...]\n", |
"-u dir [file ...]\n", |
progname); |
progname); |
Line 822 index_merge(const struct of *of, struct mparse *mp, |
|
Line 822 index_merge(const struct of *of, struct mparse *mp, |
|
while (0 == (*files->seq)(files, &key, &val, seq)) { |
while (0 == (*files->seq)(files, &key, &val, seq)) { |
seq = R_NEXT; |
seq = R_NEXT; |
if (val.size) |
if (val.size) |
fprintf(stderr, "%s: probably " |
WARNING((char *)val.data, basedir, |
"unreachable, title is %s\n", |
"Probably unreachable, title " |
(char *)val.data, (char *)key.data); |
"is %s", (char *)key.data); |
} |
} |
(*files->close)(files); |
(*files->close)(files); |
} |
} |
|
|
pman_node(MAN_ARGS) |
pman_node(MAN_ARGS) |
{ |
{ |
const struct man_node *head, *body; |
const struct man_node *head, *body; |
const char *start, *sv; |
char *start, *sv, *title; |
size_t sz; |
size_t sz, titlesz; |
|
|
if (NULL == n) |
if (NULL == n) |
return(0); |
return(0); |
Line 1347 pman_node(MAN_ARGS) |
|
Line 1347 pman_node(MAN_ARGS) |
|
NULL != (body = body->child) && |
NULL != (body = body->child) && |
MAN_TEXT == body->type) { |
MAN_TEXT == body->type) { |
|
|
assert(body->string); |
title = NULL; |
start = sv = body->string; |
titlesz = 0; |
|
/* |
|
* Suck the entire NAME section into memory. |
|
* Yes, we might run away. |
|
* But too many manuals have big, spread-out |
|
* NAME sections over many lines. |
|
*/ |
|
for ( ; NULL != body; body = body->next) { |
|
if (MAN_TEXT != body->type) |
|
break; |
|
if (0 == (sz = strlen(body->string))) |
|
continue; |
|
title = mandoc_realloc |
|
(title, titlesz + sz + 1); |
|
memcpy(title + titlesz, body->string, sz); |
|
titlesz += sz + 1; |
|
title[(int)titlesz - 1] = ' '; |
|
} |
|
if (NULL == title) |
|
return(0); |
|
|
|
title = mandoc_realloc(title, titlesz + 1); |
|
title[(int)titlesz] = '\0'; |
|
|
|
/* Skip leading space. */ |
|
|
|
sv = title; |
|
while (isspace((unsigned char)*sv)) |
|
sv++; |
|
|
|
if (0 == (sz = strlen(sv))) { |
|
free(title); |
|
return(0); |
|
} |
|
|
|
/* Erase trailing space. */ |
|
|
|
start = &sv[sz - 1]; |
|
while (start > sv && isspace((unsigned char)*start)) |
|
*start-- = '\0'; |
|
|
|
if (start == sv) { |
|
free(title); |
|
return(0); |
|
} |
|
|
|
start = sv; |
|
|
/* |
/* |
* Go through a special heuristic dance here. |
* Go through a special heuristic dance here. |
* This is why -man manuals are great! |
* This is why -man manuals are great! |
Line 1386 pman_node(MAN_ARGS) |
|
Line 1432 pman_node(MAN_ARGS) |
|
|
|
if (sv == start) { |
if (sv == start) { |
buf_append(buf, start); |
buf_append(buf, start); |
|
free(title); |
return(1); |
return(1); |
} |
} |
|
|
while (' ' == *start) |
while (isspace((unsigned char)*start)) |
start++; |
start++; |
|
|
if (0 == strncmp(start, "-", 1)) |
if (0 == strncmp(start, "-", 1)) |
Line 1411 pman_node(MAN_ARGS) |
|
Line 1458 pman_node(MAN_ARGS) |
|
buf_appendb(buf, start, sz); |
buf_appendb(buf, start, sz); |
|
|
hash_put(hash, buf, TYPE_Nd); |
hash_put(hash, buf, TYPE_Nd); |
|
free(title); |
} |
} |
} |
} |
|
|