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

Diff for /mandoc/read.c between version 1.11 and 1.15

version 1.11, 2011/04/04 23:04:38 version 1.15, 2011/05/26 20:36:21
Line 19 
Line 19 
 #include "config.h"  #include "config.h"
 #endif  #endif
   
 #include <sys/stat.h>  #ifdef HAVE_MMAP
 #include <sys/mman.h>  # include <sys/stat.h>
   # include <sys/mman.h>
   #endif
   
 #include <assert.h>  #include <assert.h>
 #include <ctype.h>  #include <ctype.h>
Line 142  static const char * const mandocerrs[MANDOCERR_MAX] = 
Line 144  static const char * const mandocerrs[MANDOCERR_MAX] = 
         "tab in non-literal context",          "tab in non-literal context",
         "end of line whitespace",          "end of line whitespace",
         "bad comment style",          "bad comment style",
         "unknown escape sequence",          "bad escape sequence",
         "unterminated quoted string",          "unterminated quoted string",
   
         "generic error",          "generic error",
Line 354  mparse_buf_r(struct mparse *curp, struct buf blk, int 
Line 356  mparse_buf_r(struct mparse *curp, struct buf blk, int 
                                 continue;                                  continue;
                         }                          }
   
                         if ('"' == blk.buf[i + 1]) {                          if ('"' == blk.buf[i + 1] || '#' == blk.buf[i + 1]) {
                                 i += 2;                                  i += 2;
                                 /* Comment, skip to end of line */                                  /* Comment, skip to end of line */
                                 for (; i < (int)blk.sz; ++i) {                                  for (; i < (int)blk.sz; ++i) {
Line 445  rerun:
Line 447  rerun:
   
                 /*                  /*
                  * If input parsers have not been allocated, do so now.                   * If input parsers have not been allocated, do so now.
                  * We keep these instanced betwen parsers, but set them                   * We keep these instanced between parsers, but set them
                  * locally per parse routine since we can use different                   * locally per parse routine since we can use different
                  * parsers with each one.                   * parsers with each one.
                  */                   */
Line 529  pdesc(struct mparse *curp, const char *file, int fd)
Line 531  pdesc(struct mparse *curp, const char *file, int fd)
   
         mparse_buf_r(curp, blk, 1);          mparse_buf_r(curp, blk, 1);
   
   #ifdef  HAVE_MMAP
         if (with_mmap)          if (with_mmap)
                 munmap(blk.buf, blk.sz);                  munmap(blk.buf, blk.sz);
         else          else
   #endif
                 free(blk.buf);                  free(blk.buf);
 }  }
   
 static int  static int
 read_whole_file(const char *file, int fd, struct buf *fb, int *with_mmap)  read_whole_file(const char *file, int fd, struct buf *fb, int *with_mmap)
 {  {
         struct stat      st;  
         size_t           off;          size_t           off;
         ssize_t          ssz;          ssize_t          ssz;
   
   #ifdef  HAVE_MMAP
           struct stat      st;
         if (-1 == fstat(fd, &st)) {          if (-1 == fstat(fd, &st)) {
                 perror(file);                  perror(file);
                 return(0);                  return(0);
Line 566  read_whole_file(const char *file, int fd, struct buf *
Line 571  read_whole_file(const char *file, int fd, struct buf *
                 if (fb->buf != MAP_FAILED)                  if (fb->buf != MAP_FAILED)
                         return(1);                          return(1);
         }          }
   #endif
   
         /*          /*
          * If this isn't a regular file (like, say, stdin), then we must           * If this isn't a regular file (like, say, stdin), then we must

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.15

CVSweb