=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/tree.c,v retrieving revision 1.27 retrieving revision 1.28 diff -c -r1.27 -r1.28 *** src/usr.bin/mandoc/tree.c 2014/11/28 05:51:29 1.27 --- src/usr.bin/mandoc/tree.c 2015/02/03 18:37:39 1.28 *************** *** 1,7 **** ! /* $OpenBSD: tree.c,v 1.27 2014/11/28 05:51:29 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2011, 2014 Kristaps Dzonsons ! * Copyright (c) 2013, 2014 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above --- 1,7 ---- ! /* $OpenBSD: tree.c,v 1.28 2015/02/03 18:37:39 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2011, 2014 Kristaps Dzonsons ! * Copyright (c) 2013, 2014, 2015 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above *************** *** 38,51 **** tree_mdoc(void *arg, const struct mdoc *mdoc) { ! print_mdoc(mdoc_node(mdoc), 0); } void tree_man(void *arg, const struct man *man) { ! print_man(man_node(man), 0); } static void --- 38,51 ---- tree_mdoc(void *arg, const struct mdoc *mdoc) { ! print_mdoc(mdoc_node(mdoc)->child, 0); } void tree_man(void *arg, const struct man *man) { ! print_man(man_node(man)->child, 0); } static void *************** *** 56,61 **** --- 56,64 ---- size_t argc; struct mdoc_argv *argv; + if (n == NULL) + return; + argv = NULL; argc = 0; t = p = NULL; *************** *** 140,146 **** print_span(n->span, indent); } else { for (i = 0; i < indent; i++) ! putchar('\t'); printf("%s (%s)", p, t); --- 143,149 ---- print_span(n->span, indent); } else { for (i = 0; i < indent; i++) ! putchar(' '); printf("%s (%s)", p, t); *************** *** 164,172 **** } if (n->eqn) ! print_box(n->eqn->root->first, indent + 1); if (n->child) ! print_mdoc(n->child, indent + 1); if (n->next) print_mdoc(n->next, indent); } --- 167,176 ---- } if (n->eqn) ! print_box(n->eqn->root->first, indent + 4); if (n->child) ! print_mdoc(n->child, indent + ! (n->type == MDOC_BLOCK ? 2 : 4)); if (n->next) print_mdoc(n->next, indent); } *************** *** 177,182 **** --- 181,189 ---- const char *p, *t; int i; + if (n == NULL) + return; + t = p = NULL; switch (n->type) { *************** *** 239,245 **** print_span(n->span, indent); } else { for (i = 0; i < indent; i++) ! putchar('\t'); printf("%s (%s) ", p, t); if (MAN_LINE & n->flags) putchar('*'); --- 246,252 ---- print_span(n->span, indent); } else { for (i = 0; i < indent; i++) ! putchar(' '); printf("%s (%s) ", p, t); if (MAN_LINE & n->flags) putchar('*'); *************** *** 247,255 **** } if (n->eqn) ! print_box(n->eqn->root->first, indent + 1); if (n->child) ! print_man(n->child, indent + 1); if (n->next) print_man(n->next, indent); } --- 254,263 ---- } if (n->eqn) ! print_box(n->eqn->root->first, indent + 4); if (n->child) ! print_man(n->child, indent + ! (n->type == MAN_BLOCK ? 2 : 4)); if (n->next) print_man(n->next, indent); } *************** *** 268,274 **** if (NULL == ep) return; for (i = 0; i < indent; i++) ! putchar('\t'); t = NULL; switch (ep->type) { --- 276,282 ---- if (NULL == ep) return; for (i = 0; i < indent; i++) ! putchar(' '); t = NULL; switch (ep->type) { *************** *** 316,322 **** printf(" args=%zu", ep->args); putchar('\n'); ! print_box(ep->first, indent + 1); print_box(ep->next, indent); } --- 324,330 ---- printf(" args=%zu", ep->args); putchar('\n'); ! print_box(ep->first, indent + 4); print_box(ep->next, indent); } *************** *** 327,333 **** int i; for (i = 0; i < indent; i++) ! putchar('\t'); switch (sp->pos) { case TBL_SPAN_HORIZ: --- 335,341 ---- int i; for (i = 0; i < indent; i++) ! putchar(' '); switch (sp->pos) { case TBL_SPAN_HORIZ: