version 1.59, 2013/06/05 17:48:14 |
version 1.61, 2013/06/05 21:21:08 |
Line 140 static void ofadd(int, const char *, const char *, co |
|
Line 140 static void ofadd(int, const char *, const char *, co |
|
static void offree(void); |
static void offree(void); |
static void ofmerge(struct mchars *, struct mparse *); |
static void ofmerge(struct mchars *, struct mparse *); |
static void parse_catpage(struct of *); |
static void parse_catpage(struct of *); |
static int parse_man(struct of *, |
static void parse_man(struct of *, const struct man_node *); |
const struct man_node *); |
|
static void parse_mdoc(struct of *, const struct mdoc_node *); |
static void parse_mdoc(struct of *, const struct mdoc_node *); |
static int parse_mdoc_body(struct of *, const struct mdoc_node *); |
static int parse_mdoc_body(struct of *, const struct mdoc_node *); |
static int parse_mdoc_head(struct of *, const struct mdoc_node *); |
static int parse_mdoc_head(struct of *, const struct mdoc_node *); |
|
|
* Disallow duplicate (hard-linked) files. |
* Disallow duplicate (hard-linked) files. |
*/ |
*/ |
if (FTS_F == ff->fts_info) { |
if (FTS_F == ff->fts_info) { |
|
if (0 == strcmp(path, MANDOC_DB)) |
|
continue; |
if ( ! use_all && ff->fts_level < 2) { |
if ( ! use_all && ff->fts_level < 2) { |
if (warnings) |
if (warnings) |
say(path, "Extraneous file"); |
say(path, "Extraneous file"); |
|
|
if (warnings) |
if (warnings) |
say(path, "Duplicate file"); |
say(path, "Duplicate file"); |
continue; |
continue; |
} |
} else if (NULL == (sec = |
|
strrchr(ff->fts_name, '.'))) { |
cp = ff->fts_name; |
if ( ! use_all) { |
|
|
if (0 == strcmp(cp, "mandocdb.db")) { |
|
if (warnings) |
|
say(path, "Skip database"); |
|
continue; |
|
} else if (NULL != (cp = strrchr(cp, '.'))) { |
|
if (0 == strcmp(cp + 1, "html")) { |
|
if (warnings) |
if (warnings) |
say(path, "Skip html"); |
say(path, |
|
"No filename suffix"); |
continue; |
continue; |
} else if (0 == strcmp(cp + 1, "gz")) { |
|
if (warnings) |
|
say(path, "Skip gz"); |
|
continue; |
|
} else if (0 == strcmp(cp + 1, "ps")) { |
|
if (warnings) |
|
say(path, "Skip ps"); |
|
continue; |
|
} else if (0 == strcmp(cp + 1, "pdf")) { |
|
if (warnings) |
|
say(path, "Skip pdf"); |
|
continue; |
|
} |
} |
|
} else if (0 == strcmp(++sec, "html")) { |
|
if (warnings) |
|
say(path, "Skip html"); |
|
continue; |
|
} else if (0 == strcmp(sec, "gz")) { |
|
if (warnings) |
|
say(path, "Skip gz"); |
|
continue; |
|
} else if (0 == strcmp(sec, "ps")) { |
|
if (warnings) |
|
say(path, "Skip ps"); |
|
continue; |
|
} else if (0 == strcmp(sec, "pdf")) { |
|
if (warnings) |
|
say(path, "Skip pdf"); |
|
continue; |
|
} else if ( ! use_all && |
|
((FORM_SRC == dform && strcmp(sec, dsec)) || |
|
(FORM_CAT == dform && strcmp(sec, "0")))) { |
|
if (warnings) |
|
say(path, "Wrong filename suffix"); |
|
continue; |
|
} else { |
|
sec[-1] = '\0'; |
|
sec = stradd(sec); |
} |
} |
|
|
if (NULL != (sec = strrchr(ff->fts_name, '.'))) { |
|
*sec = '\0'; |
|
sec = stradd(sec + 1); |
|
} |
|
name = stradd(ff->fts_name); |
name = stradd(ff->fts_name); |
ofadd(dform, path, |
ofadd(dform, path, |
name, dsec, sec, arch, ff->fts_statp); |
name, dsec, sec, arch, ff->fts_statp); |
continue; |
continue; |
} else if (FTS_D != ff->fts_info && |
} else if (FTS_D != ff->fts_info && |
FTS_DP != ff->fts_info) |
FTS_DP != ff->fts_info) { |
|
if (warnings) |
|
say(path, "Not a regular file"); |
continue; |
continue; |
|
} |
|
|
switch (ff->fts_level) { |
switch (ff->fts_level) { |
case (0): |
case (0): |
Line 1174 putmdockey(const struct of *of, const struct mdoc_node |
|
Line 1180 putmdockey(const struct of *of, const struct mdoc_node |
|
} |
} |
} |
} |
|
|
static int |
static void |
parse_man(struct of *of, const struct man_node *n) |
parse_man(struct of *of, const struct man_node *n) |
{ |
{ |
const struct man_node *head, *body; |
const struct man_node *head, *body; |
Line 1183 parse_man(struct of *of, const struct man_node *n) |
|
Line 1189 parse_man(struct of *of, const struct man_node *n) |
|
size_t sz, titlesz; |
size_t sz, titlesz; |
|
|
if (NULL == n) |
if (NULL == n) |
return(0); |
return; |
|
|
/* |
/* |
* We're only searching for one thing: the first text child in |
* We're only searching for one thing: the first text child in |
Line 1225 parse_man(struct of *of, const struct man_node *n) |
|
Line 1231 parse_man(struct of *of, const struct man_node *n) |
|
title[titlesz - 1] = ' '; |
title[titlesz - 1] = ' '; |
} |
} |
if (NULL == title) |
if (NULL == title) |
return(1); |
return; |
|
|
title = mandoc_realloc(title, titlesz + 1); |
title = mandoc_realloc(title, titlesz + 1); |
title[titlesz] = '\0'; |
title[titlesz] = '\0'; |
Line 1238 parse_man(struct of *of, const struct man_node *n) |
|
Line 1244 parse_man(struct of *of, const struct man_node *n) |
|
|
|
if (0 == (sz = strlen(sv))) { |
if (0 == (sz = strlen(sv))) { |
free(title); |
free(title); |
return(1); |
return; |
} |
} |
|
|
/* Erase trailing space. */ |
/* Erase trailing space. */ |
Line 1249 parse_man(struct of *of, const struct man_node *n) |
|
Line 1255 parse_man(struct of *of, const struct man_node *n) |
|
|
|
if (start == sv) { |
if (start == sv) { |
free(title); |
free(title); |
return(1); |
return; |
} |
} |
|
|
start = sv; |
start = sv; |
Line 1286 parse_man(struct of *of, const struct man_node *n) |
|
Line 1292 parse_man(struct of *of, const struct man_node *n) |
|
if (sv == start) { |
if (sv == start) { |
putkey(of, start, TYPE_Nm); |
putkey(of, start, TYPE_Nm); |
free(title); |
free(title); |
return(1); |
return; |
} |
} |
|
|
while (isspace((unsigned char)*start)) |
while (isspace((unsigned char)*start)) |
Line 1310 parse_man(struct of *of, const struct man_node *n) |
|
Line 1316 parse_man(struct of *of, const struct man_node *n) |
|
of->desc = stradd(start); |
of->desc = stradd(start); |
putkey(of, start, TYPE_Nd); |
putkey(of, start, TYPE_Nd); |
free(title); |
free(title); |
return(1); |
return; |
} |
} |
} |
} |
|
|
for (n = n->child; n; n = n->next) |
for (n = n->child; n; n = n->next) |
if (parse_man(of, n)) |
parse_man(of, n); |
return(1); |
|
|
|
return(0); |
|
} |
} |
|
|
static void |
static void |