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

Diff for /mandoc/read.c between version 1.209 and 1.212

version 1.209, 2018/12/30 00:49:55 version 1.212, 2019/03/19 16:26:08
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) 2010-2018 Ingo Schwarze <schwarze@openbsd.org>   * Copyright (c) 2010-2019 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2010, 2012 Joerg Sonnenberger <joerg@netbsd.org>   * Copyright (c) 2010, 2012 Joerg Sonnenberger <joerg@netbsd.org>
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
Line 255  mparse_buf_r(struct mparse *curp, struct buf blk, size
Line 255  mparse_buf_r(struct mparse *curp, struct buf blk, size
                 /* XXX Ugly hack to mark the end of the input. */                  /* XXX Ugly hack to mark the end of the input. */
   
                 if (i == blk.sz || blk.buf[i] == '\0') {                  if (i == blk.sz || blk.buf[i] == '\0') {
                           if (pos + 2 > ln.sz)
                                   resize_buf(&ln, 256);
                         ln.buf[pos++] = '\n';                          ln.buf[pos++] = '\n';
                         ln.buf[pos] = '\0';                          ln.buf[pos] = '\0';
                 }                  }
Line 607  int
Line 609  int
 mparse_open(struct mparse *curp, const char *file)  mparse_open(struct mparse *curp, const char *file)
 {  {
         char             *cp;          char             *cp;
         int               fd;          int               fd, save_errno;
   
         cp = strrchr(file, '.');          cp = strrchr(file, '.');
         curp->gzip = (cp != NULL && ! strcmp(cp + 1, "gz"));          curp->gzip = (cp != NULL && ! strcmp(cp + 1, "gz"));
Line 623  mparse_open(struct mparse *curp, const char *file)
Line 625  mparse_open(struct mparse *curp, const char *file)
          */           */
   
         if ( ! curp->gzip) {          if ( ! curp->gzip) {
                   save_errno = errno;
                 mandoc_asprintf(&cp, "%s.gz", file);                  mandoc_asprintf(&cp, "%s.gz", file);
                 fd = open(cp, O_RDONLY);                  fd = open(cp, O_RDONLY);
                 free(cp);                  free(cp);
                   errno = save_errno;
                 if (fd != -1) {                  if (fd != -1) {
                         curp->gzip = 1;                          curp->gzip = 1;
                         return fd;                          return fd;
Line 688  mparse_free(struct mparse *curp)
Line 692  mparse_free(struct mparse *curp)
 struct roff_meta *  struct roff_meta *
 mparse_result(struct mparse *curp)  mparse_result(struct mparse *curp)
 {  {
           roff_state_reset(curp->man);
         if (curp->options & MPARSE_VALIDATE) {          if (curp->options & MPARSE_VALIDATE) {
                 if (curp->man->meta.macroset == MACROSET_MDOC)                  if (curp->man->meta.macroset == MACROSET_MDOC)
                         mdoc_validate(curp->man);                          mdoc_validate(curp->man);

Legend:
Removed from v.1.209  
changed lines
  Added in v.1.212

CVSweb