version 1.5, 2022/12/02 22:21:35 |
version 1.6, 2022/12/02 22:29:59 |
|
|
|
|
/* open input or output file (if any) */ |
/* open input or output file (if any) */ |
if (ifile) { |
if (ifile) { |
if (strcmp(ifile, "-") == 0) |
if (strcmp(ifile, "-") == 0) { |
|
ifile = "stdin"; |
ifd = STDIN_FILENO; |
ifd = STDIN_FILENO; |
else { |
} else { |
ifd = open(ifile, O_RDONLY); |
ifd = open(ifile, O_RDONLY); |
if (ifd == -1) { |
if (ifd == -1) { |
perror(ifile); |
perror(ifile); |
|
|
} |
} |
} |
} |
} else if (ofile) { |
} else if (ofile) { |
if (strcmp(ofile, "-") == 0) |
if (strcmp(ofile, "-") == 0) { |
|
ofile = "stdout"; |
ofd = STDOUT_FILENO; |
ofd = STDOUT_FILENO; |
else { |
} else { |
ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, 0666); |
ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, 0666); |
if (ofd == -1) { |
if (ofd == -1) { |
perror(ofile); |
perror(ofile); |