version 1.48, 2018/04/26 12:42:51 |
version 1.49, 2019/06/28 13:35:02 |
|
|
say("block too large to mmap\n"); |
say("block too large to mmap\n"); |
return false; |
return false; |
} |
} |
if ((ifd = open(filename, O_RDONLY)) < 0) |
if ((ifd = open(filename, O_RDONLY)) == -1) |
pfatal("can't open file %s", filename); |
pfatal("can't open file %s", filename); |
|
|
if (i_size) { |
if (i_size) { |
|
|
if ((ifp = fopen(filename, "r")) == NULL) |
if ((ifp = fopen(filename, "r")) == NULL) |
pfatal("can't open file %s", filename); |
pfatal("can't open file %s", filename); |
(void) unlink(TMPINNAME); |
(void) unlink(TMPINNAME); |
if ((tifd = open(TMPINNAME, O_EXCL | O_CREAT | O_WRONLY, 0666)) < 0) |
if ((tifd = open(TMPINNAME, O_EXCL | O_CREAT | O_WRONLY, 0666)) == -1) |
pfatal("can't open file %s", TMPINNAME); |
pfatal("can't open file %s", TMPINNAME); |
while ((p = fgetln(ifp, &len)) != NULL) { |
while ((p = fgetln(ifp, &len)) != NULL) { |
if (p[len - 1] == '\n') |
if (p[len - 1] == '\n') |
|
|
} |
} |
fclose(ifp); |
fclose(ifp); |
close(tifd); |
close(tifd); |
if ((tifd = open(TMPINNAME, O_RDONLY)) < 0) |
if ((tifd = open(TMPINNAME, O_RDONLY)) == -1) |
pfatal("can't reopen file %s", TMPINNAME); |
pfatal("can't reopen file %s", TMPINNAME); |
} |
} |
|
|
|
|
tiline[whichbuf] = baseline; |
tiline[whichbuf] = baseline; |
|
|
if (lseek(tifd, (off_t) (baseline / lines_per_buf * |
if (lseek(tifd, (off_t) (baseline / lines_per_buf * |
tibuflen), SEEK_SET) < 0) |
tibuflen), SEEK_SET) == -1) |
pfatal("cannot seek in the temporary input file"); |
pfatal("cannot seek in the temporary input file"); |
|
|
if (read(tifd, tibuf[whichbuf], tibuflen) |
if (read(tifd, tibuf[whichbuf], tibuflen) |