/* And get to work */
if (file_count != 0) {
if (to_stdout && !test && !list && (!decompress || !ascii)) {
- SET_BINARY_MODE(fileno(stdout));
+ SET_BINARY_MODE (STDOUT_FILENO);
}
while (optind < argc) {
treat_file(argv[optind++]);
{
if (!force && !list
&& (presume_input_tty
- || isatty(fileno((FILE *)(decompress ? stdin : stdout))))) {
+ || isatty (decompress ? STDIN_FILENO : STDOUT_FILENO))) {
/* Do not send compressed data to the terminal or read it from
* the terminal. We get here when user invoked the program
* without parameters, so be helpful. According to the GNU standards:
}
if (decompress || !ascii) {
- SET_BINARY_MODE(fileno(stdin));
+ SET_BINARY_MODE (STDIN_FILENO);
}
if (!test && !list && (!decompress || !ascii)) {
- SET_BINARY_MODE(fileno(stdout));
+ SET_BINARY_MODE (STDOUT_FILENO);
}
strcpy(ifname, "stdin");
strcpy(ofname, "stdout");
/* Get the file's time stamp and size. */
- if (fstat (fileno (stdin), &istat) != 0)
+ if (fstat (STDIN_FILENO, &istat) != 0)
{
progerror ("standard input");
do_exit (ERROR);
clear_bufs(); /* clear input and output buffers */
to_stdout = 1;
part_nb = 0;
- ifd = fileno(stdin);
+ ifd = STDIN_FILENO;
if (decompress) {
method = get_method(ifd);
/* Actually do the compression/decompression. Loop over zipped members.
*/
for (;;) {
- if ((*work)(fileno(stdin), fileno(stdout)) != OK) return;
+ if (work (STDIN_FILENO, STDOUT_FILENO) != OK)
+ return;
if (input_eof ())
break;
* a new ofname and save the original name in the compressed file.
*/
if (to_stdout) {
- ofd = fileno(stdout);
+ ofd = STDOUT_FILENO;
/* Keep remove_ofname_fd negative. */
} else {
if (create_outfile() != OK) return;
inptr--;
last_member = 1;
if (imagic0 != EOF) {
- write_buf(fileno(stdout), magic, 1);
+ write_buf (STDOUT_FILENO, magic, 1);
bytes_out++;
}
}
if (!force) {
int ok = 0;
fprintf (stderr, "%s: %s already exists;", program_name, ofname);
- if (foreground && (presume_input_tty || isatty(fileno(stdin)))) {
+ if (foreground && (presume_input_tty || isatty (STDIN_FILENO))) {
fprintf(stderr, " do you wish to overwrite (y or n)? ");
fflush(stderr);
ok = yesno();