s/fileno\(stdin\)/STDIN_FILENO/g

s/fileno\(stdout\)/STDOUT_FILENO/g
This commit is contained in:
Eric Andersen
2004-03-27 10:02:48 +00:00
parent edd580a088
commit 70060d25d2
21 changed files with 35 additions and 35 deletions

View File

@@ -52,7 +52,7 @@ int bunzip2_main(int argc, char **argv)
/* Open input file */
src_fd = bb_xopen(compressed_name, O_RDONLY);
} else {
src_fd = fileno(stdin);
src_fd = STDIN_FILENO;
opt |= BUNZIP2_OPT_STDOUT;
}
@@ -62,7 +62,7 @@ int bunzip2_main(int argc, char **argv)
}
if (opt & BUNZIP2_OPT_STDOUT) {
dst_fd = fileno(stdout);
dst_fd = STDOUT_FILENO;
} else {
int len = strlen(compressed_name) - 4;
if (strcmp(compressed_name + len, ".bz2") != 0) {

View File

@@ -47,7 +47,7 @@ extern int cpio_main(int argc, char **argv)
/* Initialise */
archive_handle = init_handle();
archive_handle->src_fd = fileno(stdin);
archive_handle->src_fd = STDIN_FILENO;
archive_handle->seek = seek_by_char;
archive_handle->flags = ARCHIVE_EXTRACT_NEWER | ARCHIVE_PRESERVE_DATE;

View File

@@ -98,7 +98,7 @@ extern int gunzip_main(int argc, char **argv)
optind++;
if (old_path == NULL || strcmp(old_path, "-") == 0) {
src_fd = fileno(stdin);
src_fd = STDIN_FILENO;
opt |= GUNZIP_OPT_STDOUT;
} else {
src_fd = bb_xopen(old_path, O_RDONLY);
@@ -119,7 +119,7 @@ extern int gunzip_main(int argc, char **argv)
if (opt & GUNZIP_OPT_TEST) {
dst_fd = bb_xopen("/dev/null", O_WRONLY); /* why does test use filenum 2 ? */
} else if (opt & GUNZIP_OPT_STDOUT) {
dst_fd = fileno(stdout);
dst_fd = STDOUT_FILENO;
} else {
char *extension;
@@ -178,10 +178,10 @@ extern int gunzip_main(int argc, char **argv)
delete_path = new_path;
}
if (dst_fd != fileno(stdout)) {
if (dst_fd != STDOUT_FILENO) {
close(dst_fd);
}
if (src_fd != fileno(stdin)) {
if (src_fd != STDIN_FILENO) {
close(src_fd);
}

View File

@@ -18,5 +18,5 @@
extern void data_extract_to_stdout(archive_handle_t *archive_handle)
{
bb_copyfd_size(archive_handle->src_fd, fileno(stdout), archive_handle->file_header->size);
bb_copyfd_size(archive_handle->src_fd, STDOUT_FILENO, archive_handle->file_header->size);
}

View File

@@ -73,7 +73,7 @@ extern int rpm2cpio_main(int argc, char **argv)
unsigned char magic[2];
if (argc == 1) {
rpm_fd = fileno(stdin);
rpm_fd = STDIN_FILENO;
} else {
rpm_fd = bb_xopen(argv[1], O_RDONLY);
}
@@ -96,7 +96,7 @@ extern int rpm2cpio_main(int argc, char **argv)
}
check_header_gzip(rpm_fd);
if (inflate_gunzip(rpm_fd, fileno(stdout)) != 0) {
if (inflate_gunzip(rpm_fd, STDOUT_FILENO) != 0) {
bb_error_msg("Error inflating");
}

View File

@@ -308,7 +308,7 @@ static inline int writeTarHeader(struct TarBallInfo *tbInfo,
if (tbInfo->verboseFlag) {
FILE *vbFd = stdout;
if (tbInfo->tarFd == fileno(stdout)) /* If the archive goes to stdout, verbose to stderr */
if (tbInfo->tarFd == STDOUT_FILENO) /* If the archive goes to stdout, verbose to stderr */
vbFd = stderr;
fprintf(vbFd, "%s\n", header.name);
@@ -883,7 +883,7 @@ int tar_main(int argc, char **argv)
}
#ifdef CONFIG_FEATURE_CLEAN_UP
if (tar_handle->src_fd != fileno(stdin)) {
if (tar_handle->src_fd != STDIN_FILENO) {
close(tar_handle->src_fd);
}
#endif /* CONFIG_FEATURE_CLEAN_UP */

View File

@@ -46,7 +46,7 @@ extern int uncompress_main(int argc, char **argv)
int dst_fd;
if (strcmp(compressed_file, "-") == 0) {
src_fd = fileno(stdin);
src_fd = STDIN_FILENO;
flags |= GUNZIP_TO_STDOUT;
} else {
src_fd = bb_xopen(compressed_file, O_RDONLY);
@@ -60,7 +60,7 @@ extern int uncompress_main(int argc, char **argv)
/* Set output filename and number */
if (flags & GUNZIP_TO_STDOUT) {
dst_fd = fileno(stdout);
dst_fd = STDOUT_FILENO;
} else {
struct stat stat_buf;
char *extension;
@@ -96,10 +96,10 @@ extern int uncompress_main(int argc, char **argv)
delete_path = uncompressed_file;
}
if (dst_fd != fileno(stdout)) {
if (dst_fd != STDOUT_FILENO) {
close(dst_fd);
}
if (src_fd != fileno(stdin)) {
if (src_fd != STDIN_FILENO) {
close(src_fd);
}

View File

@@ -135,7 +135,7 @@ extern int unzip_main(int argc, char **argv)
}
if (*argv[optind] == '-') {
archive_handle->src_fd = fileno(stdin);
archive_handle->src_fd = STDIN_FILENO;
archive_handle->seek = seek_by_char;
} else {
archive_handle->src_fd = bb_xopen(argv[optind++], O_RDONLY);