version 1.142, 2015/10/06 18:32:19 |
version 1.143, 2015/10/11 21:12:55 |
|
|
|
|
#include <assert.h> |
#include <assert.h> |
#include <ctype.h> |
#include <ctype.h> |
|
#include <err.h> |
#include <errno.h> |
#include <errno.h> |
#include <fcntl.h> |
#include <fcntl.h> |
#include <stdarg.h> |
#include <stdarg.h> |
Line 612 read_whole_file(struct mparse *curp, const char *file, |
|
Line 613 read_whole_file(struct mparse *curp, const char *file, |
|
|
|
#if HAVE_MMAP |
#if HAVE_MMAP |
struct stat st; |
struct stat st; |
if (-1 == fstat(fd, &st)) { |
|
perror(file); |
|
exit((int)MANDOCLEVEL_SYSERR); |
|
} |
|
|
|
|
if (fstat(fd, &st) == -1) |
|
err((int)MANDOCLEVEL_SYSERR, "%s", file); |
|
|
/* |
/* |
* If we're a regular file, try just reading in the whole entry |
* If we're a regular file, try just reading in the whole entry |
* via mmap(). This is faster than reading it into blocks, and |
* via mmap(). This is faster than reading it into blocks, and |
Line 638 read_whole_file(struct mparse *curp, const char *file, |
|
Line 638 read_whole_file(struct mparse *curp, const char *file, |
|
#endif |
#endif |
|
|
if (curp->gzip) { |
if (curp->gzip) { |
if ((gz = gzdopen(fd, "rb")) == NULL) { |
if ((gz = gzdopen(fd, "rb")) == NULL) |
perror(file); |
err((int)MANDOCLEVEL_SYSERR, "%s", file); |
exit((int)MANDOCLEVEL_SYSERR); |
|
} |
|
} else |
} else |
gz = NULL; |
gz = NULL; |
|
|
Line 670 read_whole_file(struct mparse *curp, const char *file, |
|
Line 668 read_whole_file(struct mparse *curp, const char *file, |
|
fb->sz = off; |
fb->sz = off; |
return 1; |
return 1; |
} |
} |
if (ssz == -1) { |
if (ssz == -1) |
perror(file); |
err((int)MANDOCLEVEL_SYSERR, "%s", file); |
exit((int)MANDOCLEVEL_SYSERR); |
|
} |
|
off += (size_t)ssz; |
off += (size_t)ssz; |
} |
} |
|
|