version 1.120, 2013/10/17 20:54:58 |
version 1.125, 2014/03/23 11:25:26 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
|
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> |
|
* Copyright (c) 2011 Joerg Sonnenberger <joerg@netbsd.org> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
|
|
|
|
#include "man.h" |
#include "man.h" |
#include "mandoc.h" |
#include "mandoc.h" |
|
#include "mandoc_aux.h" |
#include "libman.h" |
#include "libman.h" |
#include "libmandoc.h" |
#include "libmandoc.h" |
|
|
Line 97 man_free(struct man *man) |
|
Line 100 man_free(struct man *man) |
|
|
|
|
|
struct man * |
struct man * |
man_alloc(struct roff *roff, struct mparse *parse) |
man_alloc(struct roff *roff, struct mparse *parse, int quick) |
{ |
{ |
struct man *p; |
struct man *p; |
|
|
Line 105 man_alloc(struct roff *roff, struct mparse *parse) |
|
Line 108 man_alloc(struct roff *roff, struct mparse *parse) |
|
|
|
man_hash_init(); |
man_hash_init(); |
p->parse = parse; |
p->parse = parse; |
|
p->quick = quick; |
p->roff = roff; |
p->roff = roff; |
|
|
man_alloc1(p); |
man_alloc1(p); |
Line 429 man_ptext(struct man *man, int line, char *buf, int of |
|
Line 433 man_ptext(struct man *man, int line, char *buf, int of |
|
return(man_descope(man, line, offs)); |
return(man_descope(man, line, offs)); |
} |
} |
|
|
/* Pump blank lines directly into the backend. */ |
|
|
|
for (i = offs; ' ' == buf[i]; i++) |
for (i = offs; ' ' == buf[i]; i++) |
/* Skip leading whitespace. */ ; |
/* Skip leading whitespace. */ ; |
|
|
|
/* |
|
* Blank lines are ignored right after headings |
|
* but add a single vertical space elsewhere. |
|
*/ |
|
|
if ('\0' == buf[i]) { |
if ('\0' == buf[i]) { |
/* Allocate a blank entry. */ |
/* Allocate a blank entry. */ |
if ( ! man_elem_alloc(man, line, offs, MAN_sp)) |
if (MAN_SH != man->last->tok && |
return(0); |
MAN_SS != man->last->tok) { |
man->next = MAN_NEXT_SIBLING; |
if ( ! man_elem_alloc(man, line, offs, MAN_sp)) |
|
return(0); |
|
man->next = MAN_NEXT_SIBLING; |
|
} |
return(1); |
return(1); |
} |
} |
|
|
Line 473 man_ptext(struct man *man, int line, char *buf, int of |
|
Line 483 man_ptext(struct man *man, int line, char *buf, int of |
|
*/ |
*/ |
|
|
assert(i); |
assert(i); |
if (mandoc_eos(buf, (size_t)i, 0)) |
if (mandoc_eos(buf, (size_t)i)) |
man->last->flags |= MAN_EOS; |
man->last->flags |= MAN_EOS; |
|
|
return(man_descope(man, line, offs)); |
return(man_descope(man, line, offs)); |
Line 597 man_pmacro(struct man *man, int ln, char *buf, int off |
|
Line 607 man_pmacro(struct man *man, int ln, char *buf, int off |
|
assert(man_macros[tok].fp); |
assert(man_macros[tok].fp); |
if ( ! (*man_macros[tok].fp)(man, tok, ln, ppos, &offs, buf)) |
if ( ! (*man_macros[tok].fp)(man, tok, ln, ppos, &offs, buf)) |
goto err; |
goto err; |
|
|
|
/* In quick mode (for mandocdb), abort after the NAME section. */ |
|
|
|
if (man->quick && MAN_SH == tok && |
|
strcmp(man->last->prev->child->string, "NAME")) |
|
return(2); |
|
|
/* |
/* |
* We weren't in a block-line scope when entering the |
* We weren't in a block-line scope when entering the |