[BACK]Return to man.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/man.c between version 1.125 and 1.126

version 1.125, 2014/03/23 11:25:26 version 1.126, 2014/03/23 12:26:58
Line 23 
Line 23 
 #include <sys/types.h>  #include <sys/types.h>
   
 #include <assert.h>  #include <assert.h>
   #include <ctype.h>
 #include <stdarg.h>  #include <stdarg.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <stdio.h>  #include <stdio.h>
Line 705  man_mparse(const struct man *man)
Line 706  man_mparse(const struct man *man)
   
         assert(man && man->parse);          assert(man && man->parse);
         return(man->parse);          return(man->parse);
   }
   
   void
   man_deroff(char **dest, const struct man_node *n)
   {
           char    *cp;
           size_t   sz;
   
           if (MAN_TEXT != n->type) {
                   for (n = n->child; n; n = n->next)
                           man_deroff(dest, n);
                   return;
           }
   
           /* Skip leading whitespace. */
   
           for (cp = n->string; '\0' != *cp; cp++)
                   if (0 == isspace((unsigned char)*cp))
                           break;
   
           /* Skip trailing whitespace. */
   
           for (sz = strlen(cp); sz; sz--)
                   if (0 == isspace((unsigned char)cp[sz-1]))
                           break;
   
           /* Skip empty strings. */
   
           if (0 == sz)
                   return;
   
           if (NULL == *dest) {
                   *dest = mandoc_strndup(cp, sz);
                   return;
           }
   
           mandoc_asprintf(&cp, "%s %*s", *dest, (int)sz, cp);
           free(*dest);
           *dest = cp;
 }  }

Legend:
Removed from v.1.125  
changed lines
  Added in v.1.126

CVSweb