Annotation of mandoc/man.c, Revision 1.105
1.105 ! kristaps 1: /* $Id: man.c,v 1.104 2011/03/20 16:02:05 kristaps Exp $ */
1.1 kristaps 2: /*
1.102 schwarze 3: * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
1.1 kristaps 4: *
5: * Permission to use, copy, modify, and distribute this software for any
1.18 kristaps 6: * purpose with or without fee is hereby granted, provided that the above
7: * copyright notice and this permission notice appear in all copies.
1.1 kristaps 8: *
1.18 kristaps 9: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15: * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1.1 kristaps 16: */
1.47 kristaps 17: #ifdef HAVE_CONFIG_H
18: #include "config.h"
19: #endif
20:
1.41 kristaps 21: #include <sys/types.h>
22:
1.1 kristaps 23: #include <assert.h>
24: #include <stdarg.h>
25: #include <stdlib.h>
26: #include <stdio.h>
27: #include <string.h>
28:
1.105 ! kristaps 29: #include "man.h"
1.74 kristaps 30: #include "mandoc.h"
1.1 kristaps 31: #include "libman.h"
1.45 kristaps 32: #include "libmandoc.h"
1.1 kristaps 33:
34: const char *const __man_macronames[MAN_MAX] = {
1.21 kristaps 35: "br", "TH", "SH", "SS",
1.1 kristaps 36: "TP", "LP", "PP", "P",
37: "IP", "HP", "SM", "SB",
38: "BI", "IB", "BR", "RB",
1.11 kristaps 39: "R", "B", "I", "IR",
1.92 kristaps 40: "RI", "na", "sp", "nf",
41: "fi", "RE", "RS", "DT",
42: "UC", "PD", "AT", "in",
43: "ft"
1.1 kristaps 44: };
45:
46: const char * const *man_macronames = __man_macronames;
47:
1.97 kristaps 48: static struct man_node *man_node_alloc(struct man *, int, int,
1.53 kristaps 49: enum man_type, enum mant);
1.1 kristaps 50: static int man_node_append(struct man *,
51: struct man_node *);
1.54 kristaps 52: static void man_node_free(struct man_node *);
53: static void man_node_unlink(struct man *,
54: struct man_node *);
1.72 kristaps 55: static int man_ptext(struct man *, int, char *, int);
1.79 kristaps 56: static int man_pmacro(struct man *, int, char *, int);
1.2 kristaps 57: static void man_free1(struct man *);
1.45 kristaps 58: static void man_alloc1(struct man *);
1.94 kristaps 59: static int man_descope(struct man *, int, int);
1.1 kristaps 60:
61:
62: const struct man_node *
1.2 kristaps 63: man_node(const struct man *m)
1.1 kristaps 64: {
65:
1.96 kristaps 66: assert( ! (MAN_HALT & m->flags));
67: return(m->first);
1.1 kristaps 68: }
69:
70:
71: const struct man_meta *
1.2 kristaps 72: man_meta(const struct man *m)
1.1 kristaps 73: {
74:
1.96 kristaps 75: assert( ! (MAN_HALT & m->flags));
76: return(&m->meta);
1.1 kristaps 77: }
78:
79:
1.45 kristaps 80: void
1.1 kristaps 81: man_reset(struct man *man)
82: {
83:
1.2 kristaps 84: man_free1(man);
1.45 kristaps 85: man_alloc1(man);
1.1 kristaps 86: }
87:
88:
89: void
90: man_free(struct man *man)
91: {
92:
1.2 kristaps 93: man_free1(man);
1.1 kristaps 94: free(man);
95: }
96:
97:
98: struct man *
1.104 kristaps 99: man_alloc(struct regset *regs, struct mparse *parse)
1.1 kristaps 100: {
101: struct man *p;
102:
1.45 kristaps 103: p = mandoc_calloc(1, sizeof(struct man));
1.2 kristaps 104:
1.40 kristaps 105: man_hash_init();
1.104 kristaps 106: p->parse = parse;
1.79 kristaps 107: p->regs = regs;
1.45 kristaps 108:
109: man_alloc1(p);
1.1 kristaps 110: return(p);
111: }
112:
113:
114: int
115: man_endparse(struct man *m)
116: {
117:
1.96 kristaps 118: assert( ! (MAN_HALT & m->flags));
119: if (man_macroend(m))
1.3 kristaps 120: return(1);
121: m->flags |= MAN_HALT;
122: return(0);
1.1 kristaps 123: }
124:
125:
126: int
1.79 kristaps 127: man_parseln(struct man *m, int ln, char *buf, int offs)
1.1 kristaps 128: {
129:
1.97 kristaps 130: m->flags |= MAN_NEWLINE;
131:
1.96 kristaps 132: assert( ! (MAN_HALT & m->flags));
1.72 kristaps 133: return(('.' == buf[offs] || '\'' == buf[offs]) ?
1.79 kristaps 134: man_pmacro(m, ln, buf, offs) :
1.72 kristaps 135: man_ptext(m, ln, buf, offs));
1.1 kristaps 136: }
137:
138:
1.2 kristaps 139: static void
140: man_free1(struct man *man)
141: {
142:
143: if (man->first)
1.54 kristaps 144: man_node_delete(man, man->first);
1.2 kristaps 145: if (man->meta.title)
146: free(man->meta.title);
1.6 kristaps 147: if (man->meta.source)
148: free(man->meta.source);
1.102 schwarze 149: if (man->meta.date)
150: free(man->meta.date);
1.2 kristaps 151: if (man->meta.vol)
152: free(man->meta.vol);
1.68 kristaps 153: if (man->meta.msec)
154: free(man->meta.msec);
1.2 kristaps 155: }
156:
157:
1.45 kristaps 158: static void
1.2 kristaps 159: man_alloc1(struct man *m)
160: {
161:
1.44 kristaps 162: memset(&m->meta, 0, sizeof(struct man_meta));
1.2 kristaps 163: m->flags = 0;
1.45 kristaps 164: m->last = mandoc_calloc(1, sizeof(struct man_node));
1.2 kristaps 165: m->first = m->last;
166: m->last->type = MAN_ROOT;
1.54 kristaps 167: m->last->tok = MAN_MAX;
1.2 kristaps 168: m->next = MAN_NEXT_CHILD;
169: }
170:
171:
1.1 kristaps 172: static int
173: man_node_append(struct man *man, struct man_node *p)
174: {
175:
176: assert(man->last);
177: assert(man->first);
178: assert(MAN_ROOT != p->type);
179:
180: switch (man->next) {
181: case (MAN_NEXT_SIBLING):
182: man->last->next = p;
183: p->prev = man->last;
184: p->parent = man->last->parent;
185: break;
186: case (MAN_NEXT_CHILD):
187: man->last->child = p;
188: p->parent = man->last;
189: break;
190: default:
191: abort();
192: /* NOTREACHED */
193: }
1.22 kristaps 194:
1.54 kristaps 195: assert(p->parent);
1.22 kristaps 196: p->parent->nchild++;
1.1 kristaps 197:
1.29 kristaps 198: if ( ! man_valid_pre(man, p))
199: return(0);
200:
201: switch (p->type) {
202: case (MAN_HEAD):
203: assert(MAN_BLOCK == p->parent->type);
204: p->parent->head = p;
205: break;
206: case (MAN_BODY):
207: assert(MAN_BLOCK == p->parent->type);
208: p->parent->body = p;
209: break;
210: default:
211: break;
212: }
213:
1.2 kristaps 214: man->last = p;
215:
1.1 kristaps 216: switch (p->type) {
1.94 kristaps 217: case (MAN_TBL):
218: /* FALLTHROUGH */
1.2 kristaps 219: case (MAN_TEXT):
220: if ( ! man_valid_post(man))
221: return(0);
1.1 kristaps 222: break;
223: default:
224: break;
225: }
226:
227: return(1);
228: }
229:
230:
231: static struct man_node *
1.97 kristaps 232: man_node_alloc(struct man *m, int line, int pos,
233: enum man_type type, enum mant tok)
1.1 kristaps 234: {
235: struct man_node *p;
236:
1.45 kristaps 237: p = mandoc_calloc(1, sizeof(struct man_node));
1.1 kristaps 238: p->line = line;
239: p->pos = pos;
240: p->type = type;
1.16 kristaps 241: p->tok = tok;
1.97 kristaps 242:
243: if (MAN_NEWLINE & m->flags)
244: p->flags |= MAN_LINE;
245: m->flags &= ~MAN_NEWLINE;
1.1 kristaps 246: return(p);
247: }
248:
249:
250: int
1.53 kristaps 251: man_elem_alloc(struct man *m, int line, int pos, enum mant tok)
1.1 kristaps 252: {
253: struct man_node *p;
254:
1.97 kristaps 255: p = man_node_alloc(m, line, pos, MAN_ELEM, tok);
1.30 kristaps 256: if ( ! man_node_append(m, p))
257: return(0);
258: m->next = MAN_NEXT_CHILD;
259: return(1);
1.1 kristaps 260: }
261:
262:
263: int
1.53 kristaps 264: man_head_alloc(struct man *m, int line, int pos, enum mant tok)
1.29 kristaps 265: {
266: struct man_node *p;
267:
1.97 kristaps 268: p = man_node_alloc(m, line, pos, MAN_HEAD, tok);
1.29 kristaps 269: if ( ! man_node_append(m, p))
270: return(0);
271: m->next = MAN_NEXT_CHILD;
272: return(1);
273: }
274:
275:
276: int
1.53 kristaps 277: man_body_alloc(struct man *m, int line, int pos, enum mant tok)
1.29 kristaps 278: {
279: struct man_node *p;
280:
1.97 kristaps 281: p = man_node_alloc(m, line, pos, MAN_BODY, tok);
1.29 kristaps 282: if ( ! man_node_append(m, p))
283: return(0);
284: m->next = MAN_NEXT_CHILD;
285: return(1);
286: }
287:
288:
289: int
1.53 kristaps 290: man_block_alloc(struct man *m, int line, int pos, enum mant tok)
1.29 kristaps 291: {
292: struct man_node *p;
293:
1.97 kristaps 294: p = man_node_alloc(m, line, pos, MAN_BLOCK, tok);
1.29 kristaps 295: if ( ! man_node_append(m, p))
296: return(0);
297: m->next = MAN_NEXT_CHILD;
298: return(1);
299: }
300:
1.61 kristaps 301: int
302: man_word_alloc(struct man *m, int line, int pos, const char *word)
1.1 kristaps 303: {
1.31 kristaps 304: struct man_node *n;
1.61 kristaps 305: size_t sv, len;
306:
307: len = strlen(word);
1.1 kristaps 308:
1.97 kristaps 309: n = man_node_alloc(m, line, pos, MAN_TEXT, MAN_MAX);
1.45 kristaps 310: n->string = mandoc_malloc(len + 1);
1.61 kristaps 311: sv = strlcpy(n->string, word, len + 1);
1.31 kristaps 312:
313: /* Prohibit truncation. */
314: assert(sv < len + 1);
315:
316: if ( ! man_node_append(m, n))
1.30 kristaps 317: return(0);
1.61 kristaps 318:
1.30 kristaps 319: m->next = MAN_NEXT_SIBLING;
320: return(1);
1.1 kristaps 321: }
322:
323:
1.54 kristaps 324: /*
325: * Free all of the resources held by a node. This does NOT unlink a
326: * node from its context; for that, see man_node_unlink().
327: */
328: static void
1.1 kristaps 329: man_node_free(struct man_node *p)
330: {
331:
332: if (p->string)
333: free(p->string);
334: free(p);
335: }
336:
337:
338: void
1.54 kristaps 339: man_node_delete(struct man *m, struct man_node *p)
1.1 kristaps 340: {
341:
1.54 kristaps 342: while (p->child)
343: man_node_delete(m, p->child);
344:
345: man_node_unlink(m, p);
1.1 kristaps 346: man_node_free(p);
347: }
348:
1.101 kristaps 349: int
350: man_addeqn(struct man *m, const struct eqn *ep)
351: {
352: struct man_node *n;
353:
354: assert( ! (MAN_HALT & m->flags));
355:
356: n = man_node_alloc(m, ep->line, ep->pos, MAN_EQN, MAN_MAX);
357: n->eqn = ep;
358:
359: if ( ! man_node_append(m, n))
360: return(0);
361:
362: m->next = MAN_NEXT_SIBLING;
363: return(man_descope(m, ep->line, ep->pos));
364: }
1.1 kristaps 365:
1.94 kristaps 366: int
367: man_addspan(struct man *m, const struct tbl_span *sp)
368: {
1.100 kristaps 369: struct man_node *n;
1.94 kristaps 370:
1.96 kristaps 371: assert( ! (MAN_HALT & m->flags));
1.100 kristaps 372:
373: n = man_node_alloc(m, sp->line, 0, MAN_TBL, MAN_MAX);
374: n->span = sp;
375:
376: if ( ! man_node_append(m, n))
1.94 kristaps 377: return(0);
1.100 kristaps 378:
379: m->next = MAN_NEXT_SIBLING;
1.99 kristaps 380: return(man_descope(m, sp->line, 0));
1.94 kristaps 381: }
382:
383: static int
384: man_descope(struct man *m, int line, int offs)
385: {
386: /*
387: * Co-ordinate what happens with having a next-line scope open:
388: * first close out the element scope (if applicable), then close
389: * out the block scope (also if applicable).
390: */
391:
392: if (MAN_ELINE & m->flags) {
393: m->flags &= ~MAN_ELINE;
394: if ( ! man_unscope(m, m->last->parent, MANDOCERR_MAX))
395: return(0);
396: }
397:
398: if ( ! (MAN_BLINE & m->flags))
399: return(1);
400: m->flags &= ~MAN_BLINE;
401:
402: if ( ! man_unscope(m, m->last->parent, MANDOCERR_MAX))
403: return(0);
404: return(man_body_alloc(m, line, offs, m->last->tok));
405: }
406:
407:
1.1 kristaps 408: static int
1.72 kristaps 409: man_ptext(struct man *m, int line, char *buf, int offs)
1.1 kristaps 410: {
1.61 kristaps 411: int i;
1.60 kristaps 412:
413: /* Ignore bogus comments. */
414:
1.72 kristaps 415: if ('\\' == buf[offs] &&
416: '.' == buf[offs + 1] &&
1.93 kristaps 417: '"' == buf[offs + 2]) {
418: man_pmsg(m, line, offs, MANDOCERR_BADCOMMENT);
419: return(1);
420: }
1.31 kristaps 421:
1.35 kristaps 422: /* Literal free-form text whitespace is preserved. */
423:
424: if (MAN_LITERAL & m->flags) {
1.72 kristaps 425: if ( ! man_word_alloc(m, line, offs, buf + offs))
1.35 kristaps 426: return(0);
1.94 kristaps 427: return(man_descope(m, line, offs));
1.35 kristaps 428: }
429:
1.61 kristaps 430: /* Pump blank lines directly into the backend. */
1.31 kristaps 431:
1.72 kristaps 432: for (i = offs; ' ' == buf[i]; i++)
1.31 kristaps 433: /* Skip leading whitespace. */ ;
1.48 kristaps 434:
1.49 kristaps 435: if ('\0' == buf[i]) {
1.61 kristaps 436: /* Allocate a blank entry. */
1.72 kristaps 437: if ( ! man_word_alloc(m, line, offs, ""))
1.31 kristaps 438: return(0);
1.94 kristaps 439: return(man_descope(m, line, offs));
1.31 kristaps 440: }
441:
1.63 kristaps 442: /*
443: * Warn if the last un-escaped character is whitespace. Then
444: * strip away the remaining spaces (tabs stay!).
445: */
1.29 kristaps 446:
1.61 kristaps 447: i = (int)strlen(buf);
448: assert(i);
1.49 kristaps 449:
1.63 kristaps 450: if (' ' == buf[i - 1] || '\t' == buf[i - 1]) {
1.64 kristaps 451: if (i > 1 && '\\' != buf[i - 2])
1.93 kristaps 452: man_pmsg(m, line, i - 1, MANDOCERR_EOLNSPACE);
1.63 kristaps 453:
454: for (--i; i && ' ' == buf[i]; i--)
455: /* Spin back to non-space. */ ;
456:
457: /* Jump ahead of escaped whitespace. */
458: i += '\\' == buf[i] ? 2 : 1;
459:
460: buf[i] = '\0';
461: }
1.49 kristaps 462:
1.72 kristaps 463: if ( ! man_word_alloc(m, line, offs, buf + offs))
1.1 kristaps 464: return(0);
1.65 kristaps 465:
466: /*
467: * End-of-sentence check. If the last character is an unescaped
468: * EOS character, then flag the node as being the end of a
469: * sentence. The front-end will know how to interpret this.
470: */
1.67 kristaps 471:
1.65 kristaps 472: assert(i);
1.83 schwarze 473: if (mandoc_eos(buf, (size_t)i, 0))
1.65 kristaps 474: m->last->flags |= MAN_EOS;
1.31 kristaps 475:
1.94 kristaps 476: return(man_descope(m, line, offs));
1.1 kristaps 477: }
478:
479:
1.96 kristaps 480: static int
1.79 kristaps 481: man_pmacro(struct man *m, int ln, char *buf, int offs)
1.1 kristaps 482: {
1.58 kristaps 483: int i, j, ppos;
1.53 kristaps 484: enum mant tok;
1.34 kristaps 485: char mac[5];
486: struct man_node *n;
1.1 kristaps 487:
488: /* Comments and empties are quickly ignored. */
489:
1.72 kristaps 490: offs++;
491:
492: if ('\0' == buf[offs])
1.46 kristaps 493: return(1);
1.1 kristaps 494:
1.72 kristaps 495: i = offs;
1.9 kristaps 496:
1.56 kristaps 497: /*
498: * Skip whitespace between the control character and initial
499: * text. "Whitespace" is both spaces and tabs.
500: */
1.62 kristaps 501:
1.57 kristaps 502: if (' ' == buf[i] || '\t' == buf[i]) {
1.9 kristaps 503: i++;
1.56 kristaps 504: while (buf[i] && (' ' == buf[i] || '\t' == buf[i]))
1.1 kristaps 505: i++;
1.48 kristaps 506: if ('\0' == buf[i])
1.11 kristaps 507: goto out;
1.1 kristaps 508: }
509:
1.10 kristaps 510: ppos = i;
511:
1.86 schwarze 512: /*
513: * Copy the first word into a nil-terminated buffer.
514: * Stop copying when a tab, space, or eoln is encountered.
515: */
1.1 kristaps 516:
1.86 schwarze 517: j = 0;
518: while (j < 4 && '\0' != buf[i] && ' ' != buf[i] && '\t' != buf[i])
519: mac[j++] = buf[i++];
1.46 kristaps 520: mac[j] = '\0';
1.1 kristaps 521:
1.87 schwarze 522: tok = (j > 0 && j < 4) ? man_hash_find(mac) : MAN_MAX;
523: if (MAN_MAX == tok) {
1.104 kristaps 524: mandoc_vmsg(MANDOCERR_MACRO, m->parse, ln,
525: ppos, "%s", buf + ppos - 1);
1.12 kristaps 526: return(1);
1.1 kristaps 527: }
528:
529: /* The macro is sane. Jump to the next word. */
530:
531: while (buf[i] && ' ' == buf[i])
532: i++;
533:
1.62 kristaps 534: /*
535: * Trailing whitespace. Note that tabs are allowed to be passed
536: * into the parser as "text", so we only warn about spaces here.
537: */
1.48 kristaps 538:
539: if ('\0' == buf[i] && ' ' == buf[i - 1])
1.93 kristaps 540: man_pmsg(m, ln, i - 1, MANDOCERR_EOLNSPACE);
1.48 kristaps 541:
1.50 kristaps 542: /*
1.90 kristaps 543: * Remove prior ELINE macro, as it's being clobbered by a new
1.51 kristaps 544: * macro. Note that NSCOPED macros do not close out ELINE
545: * macros---they don't print text---so we let those slip by.
1.50 kristaps 546: */
1.34 kristaps 547:
1.53 kristaps 548: if ( ! (MAN_NSCOPED & man_macros[tok].flags) &&
1.51 kristaps 549: m->flags & MAN_ELINE) {
1.90 kristaps 550: n = m->last;
551: assert(MAN_TEXT != n->type);
1.51 kristaps 552:
1.90 kristaps 553: /* Remove repeated NSCOPED macros causing ELINE. */
1.51 kristaps 554:
1.90 kristaps 555: if (MAN_NSCOPED & man_macros[n->tok].flags)
556: n = n->parent;
1.51 kristaps 557:
1.104 kristaps 558: mandoc_vmsg(MANDOCERR_LINESCOPE, m->parse, n->line,
559: n->pos, "%s", man_macronames[n->tok]);
1.34 kristaps 560:
1.54 kristaps 561: man_node_delete(m, n);
1.34 kristaps 562: m->flags &= ~MAN_ELINE;
563: }
564:
1.59 kristaps 565: /*
566: * Save the fact that we're in the next-line for a block. In
567: * this way, embedded roff instructions can "remember" state
568: * when they exit.
569: */
570:
571: if (MAN_BLINE & m->flags)
572: m->flags |= MAN_BPLINE;
573:
574: /* Call to handler... */
1.1 kristaps 575:
1.53 kristaps 576: assert(man_macros[tok].fp);
1.79 kristaps 577: if ( ! (*man_macros[tok].fp)(m, tok, ln, ppos, &i, buf))
1.1 kristaps 578: goto err;
579:
1.11 kristaps 580: out:
1.50 kristaps 581: /*
582: * We weren't in a block-line scope when entering the
583: * above-parsed macro, so return.
584: */
585:
1.58 kristaps 586: if ( ! (MAN_BPLINE & m->flags)) {
1.50 kristaps 587: m->flags &= ~MAN_ILINE;
1.29 kristaps 588: return(1);
1.50 kristaps 589: }
1.58 kristaps 590: m->flags &= ~MAN_BPLINE;
1.50 kristaps 591:
592: /*
593: * If we're in a block scope, then allow this macro to slip by
594: * without closing scope around it.
595: */
596:
597: if (MAN_ILINE & m->flags) {
598: m->flags &= ~MAN_ILINE;
599: return(1);
600: }
1.29 kristaps 601:
602: /*
603: * If we've opened a new next-line element scope, then return
604: * now, as the next line will close out the block scope.
605: */
606:
607: if (MAN_ELINE & m->flags)
608: return(1);
609:
610: /* Close out the block scope opened in the prior line. */
1.11 kristaps 611:
1.29 kristaps 612: assert(MAN_BLINE & m->flags);
613: m->flags &= ~MAN_BLINE;
1.11 kristaps 614:
1.74 kristaps 615: if ( ! man_unscope(m, m->last->parent, MANDOCERR_MAX))
1.29 kristaps 616: return(0);
1.72 kristaps 617: return(man_body_alloc(m, ln, offs, m->last->tok));
1.1 kristaps 618:
619: err: /* Error out. */
620:
1.2 kristaps 621: m->flags |= MAN_HALT;
1.1 kristaps 622: return(0);
623: }
1.51 kristaps 624:
1.54 kristaps 625: /*
626: * Unlink a node from its context. If "m" is provided, the last parse
627: * point will also be adjusted accordingly.
628: */
629: static void
1.51 kristaps 630: man_node_unlink(struct man *m, struct man_node *n)
631: {
632:
1.54 kristaps 633: /* Adjust siblings. */
634:
635: if (n->prev)
1.51 kristaps 636: n->prev->next = n->next;
1.54 kristaps 637: if (n->next)
638: n->next->prev = n->prev;
639:
640: /* Adjust parent. */
641:
642: if (n->parent) {
643: n->parent->nchild--;
644: if (n->parent->child == n)
645: n->parent->child = n->prev ? n->prev : n->next;
646: }
647:
648: /* Adjust parse point, if applicable. */
649:
650: if (m && m->last == n) {
651: /*XXX: this can occur when bailing from validation. */
652: /*assert(NULL == n->next);*/
653: if (n->prev) {
1.51 kristaps 654: m->last = n->prev;
655: m->next = MAN_NEXT_SIBLING;
1.54 kristaps 656: } else {
1.51 kristaps 657: m->last = n->parent;
658: m->next = MAN_NEXT_CHILD;
659: }
660: }
661:
1.54 kristaps 662: if (m && m->first == n)
663: m->first = NULL;
1.23 kristaps 664: }
CVSweb