Print this page
Update to 1.12.3.

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mandoc/preconv.c
          +++ new/usr/src/cmd/mandoc/preconv.c
   1      -/*      $Id: preconv.c,v 1.5 2011/07/24 18:15:14 kristaps Exp $ */
        1 +/*      $Id: preconv.c,v 1.6 2013/06/02 03:52:21 schwarze Exp $ */
   2    2  /*
   3    3   * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
   4    4   *
   5    5   * Permission to use, copy, modify, and distribute this software for any
   6    6   * purpose with or without fee is hereby granted, provided that the above
   7    7   * copyright notice and this permission notice appear in all copies.
   8    8   *
   9    9   * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10   10   * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11   11   * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
↓ open down ↓ 13 lines elided ↑ open up ↑
  25   25  
  26   26  #include <assert.h>
  27   27  #include <fcntl.h>
  28   28  #include <stdio.h>
  29   29  #include <stdlib.h>
  30   30  #include <string.h>
  31   31  #include <unistd.h>
  32   32  
  33   33  /* 
  34   34   * The read_whole_file() and resize_buf() functions are copied from
  35      - * read.c, including all dependency code (MAP_FILE, etc.).
       35 + * read.c, including all dependency code.
  36   36   */
  37   37  
  38      -#ifndef MAP_FILE
  39      -#define MAP_FILE        0
  40      -#endif
  41      -
  42   38  enum    enc {
  43   39          ENC_UTF_8, /* UTF-8 */
  44   40          ENC_US_ASCII, /* US-ASCII */
  45   41          ENC_LATIN_1, /* Latin-1 */
  46   42          ENC__MAX
  47   43  };
  48   44  
  49   45  struct  buf {
  50   46          char             *buf; /* binary input buffer */
  51   47          size_t            sz; /* size of binary buffer */
↓ open down ↓ 212 lines elided ↑ open up ↑
 264  260           */
 265  261  
 266  262          if (S_ISREG(st.st_mode) && st.st_size >= (1U << 31)) {
 267  263                  fprintf(stderr, "%s: input too large\n", f);
 268  264                  return(0);
 269  265          } 
 270  266          
 271  267          if (S_ISREG(st.st_mode)) {
 272  268                  *with_mmap = 1;
 273  269                  fb->sz = (size_t)st.st_size;
 274      -                fb->buf = mmap(NULL, fb->sz, PROT_READ, 
 275      -                                MAP_FILE|MAP_SHARED, fd, 0);
      270 +                fb->buf = mmap(NULL, fb->sz, PROT_READ, MAP_SHARED, fd, 0);
 276  271                  if (fb->buf != MAP_FAILED)
 277  272                          return(1);
 278  273          }
 279  274  #endif
 280  275  
 281  276          /*
 282  277           * If this isn't a regular file (like, say, stdin), then we must
 283  278           * go the old way and just read things in bit by bit.
 284  279           */
 285  280  
↓ open down ↓ 243 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX