mandoc 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +7 -0
  3. data/COPYING +674 -0
  4. data/README.md +117 -0
  5. data/ext/mandoc/extconf.rb +59 -0
  6. data/ext/mandoc/rb_mandoc.c +548 -0
  7. data/ext/mandoc/rb_mandoc.h +22 -0
  8. data/lib/mandoc/version.rb +19 -0
  9. data/lib/mandoc.rb +26 -0
  10. data/mandoc-1.14.6/LICENSE +55 -0
  11. data/mandoc-1.14.6/arch.c +54 -0
  12. data/mandoc-1.14.6/att.c +49 -0
  13. data/mandoc-1.14.6/catman.c +260 -0
  14. data/mandoc-1.14.6/cgi.c +1279 -0
  15. data/mandoc-1.14.6/chars.c +507 -0
  16. data/mandoc-1.14.6/compat_err.c +103 -0
  17. data/mandoc-1.14.6/compat_fts.c +696 -0
  18. data/mandoc-1.14.6/compat_fts.h +106 -0
  19. data/mandoc-1.14.6/compat_getline.c +59 -0
  20. data/mandoc-1.14.6/compat_getsubopt.c +87 -0
  21. data/mandoc-1.14.6/compat_isblank.c +23 -0
  22. data/mandoc-1.14.6/compat_mkdtemp.c +50 -0
  23. data/mandoc-1.14.6/compat_mkstemps.c +63 -0
  24. data/mandoc-1.14.6/compat_ohash.c +330 -0
  25. data/mandoc-1.14.6/compat_ohash.h +72 -0
  26. data/mandoc-1.14.6/compat_progname.c +31 -0
  27. data/mandoc-1.14.6/compat_reallocarray.c +40 -0
  28. data/mandoc-1.14.6/compat_recallocarray.c +99 -0
  29. data/mandoc-1.14.6/compat_strcasestr.c +64 -0
  30. data/mandoc-1.14.6/compat_stringlist.c +135 -0
  31. data/mandoc-1.14.6/compat_stringlist.h +48 -0
  32. data/mandoc-1.14.6/compat_strlcat.c +57 -0
  33. data/mandoc-1.14.6/compat_strlcpy.c +52 -0
  34. data/mandoc-1.14.6/compat_strndup.c +42 -0
  35. data/mandoc-1.14.6/compat_strsep.c +70 -0
  36. data/mandoc-1.14.6/compat_strtonum.c +67 -0
  37. data/mandoc-1.14.6/compat_vasprintf.c +47 -0
  38. data/mandoc-1.14.6/config.h +52 -0
  39. data/mandoc-1.14.6/dba.c +508 -0
  40. data/mandoc-1.14.6/dba.h +50 -0
  41. data/mandoc-1.14.6/dba_array.c +190 -0
  42. data/mandoc-1.14.6/dba_array.h +47 -0
  43. data/mandoc-1.14.6/dba_read.c +74 -0
  44. data/mandoc-1.14.6/dba_write.c +127 -0
  45. data/mandoc-1.14.6/dba_write.h +30 -0
  46. data/mandoc-1.14.6/dbm.c +480 -0
  47. data/mandoc-1.14.6/dbm.h +68 -0
  48. data/mandoc-1.14.6/dbm_map.c +194 -0
  49. data/mandoc-1.14.6/dbm_map.h +29 -0
  50. data/mandoc-1.14.6/demandoc.c +260 -0
  51. data/mandoc-1.14.6/eqn.c +1132 -0
  52. data/mandoc-1.14.6/eqn.h +72 -0
  53. data/mandoc-1.14.6/eqn_html.c +246 -0
  54. data/mandoc-1.14.6/eqn_parse.h +48 -0
  55. data/mandoc-1.14.6/eqn_term.c +174 -0
  56. data/mandoc-1.14.6/html.c +1102 -0
  57. data/mandoc-1.14.6/html.h +142 -0
  58. data/mandoc-1.14.6/lib.c +35 -0
  59. data/mandoc-1.14.6/libman.h +42 -0
  60. data/mandoc-1.14.6/libmandoc.h +85 -0
  61. data/mandoc-1.14.6/libmdoc.h +87 -0
  62. data/mandoc-1.14.6/main.c +1375 -0
  63. data/mandoc-1.14.6/main.h +53 -0
  64. data/mandoc-1.14.6/man.c +345 -0
  65. data/mandoc-1.14.6/man.h +21 -0
  66. data/mandoc-1.14.6/man_html.c +640 -0
  67. data/mandoc-1.14.6/man_macro.c +470 -0
  68. data/mandoc-1.14.6/man_term.c +1143 -0
  69. data/mandoc-1.14.6/man_validate.c +660 -0
  70. data/mandoc-1.14.6/manconf.h +58 -0
  71. data/mandoc-1.14.6/mandoc.c +669 -0
  72. data/mandoc-1.14.6/mandoc.h +329 -0
  73. data/mandoc-1.14.6/mandoc_aux.c +118 -0
  74. data/mandoc-1.14.6/mandoc_aux.h +27 -0
  75. data/mandoc-1.14.6/mandoc_msg.c +375 -0
  76. data/mandoc-1.14.6/mandoc_ohash.c +65 -0
  77. data/mandoc-1.14.6/mandoc_ohash.h +23 -0
  78. data/mandoc-1.14.6/mandoc_parse.h +44 -0
  79. data/mandoc-1.14.6/mandoc_xr.c +123 -0
  80. data/mandoc-1.14.6/mandoc_xr.h +31 -0
  81. data/mandoc-1.14.6/mandocd.c +282 -0
  82. data/mandoc-1.14.6/mandocdb.c +2448 -0
  83. data/mandoc-1.14.6/manpath.c +363 -0
  84. data/mandoc-1.14.6/mansearch.c +851 -0
  85. data/mandoc-1.14.6/mansearch.h +118 -0
  86. data/mandoc-1.14.6/mdoc.c +433 -0
  87. data/mandoc-1.14.6/mdoc.h +158 -0
  88. data/mandoc-1.14.6/mdoc_argv.c +682 -0
  89. data/mandoc-1.14.6/mdoc_html.c +1762 -0
  90. data/mandoc-1.14.6/mdoc_macro.c +1600 -0
  91. data/mandoc-1.14.6/mdoc_man.c +1850 -0
  92. data/mandoc-1.14.6/mdoc_markdown.c +1610 -0
  93. data/mandoc-1.14.6/mdoc_state.c +256 -0
  94. data/mandoc-1.14.6/mdoc_term.c +1964 -0
  95. data/mandoc-1.14.6/mdoc_validate.c +3062 -0
  96. data/mandoc-1.14.6/msec.c +37 -0
  97. data/mandoc-1.14.6/out.c +544 -0
  98. data/mandoc-1.14.6/out.h +70 -0
  99. data/mandoc-1.14.6/preconv.c +179 -0
  100. data/mandoc-1.14.6/read.c +732 -0
  101. data/mandoc-1.14.6/roff.c +4390 -0
  102. data/mandoc-1.14.6/roff.h +561 -0
  103. data/mandoc-1.14.6/roff_html.c +119 -0
  104. data/mandoc-1.14.6/roff_int.h +94 -0
  105. data/mandoc-1.14.6/roff_term.c +266 -0
  106. data/mandoc-1.14.6/roff_validate.c +151 -0
  107. data/mandoc-1.14.6/soelim.c +182 -0
  108. data/mandoc-1.14.6/st.c +82 -0
  109. data/mandoc-1.14.6/tag.c +327 -0
  110. data/mandoc-1.14.6/tag.h +35 -0
  111. data/mandoc-1.14.6/tbl.c +183 -0
  112. data/mandoc-1.14.6/tbl.h +121 -0
  113. data/mandoc-1.14.6/tbl_data.c +323 -0
  114. data/mandoc-1.14.6/tbl_html.c +293 -0
  115. data/mandoc-1.14.6/tbl_int.h +47 -0
  116. data/mandoc-1.14.6/tbl_layout.c +376 -0
  117. data/mandoc-1.14.6/tbl_opts.c +173 -0
  118. data/mandoc-1.14.6/tbl_parse.h +30 -0
  119. data/mandoc-1.14.6/tbl_term.c +948 -0
  120. data/mandoc-1.14.6/term.c +1113 -0
  121. data/mandoc-1.14.6/term.h +158 -0
  122. data/mandoc-1.14.6/term_ascii.c +424 -0
  123. data/mandoc-1.14.6/term_ps.c +1362 -0
  124. data/mandoc-1.14.6/term_tab.c +130 -0
  125. data/mandoc-1.14.6/term_tag.c +227 -0
  126. data/mandoc-1.14.6/term_tag.h +34 -0
  127. data/mandoc-1.14.6/tree.c +536 -0
  128. metadata +170 -0
@@ -0,0 +1,53 @@
1
+ /* $Id: main.h,v 1.30 2019/03/03 13:02:11 schwarze Exp $ */
2
+ /*
3
+ * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4
+ * Copyright (c) 2014, 2015, 2019 Ingo Schwarze <schwarze@openbsd.org>
5
+ *
6
+ * Permission to use, copy, modify, and distribute this software for any
7
+ * purpose with or without fee is hereby granted, provided that the above
8
+ * copyright notice and this permission notice appear in all copies.
9
+ *
10
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
11
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
13
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
+ */
18
+
19
+ struct roff_meta;
20
+ struct manoutput;
21
+
22
+ /*
23
+ * Definitions for main.c-visible output device functions, e.g., -Thtml
24
+ * and -Tascii. Note that ascii_alloc() is named as such in
25
+ * anticipation of latin1_alloc() and so on, all of which map into the
26
+ * terminal output routines with different character settings.
27
+ */
28
+
29
+ void *html_alloc(const struct manoutput *);
30
+ void html_mdoc(void *, const struct roff_meta *);
31
+ void html_man(void *, const struct roff_meta *);
32
+ void html_reset(void *);
33
+ void html_free(void *);
34
+
35
+ void tree_mdoc(void *, const struct roff_meta *);
36
+ void tree_man(void *, const struct roff_meta *);
37
+
38
+ void man_mdoc(void *, const struct roff_meta *);
39
+
40
+ void *locale_alloc(const struct manoutput *);
41
+ void *utf8_alloc(const struct manoutput *);
42
+ void *ascii_alloc(const struct manoutput *);
43
+ void ascii_free(void *);
44
+
45
+ void *pdf_alloc(const struct manoutput *);
46
+ void *ps_alloc(const struct manoutput *);
47
+ void pspdf_free(void *);
48
+
49
+ void terminal_mdoc(void *, const struct roff_meta *);
50
+ void terminal_man(void *, const struct roff_meta *);
51
+ void terminal_sepline(void *);
52
+
53
+ void markdown_mdoc(void *, const struct roff_meta *);
@@ -0,0 +1,345 @@
1
+ /* $Id: man.c,v 1.187 2019/01/05 00:36:50 schwarze Exp $ */
2
+ /*
3
+ * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4
+ * Copyright (c) 2013-2015, 2017-2019 Ingo Schwarze <schwarze@openbsd.org>
5
+ * Copyright (c) 2011 Joerg Sonnenberger <joerg@netbsd.org>
6
+ *
7
+ * Permission to use, copy, modify, and distribute this software for any
8
+ * purpose with or without fee is hereby granted, provided that the above
9
+ * copyright notice and this permission notice appear in all copies.
10
+ *
11
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
12
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
14
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
+ */
19
+ #include "config.h"
20
+
21
+ #include <sys/types.h>
22
+
23
+ #include <assert.h>
24
+ #include <ctype.h>
25
+ #include <stdarg.h>
26
+ #include <stdlib.h>
27
+ #include <stdio.h>
28
+ #include <string.h>
29
+
30
+ #include "mandoc_aux.h"
31
+ #include "mandoc.h"
32
+ #include "roff.h"
33
+ #include "man.h"
34
+ #include "libmandoc.h"
35
+ #include "roff_int.h"
36
+ #include "libman.h"
37
+
38
+ static char *man_hasc(char *);
39
+ static int man_ptext(struct roff_man *, int, char *, int);
40
+ static int man_pmacro(struct roff_man *, int, char *, int);
41
+
42
+
43
+ int
44
+ man_parseln(struct roff_man *man, int ln, char *buf, int offs)
45
+ {
46
+
47
+ if (man->last->type != ROFFT_EQN || ln > man->last->line)
48
+ man->flags |= MAN_NEWLINE;
49
+
50
+ return roff_getcontrol(man->roff, buf, &offs) ?
51
+ man_pmacro(man, ln, buf, offs) :
52
+ man_ptext(man, ln, buf, offs);
53
+ }
54
+
55
+ /*
56
+ * If the string ends with \c, return a pointer to the backslash.
57
+ * Otherwise, return NULL.
58
+ */
59
+ static char *
60
+ man_hasc(char *start)
61
+ {
62
+ char *cp, *ep;
63
+
64
+ ep = strchr(start, '\0') - 2;
65
+ if (ep < start || ep[0] != '\\' || ep[1] != 'c')
66
+ return NULL;
67
+ for (cp = ep; cp > start; cp--)
68
+ if (cp[-1] != '\\')
69
+ break;
70
+ return (ep - cp) % 2 ? NULL : ep;
71
+ }
72
+
73
+ void
74
+ man_descope(struct roff_man *man, int line, int offs, char *start)
75
+ {
76
+ /* Trailing \c keeps next-line scope open. */
77
+
78
+ if (start != NULL && man_hasc(start) != NULL)
79
+ return;
80
+
81
+ /*
82
+ * Co-ordinate what happens with having a next-line scope open:
83
+ * first close out the element scopes (if applicable),
84
+ * then close out the block scope (also if applicable).
85
+ */
86
+
87
+ if (man->flags & MAN_ELINE) {
88
+ while (man->last->parent->type != ROFFT_ROOT &&
89
+ man_macro(man->last->parent->tok)->flags & MAN_ESCOPED)
90
+ man_unscope(man, man->last->parent);
91
+ man->flags &= ~MAN_ELINE;
92
+ }
93
+ if ( ! (man->flags & MAN_BLINE))
94
+ return;
95
+ man_unscope(man, man->last->parent);
96
+ roff_body_alloc(man, line, offs, man->last->tok);
97
+ man->flags &= ~(MAN_BLINE | ROFF_NONOFILL);
98
+ }
99
+
100
+ static int
101
+ man_ptext(struct roff_man *man, int line, char *buf, int offs)
102
+ {
103
+ int i;
104
+ char *ep;
105
+
106
+ /* In no-fill mode, whitespace is preserved on text lines. */
107
+
108
+ if (man->flags & ROFF_NOFILL) {
109
+ roff_word_alloc(man, line, offs, buf + offs);
110
+ man_descope(man, line, offs, buf + offs);
111
+ return 1;
112
+ }
113
+
114
+ for (i = offs; buf[i] == ' '; i++)
115
+ /* Skip leading whitespace. */ ;
116
+
117
+ /*
118
+ * Blank lines are ignored in next line scope
119
+ * and right after headings and cancel preceding \c,
120
+ * but add a single vertical space elsewhere.
121
+ */
122
+
123
+ if (buf[i] == '\0') {
124
+ if (man->flags & (MAN_ELINE | MAN_BLINE)) {
125
+ mandoc_msg(MANDOCERR_BLK_BLANK, line, 0, NULL);
126
+ return 1;
127
+ }
128
+ if (man->last->tok == MAN_SH || man->last->tok == MAN_SS)
129
+ return 1;
130
+ if (man->last->type == ROFFT_TEXT &&
131
+ ((ep = man_hasc(man->last->string)) != NULL)) {
132
+ *ep = '\0';
133
+ return 1;
134
+ }
135
+ roff_elem_alloc(man, line, offs, ROFF_sp);
136
+ man->next = ROFF_NEXT_SIBLING;
137
+ return 1;
138
+ }
139
+
140
+ /*
141
+ * Warn if the last un-escaped character is whitespace. Then
142
+ * strip away the remaining spaces (tabs stay!).
143
+ */
144
+
145
+ i = (int)strlen(buf);
146
+ assert(i);
147
+
148
+ if (' ' == buf[i - 1] || '\t' == buf[i - 1]) {
149
+ if (i > 1 && '\\' != buf[i - 2])
150
+ mandoc_msg(MANDOCERR_SPACE_EOL, line, i - 1, NULL);
151
+
152
+ for (--i; i && ' ' == buf[i]; i--)
153
+ /* Spin back to non-space. */ ;
154
+
155
+ /* Jump ahead of escaped whitespace. */
156
+ i += '\\' == buf[i] ? 2 : 1;
157
+
158
+ buf[i] = '\0';
159
+ }
160
+ roff_word_alloc(man, line, offs, buf + offs);
161
+
162
+ /*
163
+ * End-of-sentence check. If the last character is an unescaped
164
+ * EOS character, then flag the node as being the end of a
165
+ * sentence. The front-end will know how to interpret this.
166
+ */
167
+
168
+ assert(i);
169
+ if (mandoc_eos(buf, (size_t)i))
170
+ man->last->flags |= NODE_EOS;
171
+
172
+ man_descope(man, line, offs, buf + offs);
173
+ return 1;
174
+ }
175
+
176
+ static int
177
+ man_pmacro(struct roff_man *man, int ln, char *buf, int offs)
178
+ {
179
+ struct roff_node *n;
180
+ const char *cp;
181
+ size_t sz;
182
+ enum roff_tok tok;
183
+ int ppos;
184
+ int bline;
185
+
186
+ /* Determine the line macro. */
187
+
188
+ ppos = offs;
189
+ tok = TOKEN_NONE;
190
+ for (sz = 0; sz < 4 && strchr(" \t\\", buf[offs]) == NULL; sz++)
191
+ offs++;
192
+ if (sz > 0 && sz < 4)
193
+ tok = roffhash_find(man->manmac, buf + ppos, sz);
194
+ if (tok == TOKEN_NONE) {
195
+ mandoc_msg(MANDOCERR_MACRO, ln, ppos, "%s", buf + ppos - 1);
196
+ return 1;
197
+ }
198
+
199
+ /* Skip a leading escape sequence or tab. */
200
+
201
+ switch (buf[offs]) {
202
+ case '\\':
203
+ cp = buf + offs + 1;
204
+ mandoc_escape(&cp, NULL, NULL);
205
+ offs = cp - buf;
206
+ break;
207
+ case '\t':
208
+ offs++;
209
+ break;
210
+ default:
211
+ break;
212
+ }
213
+
214
+ /* Jump to the next non-whitespace word. */
215
+
216
+ while (buf[offs] == ' ')
217
+ offs++;
218
+
219
+ /*
220
+ * Trailing whitespace. Note that tabs are allowed to be passed
221
+ * into the parser as "text", so we only warn about spaces here.
222
+ */
223
+
224
+ if (buf[offs] == '\0' && buf[offs - 1] == ' ')
225
+ mandoc_msg(MANDOCERR_SPACE_EOL, ln, offs - 1, NULL);
226
+
227
+ /*
228
+ * Some macros break next-line scopes; otherwise, remember
229
+ * whether we are in next-line scope for a block head.
230
+ */
231
+
232
+ man_breakscope(man, tok);
233
+ bline = man->flags & MAN_BLINE;
234
+
235
+ /*
236
+ * If the line in next-line scope ends with \c, keep the
237
+ * next-line scope open for the subsequent input line.
238
+ * That is not at all portable, only groff >= 1.22.4
239
+ * does it, but *if* this weird idiom occurs in a manual
240
+ * page, that's very likely what the author intended.
241
+ */
242
+
243
+ if (bline && man_hasc(buf + offs))
244
+ bline = 0;
245
+
246
+ /* Call to handler... */
247
+
248
+ (*man_macro(tok)->fp)(man, tok, ln, ppos, &offs, buf);
249
+
250
+ /* In quick mode (for mandocdb), abort after the NAME section. */
251
+
252
+ if (man->quick && tok == MAN_SH) {
253
+ n = man->last;
254
+ if (n->type == ROFFT_BODY &&
255
+ strcmp(n->prev->child->string, "NAME"))
256
+ return 2;
257
+ }
258
+
259
+ /*
260
+ * If we are in a next-line scope for a block head,
261
+ * close it out now and switch to the body,
262
+ * unless the next-line scope is allowed to continue.
263
+ */
264
+
265
+ if (bline == 0 ||
266
+ (man->flags & MAN_BLINE) == 0 ||
267
+ man->flags & MAN_ELINE ||
268
+ man_macro(tok)->flags & MAN_NSCOPED)
269
+ return 1;
270
+
271
+ man_unscope(man, man->last->parent);
272
+ roff_body_alloc(man, ln, ppos, man->last->tok);
273
+ man->flags &= ~(MAN_BLINE | ROFF_NONOFILL);
274
+ return 1;
275
+ }
276
+
277
+ void
278
+ man_breakscope(struct roff_man *man, int tok)
279
+ {
280
+ struct roff_node *n;
281
+
282
+ /*
283
+ * An element next line scope is open,
284
+ * and the new macro is not allowed inside elements.
285
+ * Delete the element that is being broken.
286
+ */
287
+
288
+ if (man->flags & MAN_ELINE && (tok < MAN_TH ||
289
+ (man_macro(tok)->flags & MAN_NSCOPED) == 0)) {
290
+ n = man->last;
291
+ if (n->type == ROFFT_TEXT)
292
+ n = n->parent;
293
+ if (n->tok < MAN_TH ||
294
+ (man_macro(n->tok)->flags & (MAN_NSCOPED | MAN_ESCOPED))
295
+ == MAN_NSCOPED)
296
+ n = n->parent;
297
+
298
+ mandoc_msg(MANDOCERR_BLK_LINE, n->line, n->pos,
299
+ "%s breaks %s", roff_name[tok], roff_name[n->tok]);
300
+
301
+ roff_node_delete(man, n);
302
+ man->flags &= ~MAN_ELINE;
303
+ }
304
+
305
+ /*
306
+ * Weird special case:
307
+ * Switching fill mode closes section headers.
308
+ */
309
+
310
+ if (man->flags & MAN_BLINE &&
311
+ (tok == ROFF_nf || tok == ROFF_fi) &&
312
+ (man->last->tok == MAN_SH || man->last->tok == MAN_SS)) {
313
+ n = man->last;
314
+ man_unscope(man, n);
315
+ roff_body_alloc(man, n->line, n->pos, n->tok);
316
+ man->flags &= ~(MAN_BLINE | ROFF_NONOFILL);
317
+ }
318
+
319
+ /*
320
+ * A block header next line scope is open,
321
+ * and the new macro is not allowed inside block headers.
322
+ * Delete the block that is being broken.
323
+ */
324
+
325
+ if (man->flags & MAN_BLINE && tok != ROFF_nf && tok != ROFF_fi &&
326
+ (tok < MAN_TH || man_macro(tok)->flags & MAN_XSCOPE)) {
327
+ n = man->last;
328
+ if (n->type == ROFFT_TEXT)
329
+ n = n->parent;
330
+ if (n->tok < MAN_TH ||
331
+ (man_macro(n->tok)->flags & MAN_XSCOPE) == 0)
332
+ n = n->parent;
333
+
334
+ assert(n->type == ROFFT_HEAD);
335
+ n = n->parent;
336
+ assert(n->type == ROFFT_BLOCK);
337
+ assert(man_macro(n->tok)->flags & MAN_BSCOPED);
338
+
339
+ mandoc_msg(MANDOCERR_BLK_LINE, n->line, n->pos,
340
+ "%s breaks %s", roff_name[tok], roff_name[n->tok]);
341
+
342
+ roff_node_delete(man, n);
343
+ man->flags &= ~(MAN_BLINE | ROFF_NONOFILL);
344
+ }
345
+ }
@@ -0,0 +1,21 @@
1
+ /* $Id: man.h,v 1.79 2018/08/23 19:33:27 schwarze Exp $ */
2
+ /*
3
+ * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4
+ * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
5
+ *
6
+ * Permission to use, copy, modify, and distribute this software for any
7
+ * purpose with or without fee is hereby granted, provided that the above
8
+ * copyright notice and this permission notice appear in all copies.
9
+ *
10
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
11
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
13
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
+ */
18
+
19
+ struct roff_man;
20
+
21
+ void man_validate(struct roff_man *);