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

Diff for /mandoc/mdoc.c between version 1.191 and 1.194

version 1.191, 2011/07/25 15:37:00 version 1.194, 2011/07/27 12:43:02
Line 97  static struct mdoc_node *node_alloc(struct mdoc *, int
Line 97  static struct mdoc_node *node_alloc(struct mdoc *, int
                                 enum mdoct, enum mdoc_type);                                  enum mdoct, enum mdoc_type);
 static  int               node_append(struct mdoc *,  static  int               node_append(struct mdoc *,
                                 struct mdoc_node *);                                  struct mdoc_node *);
   #if 0
 static  int               mdoc_preptext(struct mdoc *, int, char *, int);  static  int               mdoc_preptext(struct mdoc *, int, char *, int);
   #endif
 static  int               mdoc_ptext(struct mdoc *, int, char *, int);  static  int               mdoc_ptext(struct mdoc *, int, char *, int);
 static  int               mdoc_pmacro(struct mdoc *, int, char *, int);  static  int               mdoc_pmacro(struct mdoc *, int, char *, int);
   
Line 300  mdoc_parseln(struct mdoc *m, int ln, char *buf, int of
Line 302  mdoc_parseln(struct mdoc *m, int ln, char *buf, int of
   
         return(mandoc_getcontrol(buf, &offs) ?          return(mandoc_getcontrol(buf, &offs) ?
                         mdoc_pmacro(m, ln, buf, offs) :                          mdoc_pmacro(m, ln, buf, offs) :
                         mdoc_preptext(m, ln, buf, offs));                          mdoc_ptext(m, ln, buf, offs));
 }  }
   
 int  int
Line 566  int
Line 568  int
 mdoc_word_alloc(struct mdoc *m, int line, int pos, const char *p)  mdoc_word_alloc(struct mdoc *m, int line, int pos, const char *p)
 {  {
         struct mdoc_node *n;          struct mdoc_node *n;
         size_t            sv, len;  
   
         len = strlen(p);  
   
         n = node_alloc(m, line, pos, MDOC_MAX, MDOC_TEXT);          n = node_alloc(m, line, pos, MDOC_MAX, MDOC_TEXT);
         n->string = mandoc_malloc(len + 1);          n->string = mandoc_strdup(p);
         sv = strlcpy(n->string, p, len + 1);  
   
         /* Prohibit truncation. */  
         assert(sv < len + 1);  
   
         if ( ! node_append(m, n))          if ( ! node_append(m, n))
                 return(0);                  return(0);
   
Line 651  mdoc_node_delete(struct mdoc *m, struct mdoc_node *p)
Line 646  mdoc_node_delete(struct mdoc *m, struct mdoc_node *p)
         mdoc_node_free(p);          mdoc_node_free(p);
 }  }
   
   #if 0
 /*  /*
  * Pre-treat a text line.   * Pre-treat a text line.
  * Text lines can consist of equations, which must be handled apart from   * Text lines can consist of equations, which must be handled apart from
Line 702  mdoc_preptext(struct mdoc *m, int line, char *buf, int
Line 698  mdoc_preptext(struct mdoc *m, int line, char *buf, int
   
         return(1);          return(1);
 }  }
   #endif
   
 /*  /*
  * Parse free-form text, that is, a line that does not begin with the   * Parse free-form text, that is, a line that does not begin with the
Line 755  mdoc_ptext(struct mdoc *m, int line, char *buf, int of
Line 752  mdoc_ptext(struct mdoc *m, int line, char *buf, int of
         ws = NULL;          ws = NULL;
         for (c = end = buf + offs; *c; c++) {          for (c = end = buf + offs; *c; c++) {
                 switch (*c) {                  switch (*c) {
                 case '-':  
                         if (mandoc_hyph(buf + offs, c))  
                                 *c = ASCII_HYPH;  
                         ws = NULL;  
                         break;  
                 case ' ':                  case ' ':
                         if (NULL == ws)                          if (NULL == ws)
                                 ws = c;                                  ws = c;

Legend:
Removed from v.1.191  
changed lines
  Added in v.1.194

CVSweb