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

Diff for /mandoc/read.c between version 1.109 and 1.110

version 1.109, 2015/01/14 22:58:16 version 1.110, 2015/01/15 02:29:26
Line 211  static const char * const mandocerrs[MANDOCERR_MAX] = 
Line 211  static const char * const mandocerrs[MANDOCERR_MAX] = 
         "unknown standard specifier",          "unknown standard specifier",
         "skipping request without numeric argument",          "skipping request without numeric argument",
         "NOT IMPLEMENTED: .so with absolute path or \"..\"",          "NOT IMPLEMENTED: .so with absolute path or \"..\"",
           ".so request failed",
         "skipping all arguments",          "skipping all arguments",
         "skipping excess arguments",          "skipping excess arguments",
         "divide by zero",          "divide by zero",
Line 218  static const char * const mandocerrs[MANDOCERR_MAX] = 
Line 219  static const char * const mandocerrs[MANDOCERR_MAX] = 
         "generic fatal error",          "generic fatal error",
   
         "input too large",          "input too large",
         ".so request failed",  
 };  };
   
 static  const char * const      mandoclevels[MANDOCLEVEL_MAX] = {  static  const char * const      mandoclevels[MANDOCLEVEL_MAX] = {
Line 306  mparse_buf_r(struct mparse *curp, struct buf blk, size
Line 306  mparse_buf_r(struct mparse *curp, struct buf blk, size
 {  {
         const struct tbl_span   *span;          const struct tbl_span   *span;
         struct buf       ln;          struct buf       ln;
           char            *cp;
         size_t           pos; /* byte number in the ln buffer */          size_t           pos; /* byte number in the ln buffer */
         enum rofferr     rr;          enum rofferr     rr;
         int              of;          int              of;
         int              lnn; /* line number in the real file */          int              lnn; /* line number in the real file */
           int              fd;
           pid_t            save_child;
         unsigned char    c;          unsigned char    c;
   
         memset(&ln, 0, sizeof(ln));          memset(&ln, 0, sizeof(ln));
Line 518  rerun:
Line 521  rerun:
                          */                           */
                         if (curp->secondary)                          if (curp->secondary)
                                 curp->secondary->sz -= pos + 1;                                  curp->secondary->sz -= pos + 1;
                         mparse_readfd(curp, -1, ln.buf + of);                          save_child = curp->child;
                         if (MANDOCLEVEL_FATAL <= curp->file_status) {                          if (mparse_open(curp, &fd, ln.buf + of) ==
                               MANDOCLEVEL_OK)
                                   mparse_readfd(curp, fd, ln.buf + of);
                           else {
                                 mandoc_vmsg(MANDOCERR_SO_FAIL,                                  mandoc_vmsg(MANDOCERR_SO_FAIL,
                                     curp, curp->line, pos,                                      curp, curp->line, pos,
                                     ".so %s", ln.buf + of);                                      ".so %s", ln.buf + of);
                                 break;                                  ln.sz = mandoc_asprintf(&cp,
                                       ".sp\nSee the file %s.\n.sp",
                                       ln.buf + of);
                                   free(ln.buf);
                                   ln.buf = cp;
                                   of = 0;
                                   mparse_buf_r(curp, ln, of, 0);
                         }                          }
                           curp->child = save_child;
                         pos = 0;                          pos = 0;
                         continue;                          continue;
                 default:                  default:
Line 750  mparse_readmem(struct mparse *curp, void *buf, size_t 
Line 763  mparse_readmem(struct mparse *curp, void *buf, size_t 
 }  }
   
 /*  /*
  * If a file descriptor is given, use it and assume it points  
  * to the named file.  Otherwise, open the named file.  
  * Read the whole file into memory and call the parsers.   * Read the whole file into memory and call the parsers.
  * Called recursively when an .so request is encountered.   * Called recursively when an .so request is encountered.
  */   */
Line 761  mparse_readfd(struct mparse *curp, int fd, const char 
Line 772  mparse_readfd(struct mparse *curp, int fd, const char 
         struct buf       blk;          struct buf       blk;
         int              with_mmap;          int              with_mmap;
         int              save_filenc;          int              save_filenc;
         pid_t            save_child;  
   
         save_child = curp->child;  
         if (fd != -1)  
                 curp->child = 0;  
         else if (mparse_open(curp, &fd, file) != MANDOCLEVEL_OK)  
                 goto out;  
   
         if (read_whole_file(curp, file, fd, &blk, &with_mmap)) {          if (read_whole_file(curp, file, fd, &blk, &with_mmap)) {
                 save_filenc = curp->filenc;                  save_filenc = curp->filenc;
                 curp->filenc = curp->options &                  curp->filenc = curp->options &
Line 787  mparse_readfd(struct mparse *curp, int fd, const char 
Line 791  mparse_readfd(struct mparse *curp, int fd, const char 
                 perror(file);                  perror(file);
   
         mparse_wait(curp);          mparse_wait(curp);
 out:  
         curp->child = save_child;  
         return(curp->file_status);          return(curp->file_status);
 }  }
   

Legend:
Removed from v.1.109  
changed lines
  Added in v.1.110

CVSweb