version 1.239, 2018/08/16 13:54:06 |
version 1.240, 2018/10/02 12:33:37 |
|
|
#include "config.h" |
#include "config.h" |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
|
#include <sys/stat.h> |
|
|
#include <assert.h> |
#include <assert.h> |
#include <ctype.h> |
#include <ctype.h> |
Line 128 html_alloc(const struct manoutput *outopts) |
|
Line 129 html_alloc(const struct manoutput *outopts) |
|
|
|
h->tag = NULL; |
h->tag = NULL; |
h->style = outopts->style; |
h->style = outopts->style; |
h->base_man = outopts->man; |
if ((h->base_man1 = outopts->man) == NULL) |
|
h->base_man2 = NULL; |
|
else if ((h->base_man2 = strchr(h->base_man1, ';')) != NULL) |
|
*h->base_man2++ = '\0'; |
h->base_includes = outopts->includes; |
h->base_includes = outopts->includes; |
if (outopts->fragment) |
if (outopts->fragment) |
h->oflags |= HTML_FRAGMENT; |
h->oflags |= HTML_FRAGMENT; |
Line 467 print_encode(struct html *h, const char *p, const char |
|
Line 471 print_encode(struct html *h, const char *p, const char |
|
static void |
static void |
print_href(struct html *h, const char *name, const char *sec, int man) |
print_href(struct html *h, const char *name, const char *sec, int man) |
{ |
{ |
|
struct stat sb; |
const char *p, *pp; |
const char *p, *pp; |
|
char *filename; |
|
|
pp = man ? h->base_man : h->base_includes; |
if (man) { |
|
pp = h->base_man1; |
|
if (h->base_man2 != NULL) { |
|
mandoc_asprintf(&filename, "%s.%s", name, sec); |
|
if (stat(filename, &sb) == -1) |
|
pp = h->base_man2; |
|
free(filename); |
|
} |
|
} else |
|
pp = h->base_includes; |
|
|
while ((p = strchr(pp, '%')) != NULL) { |
while ((p = strchr(pp, '%')) != NULL) { |
print_encode(h, pp, p, 1); |
print_encode(h, pp, p, 1); |
if (man && p[1] == 'S') { |
if (man && p[1] == 'S') { |