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

Diff for /mandoc/mandoc.c between version 1.103 and 1.107

version 1.103, 2017/07/03 13:40:19 version 1.107, 2018/08/20 18:06:56
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>   * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2011-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>   * Copyright (c) 2011-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above   * purpose with or without fee is hereby granted, provided that the above
Line 41  enum mandoc_esc
Line 41  enum mandoc_esc
 mandoc_escape(const char **end, const char **start, int *sz)  mandoc_escape(const char **end, const char **start, int *sz)
 {  {
         const char      *local_start;          const char      *local_start;
         int              local_sz;          int              local_sz, c, i;
         char             term;          char             term;
         enum mandoc_esc  gly;          enum mandoc_esc  gly;
   
Line 139  mandoc_escape(const char **end, const char **start, in
Line 139  mandoc_escape(const char **end, const char **start, in
                         break;                          break;
                 }                  }
                 break;                  break;
           case '*':
                   if (strncmp(*start, "(.T", 3) != 0)
                           abort();
                   gly = ESCAPE_DEVICE;
                   *start = ++*end;
                   *sz = 2;
                   break;
   
         /*          /*
          * These escapes are of the form \X'Y', where 'X' is the trigger           * These escapes are of the form \X'Y', where 'X' is the trigger
Line 295  mandoc_escape(const char **end, const char **start, in
Line 302  mandoc_escape(const char **end, const char **start, in
   
         switch (gly) {          switch (gly) {
         case ESCAPE_FONT:          case ESCAPE_FONT:
                 if (2 == *sz) {                  if (*sz == 2) {
                         if ('C' == **start) {                          if (**start == 'C') {
                                 /*                                  /*
                                  * Treat constant-width font modes                                   * Treat constant-width font modes
                                  * just like regular font modes.                                   * just like regular font modes.
Line 304  mandoc_escape(const char **end, const char **start, in
Line 311  mandoc_escape(const char **end, const char **start, in
                                 (*start)++;                                  (*start)++;
                                 (*sz)--;                                  (*sz)--;
                         } else {                          } else {
                                 if ('B' == (*start)[0] && 'I' == (*start)[1])                                  if ((*start)[0] == 'B' && (*start)[1] == 'I')
                                         gly = ESCAPE_FONTBI;                                          gly = ESCAPE_FONTBI;
                                 break;                                  break;
                         }                          }
                 } else if (1 != *sz)                  } else if (*sz != 1) {
                           if (*sz == 0)
                                   gly = ESCAPE_FONTPREV;
                         break;                          break;
                   }
   
                 switch (**start) {                  switch (**start) {
                 case '3':                  case '3':
Line 330  mandoc_escape(const char **end, const char **start, in
Line 340  mandoc_escape(const char **end, const char **start, in
                 }                  }
                 break;                  break;
         case ESCAPE_SPECIAL:          case ESCAPE_SPECIAL:
                 if (1 == *sz && 'c' == **start)                  if (**start == 'c') {
                         gly = ESCAPE_NOSPACE;                          if (*sz == 1) {
                                   gly = ESCAPE_NOSPACE;
                                   break;
                           }
                           if (*sz < 6 || *sz > 7 ||
                               strncmp(*start, "char", 4) != 0 ||
                               (int)strspn(*start + 4, "0123456789") + 4 < *sz)
                                   break;
                           c = 0;
                           for (i = 4; i < *sz; i++)
                                   c = 10 * c + ((*start)[i] - '0');
                           if (c < 0x21 || (c > 0x7e && c < 0xa0) || c > 0xff)
                                   break;
                           *start += 4;
                           *sz -= 4;
                           gly = ESCAPE_NUMBERED;
                           break;
                   }
   
                 /*                  /*
                  * Unicode escapes are defined in groff as \[u0000]                   * Unicode escapes are defined in groff as \[u0000]
                  * to \[u10FFFF], where the contained value must be                   * to \[u10FFFF], where the contained value must be
Line 540  mandoc_normdate(struct roff_man *man, char *in, int ln
Line 568  mandoc_normdate(struct roff_man *man, char *in, int ln
                 cp = time2a(t);                  cp = time2a(t);
                 if (t > time(NULL) + 86400)                  if (t > time(NULL) + 86400)
                         mandoc_msg(MANDOCERR_DATE_FUTURE, man->parse,                          mandoc_msg(MANDOCERR_DATE_FUTURE, man->parse,
                               ln, pos, cp);
                   else if (*in != '$' && strcmp(in, cp) != 0)
                           mandoc_msg(MANDOCERR_DATE_NORM, man->parse,
                             ln, pos, cp);                              ln, pos, cp);
                 return cp;                  return cp;
         }          }

Legend:
Removed from v.1.103  
changed lines
  Added in v.1.107

CVSweb