Print this page
5051 import mdocml-1.12.3
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Approved by: TBD

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mandoc/tree.c
          +++ new/usr/src/cmd/mandoc/tree.c
   1      -/*      $Id: tree.c,v 1.47 2011/09/18 14:14:15 schwarze Exp $ */
        1 +/*      $Id: tree.c,v 1.50 2013/12/24 19:11:46 schwarze Exp $ */
   2    2  /*
   3    3   * Copyright (c) 2008, 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
        4 + * Copyright (c) 2013 Ingo Schwarze <schwarze@openbsd.org>
   4    5   *
   5    6   * Permission to use, copy, modify, and distribute this software for any
   6    7   * purpose with or without fee is hereby granted, provided that the above
   7    8   * copyright notice and this permission notice appear in all copies.
   8    9   *
   9   10   * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10   11   * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11   12   * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12   13   * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13   14   * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
↓ open down ↓ 37 lines elided ↑ open up ↑
  51   52  
  52   53          print_man(man_node(man), 0);
  53   54  }
  54   55  
  55   56  
  56   57  static void
  57   58  print_mdoc(const struct mdoc_node *n, int indent)
  58   59  {
  59   60          const char       *p, *t;
  60   61          int               i, j;
  61      -        size_t            argc, sz;
  62      -        char            **params;
       62 +        size_t            argc;
  63   63          struct mdoc_argv *argv;
  64   64  
  65   65          argv = NULL;
  66      -        argc = sz = 0;
  67      -        params = NULL;
       66 +        argc = 0;
  68   67          t = p = NULL;
  69   68  
  70   69          switch (n->type) {
  71   70          case (MDOC_ROOT):
  72   71                  t = "root";
  73   72                  break;
  74   73          case (MDOC_BLOCK):
  75   74                  t = "block";
  76   75                  break;
  77   76          case (MDOC_HEAD):
↓ open down ↓ 76 lines elided ↑ open up ↑
 154  153  
 155  154                  for (i = 0; i < (int)argc; i++) {
 156  155                          printf(" -%s", mdoc_argnames[argv[i].arg]);
 157  156                          if (argv[i].sz > 0)
 158  157                                  printf(" [");
 159  158                          for (j = 0; j < (int)argv[i].sz; j++)
 160  159                                  printf(" [%s]", argv[i].value[j]);
 161  160                          if (argv[i].sz > 0)
 162  161                                  printf(" ]");
 163  162                  }
 164      -                
 165      -                for (i = 0; i < (int)sz; i++)
 166      -                        printf(" [%s]", params[i]);
 167  163  
 168      -                printf(" %d:%d\n", n->line, n->pos);
      164 +                putchar(' ');
      165 +                if (MDOC_LINE & n->flags)
      166 +                        putchar('*');
      167 +                printf("%d:%d", n->line, n->pos);
      168 +                if (n->lastline != n->line)
      169 +                        printf("-%d", n->lastline);
      170 +                putchar('\n');
 169  171          }
 170  172  
 171  173          if (n->child)
 172  174                  print_mdoc(n->child, indent + 1);
 173  175          if (n->next)
 174  176                  print_mdoc(n->next, indent);
 175  177  }
 176  178  
 177  179  
 178  180  static void
↓ open down ↓ 171 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX