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

Diff for /mandoc/mandoc.c between version 1.65 and 1.69

version 1.65, 2012/05/31 22:38:16 version 1.69, 2013/10/05 20:30:05
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>   * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>   * Copyright (c) 2011, 2012, 2013 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 40  static char *time2a(time_t);
Line 40  static char *time2a(time_t);
   
   
 enum mandoc_esc  enum mandoc_esc
 mandoc_escape(const char **end, const char **start, int *sz)  mandoc_escape(const char const **end, const char const **start, int *sz)
 {  {
         const char      *local_start;          const char      *local_start;
         int              local_sz;          int              local_sz;
Line 296  mandoc_escape(const char **end, const char **start, in
Line 296  mandoc_escape(const char **end, const char **start, in
   
         switch (gly) {          switch (gly) {
         case (ESCAPE_FONT):          case (ESCAPE_FONT):
                 /*                  if (2 == *sz) {
                  * Pretend that the constant-width font modes are the                          if ('C' == **start) {
                  * same as the regular font modes.                                  /*
                  */                                   * Treat constant-width font modes
                 if (2 == *sz && 'C' == **start) {                                   * just like regular font modes.
                         (*start)++;                                   */
                         (*sz)--;                                  (*start)++;
                                   (*sz)--;
                           } else {
                                   if ('B' == (*start)[0] && 'I' == (*start)[1])
                                           gly = ESCAPE_FONTBI;
                                   break;
                           }
                 } else if (1 != *sz)                  } else if (1 != *sz)
                         break;                          break;
   
Line 432  mandoc_getarg(struct mparse *parse, char **cpp, int ln
Line 438  mandoc_getarg(struct mparse *parse, char **cpp, int ln
         pairs = 0;          pairs = 0;
         white = 0;          white = 0;
         for (cp = start; '\0' != *cp; cp++) {          for (cp = start; '\0' != *cp; cp++) {
                 /* Move left after quoted quotes and escaped backslashes. */  
                   /*
                    * Move the following text left
                    * after quoted quotes and after "\\" and "\t".
                    */
                 if (pairs)                  if (pairs)
                         cp[-pairs] = cp[0];                          cp[-pairs] = cp[0];
   
                 if ('\\' == cp[0]) {                  if ('\\' == cp[0]) {
                         if ('\\' == cp[1]) {                          /*
                                 /* Poor man's copy mode. */                           * In copy mode, translate double to single
                            * backslashes and backslash-t to literal tabs.
                            */
                           switch (cp[1]) {
                           case ('t'):
                                   cp[0] = '\t';
                                   /* FALLTHROUGH */
                           case ('\\'):
                                 pairs++;                                  pairs++;
                                 cp++;                                  cp++;
                         } else if (0 == quoted && ' ' == cp[1])                                  break;
                           case (' '):
                                 /* Skip escaped blanks. */                                  /* Skip escaped blanks. */
                                 cp++;                                  if (0 == quoted)
                                           cp++;
                                   break;
                           default:
                                   break;
                           }
                 } else if (0 == quoted) {                  } else if (0 == quoted) {
                         if (' ' == cp[0]) {                          if (' ' == cp[0]) {
                                 /* Unescaped blanks end unquoted args. */                                  /* Unescaped blanks end unquoted args. */
Line 601  mandoc_eos(const char *p, size_t sz, int enclosed)
Line 625  mandoc_eos(const char *p, size_t sz, int enclosed)
         }          }
   
         return(found && !enclosed);          return(found && !enclosed);
 }  
   
 /*  
  * Find out whether a line is a macro line or not.  If it is, adjust the  
  * current position and return one; if it isn't, return zero and don't  
  * change the current position.  
  */  
 int  
 mandoc_getcontrol(const char *cp, int *ppos)  
 {  
         int             pos;  
   
         pos = *ppos;  
   
         if ('\\' == cp[pos] && '.' == cp[pos + 1])  
                 pos += 2;  
         else if ('.' == cp[pos] || '\'' == cp[pos])  
                 pos++;  
         else  
                 return(0);  
   
         while (' ' == cp[pos] || '\t' == cp[pos])  
                 pos++;  
   
         *ppos = pos;  
         return(1);  
 }  }
   
 /*  /*

Legend:
Removed from v.1.65  
changed lines
  Added in v.1.69

CVSweb