version 1.7, 1998/01/21 22:16:32 |
version 1.8, 1999/08/03 16:02:44 |
|
|
default: |
default: |
usage(); |
usage(); |
} |
} |
endargs: |
|
argv += optind; |
argv += optind; |
argc -= optind; |
argc -= optind; |
|
|
|
|
err(ERR_EXIT, "%s", file1); |
err(ERR_EXIT, "%s", file1); |
} |
} |
if (strcmp(file2 = argv[1], "-") == 0) { |
if (strcmp(file2 = argv[1], "-") == 0) { |
if (special) |
if (special) { |
if (sflag) |
if (sflag) |
exit(ERR_EXIT); |
exit(ERR_EXIT); |
else |
else |
errx(ERR_EXIT, |
errx(ERR_EXIT, |
"standard input may only be specified once"); |
"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)) < 0) { |
if (sflag) |
if (sflag) |
exit(ERR_EXIT); |
exit(ERR_EXIT); |
else |
else |
err(ERR_EXIT, "%s", file2); |
err(ERR_EXIT, "%s", file2); |
|
} |
|
|
skip1 = argc > 2 ? strtoq(argv[2], NULL, 0) : 0; |
skip1 = argc > 2 ? strtoq(argv[2], NULL, 0) : 0; |
skip2 = argc == 4 ? strtoq(argv[3], NULL, 0) : 0; |
skip2 = argc == 4 ? strtoq(argv[3], NULL, 0) : 0; |
|
|
if (!special) { |
if (!special) { |
if (fstat(fd1, &sb1)) |
if (fstat(fd1, &sb1)) { |
if (sflag) |
if (sflag) |
exit(ERR_EXIT); |
exit(ERR_EXIT); |
else |
else |
err(ERR_EXIT, "%s", file1); |
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)) { |
if (sflag) |
if (sflag) |
exit(ERR_EXIT); |
exit(ERR_EXIT); |
else |
else |
err(ERR_EXIT, "%s", file2); |
err(ERR_EXIT, "%s", file2); |
|
} |
if (!S_ISREG(sb2.st_mode)) |
if (!S_ISREG(sb2.st_mode)) |
special = 1; |
special = 1; |
} |
} |