version 1.172, 2015/04/02 22:48:17 |
version 1.174, 2015/04/04 11:44:43 |
|
|
#define DECL_ARGS struct termp *p, \ |
#define DECL_ARGS struct termp *p, \ |
struct mtermp *mt, \ |
struct mtermp *mt, \ |
struct roff_node *n, \ |
struct roff_node *n, \ |
const struct man_meta *meta |
const struct roff_meta *meta |
|
|
struct termact { |
struct termact { |
int (*pre)(DECL_ARGS); |
int (*pre)(DECL_ARGS); |
|
|
|
|
static void print_man_nodelist(DECL_ARGS); |
static void print_man_nodelist(DECL_ARGS); |
static void print_man_node(DECL_ARGS); |
static void print_man_node(DECL_ARGS); |
static void print_man_head(struct termp *, const void *); |
static void print_man_head(struct termp *, |
static void print_man_foot(struct termp *, const void *); |
const struct roff_meta *); |
|
static void print_man_foot(struct termp *, |
|
const struct roff_meta *); |
static void print_bvspace(struct termp *, |
static void print_bvspace(struct termp *, |
const struct roff_node *, int); |
const struct roff_node *, int); |
|
|
|
|
terminal_man(void *arg, const struct man *man) |
terminal_man(void *arg, const struct man *man) |
{ |
{ |
struct termp *p; |
struct termp *p; |
const struct man_meta *meta; |
const struct roff_meta *meta; |
struct roff_node *n; |
struct roff_node *n; |
struct mtermp mt; |
struct mtermp mt; |
|
|
Line 531 post_HP(DECL_ARGS) |
|
Line 533 post_HP(DECL_ARGS) |
|
switch (n->type) { |
switch (n->type) { |
case ROFFT_BODY: |
case ROFFT_BODY: |
term_newln(p); |
term_newln(p); |
|
|
|
/* |
|
* Compatibility with a groff bug. |
|
* The .HP macro uses the undocumented .tag request |
|
* which causes a line break and cancels no-space |
|
* mode even if there isn't any output. |
|
*/ |
|
|
|
if (n->child == NULL) |
|
term_vspace(p); |
|
|
p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND); |
p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND); |
p->trailspace = 0; |
p->trailspace = 0; |
p->offset = mt->offset; |
p->offset = mt->offset; |
Line 1012 print_man_nodelist(DECL_ARGS) |
|
Line 1025 print_man_nodelist(DECL_ARGS) |
|
} |
} |
|
|
static void |
static void |
print_man_foot(struct termp *p, const void *arg) |
print_man_foot(struct termp *p, const struct roff_meta *meta) |
{ |
{ |
const struct man_meta *meta; |
|
char *title; |
char *title; |
size_t datelen, titlen; |
size_t datelen, titlen; |
|
|
meta = (const struct man_meta *)arg; |
|
assert(meta->title); |
assert(meta->title); |
assert(meta->msec); |
assert(meta->msec); |
assert(meta->date); |
assert(meta->date); |
Line 1030 print_man_foot(struct termp *p, const void *arg) |
|
Line 1041 print_man_foot(struct termp *p, const void *arg) |
|
|
|
/* |
/* |
* Temporary, undocumented option to imitate mdoc(7) output. |
* Temporary, undocumented option to imitate mdoc(7) output. |
* In the bottom right corner, use the source instead of |
* In the bottom right corner, use the operating system |
* the title. |
* instead of the title. |
*/ |
*/ |
|
|
if ( ! p->mdocstyle) { |
if ( ! p->mdocstyle) { |
Line 1041 print_man_foot(struct termp *p, const void *arg) |
|
Line 1052 print_man_foot(struct termp *p, const void *arg) |
|
} |
} |
mandoc_asprintf(&title, "%s(%s)", |
mandoc_asprintf(&title, "%s(%s)", |
meta->title, meta->msec); |
meta->title, meta->msec); |
} else if (meta->source) { |
} else if (meta->os) { |
title = mandoc_strdup(meta->source); |
title = mandoc_strdup(meta->os); |
} else { |
} else { |
title = mandoc_strdup(""); |
title = mandoc_strdup(""); |
} |
} |
datelen = term_strlen(p, meta->date); |
datelen = term_strlen(p, meta->date); |
|
|
/* Bottom left corner: manual source. */ |
/* Bottom left corner: operating system. */ |
|
|
p->flags |= TERMP_NOSPACE | TERMP_NOBREAK; |
p->flags |= TERMP_NOSPACE | TERMP_NOBREAK; |
p->trailspace = 1; |
p->trailspace = 1; |
Line 1056 print_man_foot(struct termp *p, const void *arg) |
|
Line 1067 print_man_foot(struct termp *p, const void *arg) |
|
p->rmargin = p->maxrmargin > datelen ? |
p->rmargin = p->maxrmargin > datelen ? |
(p->maxrmargin + term_len(p, 1) - datelen) / 2 : 0; |
(p->maxrmargin + term_len(p, 1) - datelen) / 2 : 0; |
|
|
if (meta->source) |
if (meta->os) |
term_word(p, meta->source); |
term_word(p, meta->os); |
term_flushln(p); |
term_flushln(p); |
|
|
/* At the bottom in the middle: manual date. */ |
/* At the bottom in the middle: manual date. */ |
Line 1084 print_man_foot(struct termp *p, const void *arg) |
|
Line 1095 print_man_foot(struct termp *p, const void *arg) |
|
} |
} |
|
|
static void |
static void |
print_man_head(struct termp *p, const void *arg) |
print_man_head(struct termp *p, const struct roff_meta *meta) |
{ |
{ |
const struct man_meta *meta; |
|
const char *volume; |
const char *volume; |
char *title; |
char *title; |
size_t vollen, titlen; |
size_t vollen, titlen; |
|
|
meta = (const struct man_meta *)arg; |
|
assert(meta->title); |
assert(meta->title); |
assert(meta->msec); |
assert(meta->msec); |
|
|