version 1.16, 2016/10/28 07:22:59 |
version 1.17, 2018/03/05 16:53:39 |
|
|
special = 1; |
special = 1; |
fd1 = 0; |
fd1 = 0; |
file1 = "stdin"; |
file1 = "stdin"; |
} else if ((fd1 = open(file1, O_RDONLY, 0)) < 0) { |
} else if ((fd1 = open(file1, O_RDONLY, 0)) == -1) |
if (sflag) |
fatal("%s", file1); |
return ERR_EXIT; |
|
else |
|
err(ERR_EXIT, "%s", file1); |
|
} |
|
if (strcmp(file2 = argv[1], "-") == 0) { |
if (strcmp(file2 = argv[1], "-") == 0) { |
if (special) { |
if (special) |
if (sflag) |
fatalx("standard input may only be specified once"); |
return ERR_EXIT; |
|
else |
|
errx(ERR_EXIT, |
|
"standard input may only be specified once"); |
|
} |
|
special = 1; |
special = 1; |
fd2 = 0; |
fd2 = 0; |
file2 = "stdin"; |
file2 = "stdin"; |
} else if ((fd2 = open(file2, O_RDONLY, 0)) < 0) { |
} else if ((fd2 = open(file2, O_RDONLY, 0)) == -1) |
if (sflag) |
fatal("%s", file2); |
return ERR_EXIT; |
|
else |
|
err(ERR_EXIT, "%s", file2); |
|
} |
|
|
|
if (pledge("stdio", NULL) == -1) |
if (pledge("stdio", NULL) == -1) |
err(ERR_EXIT, "pledge"); |
err(ERR_EXIT, "pledge"); |
|
|
skip2 = argc == 4 ? strtoll(argv[3], NULL, 0) : 0; |
skip2 = argc == 4 ? strtoll(argv[3], NULL, 0) : 0; |
|
|
if (!special) { |
if (!special) { |
if (fstat(fd1, &sb1)) { |
if (fstat(fd1, &sb1) == -1) |
if (sflag) |
fatal("%s", file1); |
return ERR_EXIT; |
|
else |
|
err(ERR_EXIT, "%s", file1); |
|
} |
|
if (!S_ISREG(sb1.st_mode)) |
if (!S_ISREG(sb1.st_mode)) |
special = 1; |
special = 1; |
else { |
else { |
if (fstat(fd2, &sb2)) { |
if (fstat(fd2, &sb2) == -1) |
if (sflag) |
fatal("%s", file2); |
return ERR_EXIT; |
|
else |
|
err(ERR_EXIT, "%s", file2); |
|
} |
|
if (!S_ISREG(sb2.st_mode)) |
if (!S_ISREG(sb2.st_mode)) |
special = 1; |
special = 1; |
} |
} |