diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-05-19 09:48:17 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-05-19 09:48:17 +0000 |
commit | 5e25ddb7d369b6785ec3aaa96cbc0521c22aeb0d (patch) | |
tree | 44b7cf5fb706b0816dd4525782ca8c37d07c2f43 | |
parent | 636a1f85e89432601c59cdc3239fc867b4adf051 (diff) | |
download | busybox-w32-5e25ddb7d369b6785ec3aaa96cbc0521c22aeb0d.tar.gz busybox-w32-5e25ddb7d369b6785ec3aaa96cbc0521c22aeb0d.tar.bz2 busybox-w32-5e25ddb7d369b6785ec3aaa96cbc0521c22aeb0d.zip |
- use STD*_FILENO some more. No object-code changes
-rw-r--r-- | applets/usage.c | 2 | ||||
-rw-r--r-- | archival/libunarchive/decompress_bunzip2.c | 2 | ||||
-rw-r--r-- | coreutils/split.c | 4 | ||||
-rw-r--r-- | editors/ed.c | 2 | ||||
-rw-r--r-- | editors/vi.c | 6 | ||||
-rw-r--r-- | init/init.c | 6 | ||||
-rw-r--r-- | libbb/appletlib.c | 2 | ||||
-rw-r--r-- | libbb/verror_msg.c | 2 | ||||
-rw-r--r-- | loginutils/getty.c | 16 | ||||
-rw-r--r-- | miscutils/hdparm.c | 2 | ||||
-rw-r--r-- | miscutils/less.c | 2 | ||||
-rw-r--r-- | networking/httpd.c | 24 | ||||
-rw-r--r-- | networking/httpd_indexcgi.c | 2 | ||||
-rw-r--r-- | networking/nc_bloaty.c | 12 | ||||
-rw-r--r-- | networking/telnet.c | 10 | ||||
-rw-r--r-- | procps/nmeter.c | 2 | ||||
-rw-r--r-- | procps/top.c | 2 | ||||
-rw-r--r-- | runit/svlogd.c | 6 | ||||
-rw-r--r-- | shell/ash.c | 2 | ||||
-rw-r--r-- | shell/msh.c | 6 | ||||
-rw-r--r-- | util-linux/script.c | 6 |
21 files changed, 59 insertions, 59 deletions
diff --git a/applets/usage.c b/applets/usage.c index 4955839fc..4f6a569d4 100644 --- a/applets/usage.c +++ b/applets/usage.c | |||
@@ -13,6 +13,6 @@ static const char usage_messages[] = "" | |||
13 | 13 | ||
14 | int main(void) | 14 | int main(void) |
15 | { | 15 | { |
16 | write(1, usage_messages, sizeof(usage_messages)); | 16 | write(STDOUT_FILENO, usage_messages, sizeof(usage_messages)); |
17 | return 0; | 17 | return 0; |
18 | } | 18 | } |
diff --git a/archival/libunarchive/decompress_bunzip2.c b/archival/libunarchive/decompress_bunzip2.c index f74fdf1ad..8f35bc5f9 100644 --- a/archival/libunarchive/decompress_bunzip2.c +++ b/archival/libunarchive/decompress_bunzip2.c | |||
@@ -762,7 +762,7 @@ int main(int argc, char **argv) | |||
762 | 762 | ||
763 | if (i < 0) | 763 | if (i < 0) |
764 | fprintf(stderr,"%s\n", bunzip_errors[-i]); | 764 | fprintf(stderr,"%s\n", bunzip_errors[-i]); |
765 | else if (read(0, &c, 1)) | 765 | else if (read(STDIN_FILENO, &c, 1)) |
766 | fprintf(stderr,"Trailing garbage ignored\n"); | 766 | fprintf(stderr,"Trailing garbage ignored\n"); |
767 | return -i; | 767 | return -i; |
768 | } | 768 | } |
diff --git a/coreutils/split.c b/coreutils/split.c index 2306789f0..39f62e6dd 100644 --- a/coreutils/split.c +++ b/coreutils/split.c | |||
@@ -98,7 +98,7 @@ int split_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
98 | } | 98 | } |
99 | 99 | ||
100 | while (1) { | 100 | while (1) { |
101 | bytes_read = safe_read(0, read_buffer, READ_BUFFER_SIZE); | 101 | bytes_read = safe_read(STDIN_FILENO, read_buffer, READ_BUFFER_SIZE); |
102 | if (!bytes_read) | 102 | if (!bytes_read) |
103 | break; | 103 | break; |
104 | if (bytes_read < 0) | 104 | if (bytes_read < 0) |
@@ -130,7 +130,7 @@ int split_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
130 | } | 130 | } |
131 | } | 131 | } |
132 | 132 | ||
133 | xwrite(1, src, to_write); | 133 | xwrite(STDOUT_FILENO, src, to_write); |
134 | bytes_read -= to_write; | 134 | bytes_read -= to_write; |
135 | src += to_write; | 135 | src += to_write; |
136 | } while (bytes_read); | 136 | } while (bytes_read); |
diff --git a/editors/ed.c b/editors/ed.c index 2f3bf03bf..0961cc38e 100644 --- a/editors/ed.c +++ b/editors/ed.c | |||
@@ -825,7 +825,7 @@ static int printLines(int num1, int num2, int expandFlag) | |||
825 | 825 | ||
826 | while (num1 <= num2) { | 826 | while (num1 <= num2) { |
827 | if (!expandFlag) { | 827 | if (!expandFlag) { |
828 | write(1, lp->data, lp->len); | 828 | write(STDOUT_FILENO, lp->data, lp->len); |
829 | setCurNum(num1++); | 829 | setCurNum(num1++); |
830 | lp = lp->next; | 830 | lp = lp->next; |
831 | continue; | 831 | continue; |
diff --git a/editors/vi.c b/editors/vi.c index dded6edb3..1770d98c5 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -2220,7 +2220,7 @@ static char readit(void) // read (maybe cursor) key from stdin | |||
2220 | // get input from User- are there already input chars in Q? | 2220 | // get input from User- are there already input chars in Q? |
2221 | if (n <= 0) { | 2221 | if (n <= 0) { |
2222 | // the Q is empty, wait for a typed char | 2222 | // the Q is empty, wait for a typed char |
2223 | n = safe_read(0, readbuffer, sizeof(readbuffer)); | 2223 | n = safe_read(STDIN_FILENO, readbuffer, sizeof(readbuffer)); |
2224 | if (n < 0) { | 2224 | if (n < 0) { |
2225 | if (errno == EBADF || errno == EFAULT || errno == EINVAL | 2225 | if (errno == EBADF || errno == EFAULT || errno == EINVAL |
2226 | || errno == EIO) | 2226 | || errno == EIO) |
@@ -2243,7 +2243,7 @@ static char readit(void) // read (maybe cursor) key from stdin | |||
2243 | && ((size_t)n <= (sizeof(readbuffer) - 8)) | 2243 | && ((size_t)n <= (sizeof(readbuffer) - 8)) |
2244 | ) { | 2244 | ) { |
2245 | // read the rest of the ESC string | 2245 | // read the rest of the ESC string |
2246 | int r = safe_read(0, readbuffer + n, sizeof(readbuffer) - n); | 2246 | int r = safe_read(STDIN_FILENO, readbuffer + n, sizeof(readbuffer) - n); |
2247 | if (r > 0) | 2247 | if (r > 0) |
2248 | n += r; | 2248 | n += r; |
2249 | } | 2249 | } |
@@ -4035,7 +4035,7 @@ static void crash_test() | |||
4035 | printf("\n\n%d: \'%c\' %s\n\n\n%s[Hit return to continue]%s", | 4035 | printf("\n\n%d: \'%c\' %s\n\n\n%s[Hit return to continue]%s", |
4036 | totalcmds, last_input_char, msg, SOs, SOn); | 4036 | totalcmds, last_input_char, msg, SOs, SOn); |
4037 | fflush(stdout); | 4037 | fflush(stdout); |
4038 | while (safe_read(0, d, 1) > 0) { | 4038 | while (safe_read(STDIN_FILENO, d, 1) > 0) { |
4039 | if (d[0] == '\n' || d[0] == '\r') | 4039 | if (d[0] == '\n' || d[0] == '\r') |
4040 | break; | 4040 | break; |
4041 | } | 4041 | } |
diff --git a/init/init.c b/init/init.c index 63154ce89..e3993896d 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -175,7 +175,7 @@ static void message(int where, const char *fmt, ...) | |||
175 | 175 | ||
176 | if (where & L_CONSOLE) { | 176 | if (where & L_CONSOLE) { |
177 | /* Send console messages to console so people will see them. */ | 177 | /* Send console messages to console so people will see them. */ |
178 | full_write(2, msg, l); | 178 | full_write(STDERR_FILENO, msg, l); |
179 | } | 179 | } |
180 | } | 180 | } |
181 | 181 | ||
@@ -471,8 +471,8 @@ static pid_t run(const struct init_action *a) | |||
471 | messageD(L_LOG, "waiting for enter to start '%s'" | 471 | messageD(L_LOG, "waiting for enter to start '%s'" |
472 | "(pid %d, tty '%s')\n", | 472 | "(pid %d, tty '%s')\n", |
473 | a->command, getpid(), a->terminal); | 473 | a->command, getpid(), a->terminal); |
474 | full_write(1, press_enter, sizeof(press_enter) - 1); | 474 | full_write(STDOUT_FILENO, press_enter, sizeof(press_enter) - 1); |
475 | while (safe_read(0, &c, 1) == 1 && c != '\n') | 475 | while (safe_read(STDIN_FILENO, &c, 1) == 1 && c != '\n') |
476 | continue; | 476 | continue; |
477 | } | 477 | } |
478 | 478 | ||
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 464280b17..86f85081c 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
@@ -98,7 +98,7 @@ static const char *unpack_usage_messages(void) | |||
98 | 98 | ||
99 | static void full_write2_str(const char *str) | 99 | static void full_write2_str(const char *str) |
100 | { | 100 | { |
101 | full_write(2, str, strlen(str)); | 101 | full_write(STDERR_FILENO, str, strlen(str)); |
102 | } | 102 | } |
103 | 103 | ||
104 | void bb_show_usage(void) | 104 | void bb_show_usage(void) |
diff --git a/libbb/verror_msg.c b/libbb/verror_msg.c index ca44030b2..5c6df48d4 100644 --- a/libbb/verror_msg.c +++ b/libbb/verror_msg.c | |||
@@ -56,7 +56,7 @@ void bb_verror_msg(const char *s, va_list p, const char* strerr) | |||
56 | 56 | ||
57 | if (logmode & LOGMODE_STDIO) { | 57 | if (logmode & LOGMODE_STDIO) { |
58 | fflush(stdout); | 58 | fflush(stdout); |
59 | full_write(2, msg, used + msgeol_len); | 59 | full_write(STDERR_FILENO, msg, used + msgeol_len); |
60 | } | 60 | } |
61 | if (logmode & LOGMODE_SYSLOG) { | 61 | if (logmode & LOGMODE_SYSLOG) { |
62 | syslog(LOG_ERR, "%s", msg + applet_len); | 62 | syslog(LOG_ERR, "%s", msg + applet_len); |
diff --git a/loginutils/getty.c b/loginutils/getty.c index f022aec59..ae183a62b 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c | |||
@@ -344,7 +344,7 @@ static void auto_baud(char *buf, unsigned size_buf, struct termios *tp) | |||
344 | * try to extract the speed of the dial-in call. | 344 | * try to extract the speed of the dial-in call. |
345 | */ | 345 | */ |
346 | sleep(1); | 346 | sleep(1); |
347 | nread = safe_read(0, buf, size_buf - 1); | 347 | nread = safe_read(STDIN_FILENO, buf, size_buf - 1); |
348 | if (nread > 0) { | 348 | if (nread > 0) { |
349 | buf[nread] = '\0'; | 349 | buf[nread] = '\0'; |
350 | for (bp = buf; bp < buf + nread; bp++) { | 350 | for (bp = buf; bp < buf + nread; bp++) { |
@@ -421,7 +421,7 @@ static char *get_logname(char *logname, unsigned size_logname, | |||
421 | while (cp->eol == '\0') { | 421 | while (cp->eol == '\0') { |
422 | 422 | ||
423 | /* Do not report trivial EINTR/EIO errors. */ | 423 | /* Do not report trivial EINTR/EIO errors. */ |
424 | if (read(0, &c, 1) < 1) { | 424 | if (read(STDIN_FILENO, &c, 1) < 1) { |
425 | if (errno == EINTR || errno == EIO) | 425 | if (errno == EINTR || errno == EIO) |
426 | exit(EXIT_SUCCESS); | 426 | exit(EXIT_SUCCESS); |
427 | bb_perror_msg_and_die("%s: read", op->tty); | 427 | bb_perror_msg_and_die("%s: read", op->tty); |
@@ -460,7 +460,7 @@ static char *get_logname(char *logname, unsigned size_logname, | |||
460 | #endif | 460 | #endif |
461 | cp->erase = ascval; /* set erase character */ | 461 | cp->erase = ascval; /* set erase character */ |
462 | if (bp > logname) { | 462 | if (bp > logname) { |
463 | full_write(1, erase[cp->parity], 3); | 463 | full_write(STDOUT_FILENO, erase[cp->parity], 3); |
464 | bp--; | 464 | bp--; |
465 | } | 465 | } |
466 | break; | 466 | break; |
@@ -470,7 +470,7 @@ static char *get_logname(char *logname, unsigned size_logname, | |||
470 | #endif | 470 | #endif |
471 | cp->kill = ascval; /* set kill character */ | 471 | cp->kill = ascval; /* set kill character */ |
472 | while (bp > logname) { | 472 | while (bp > logname) { |
473 | full_write(1, erase[cp->parity], 3); | 473 | full_write(STDOUT_FILENO, erase[cp->parity], 3); |
474 | bp--; | 474 | bp--; |
475 | } | 475 | } |
476 | break; | 476 | break; |
@@ -482,7 +482,7 @@ static char *get_logname(char *logname, unsigned size_logname, | |||
482 | } else if ((int)(bp - logname) >= size_logname - 1) { | 482 | } else if ((int)(bp - logname) >= size_logname - 1) { |
483 | bb_error_msg_and_die("%s: input overrun", op->tty); | 483 | bb_error_msg_and_die("%s: input overrun", op->tty); |
484 | } else { | 484 | } else { |
485 | full_write(1, &c, 1); /* echo the character */ | 485 | full_write(STDOUT_FILENO, &c, 1); /* echo the character */ |
486 | *bp++ = ascval; /* and store it */ | 486 | *bp++ = ascval; /* and store it */ |
487 | } | 487 | } |
488 | break; | 488 | break; |
@@ -715,7 +715,7 @@ int getty_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
715 | /* Write the modem init string and DON'T flush the buffers */ | 715 | /* Write the modem init string and DON'T flush the buffers */ |
716 | if (options.flags & F_INITSTRING) { | 716 | if (options.flags & F_INITSTRING) { |
717 | debug("writing init string\n"); | 717 | debug("writing init string\n"); |
718 | full_write(1, options.initstring, strlen(options.initstring)); | 718 | full_write(STDOUT_FILENO, options.initstring, strlen(options.initstring)); |
719 | } | 719 | } |
720 | 720 | ||
721 | /* Optionally detect the baud rate from the modem status message */ | 721 | /* Optionally detect the baud rate from the modem status message */ |
@@ -731,7 +731,7 @@ int getty_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
731 | char ch; | 731 | char ch; |
732 | 732 | ||
733 | debug("waiting for cr-lf\n"); | 733 | debug("waiting for cr-lf\n"); |
734 | while (safe_read(0, &ch, 1) == 1) { | 734 | while (safe_read(STDIN_FILENO, &ch, 1) == 1) { |
735 | debug("read %x\n", (unsigned char)ch); | 735 | debug("read %x\n", (unsigned char)ch); |
736 | ch &= 0x7f; /* strip "parity bit" */ | 736 | ch &= 0x7f; /* strip "parity bit" */ |
737 | if (ch == '\n' || ch == '\r') | 737 | if (ch == '\n' || ch == '\r') |
@@ -767,7 +767,7 @@ int getty_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
767 | termios_final(&options, &termios, &chardata); | 767 | termios_final(&options, &termios, &chardata); |
768 | 768 | ||
769 | /* Now the newline character should be properly written. */ | 769 | /* Now the newline character should be properly written. */ |
770 | full_write(1, "\n", 1); | 770 | full_write(STDOUT_FILENO, "\n", 1); |
771 | 771 | ||
772 | /* Let the login program take care of password validation. */ | 772 | /* Let the login program take care of password validation. */ |
773 | /* We use PATH because we trust that root doesn't set "bad" PATH, | 773 | /* We use PATH because we trust that root doesn't set "bad" PATH, |
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index 7afa9ff86..8c0e47334 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c | |||
@@ -1924,7 +1924,7 @@ static void identify_from_stdin(void) | |||
1924 | unsigned char *b = (unsigned char *)buf; | 1924 | unsigned char *b = (unsigned char *)buf; |
1925 | int i; | 1925 | int i; |
1926 | 1926 | ||
1927 | xread(0, buf, 1280); | 1927 | xread(STDIN_FILENO, buf, 1280); |
1928 | 1928 | ||
1929 | // Convert the newline-separated hex data into an identify block. | 1929 | // Convert the newline-separated hex data into an identify block. |
1930 | 1930 | ||
diff --git a/miscutils/less.c b/miscutils/less.c index f69bce97e..0529b2047 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
@@ -273,7 +273,7 @@ static void read_lines(void) | |||
273 | /* if no unprocessed chars left, eat more */ | 273 | /* if no unprocessed chars left, eat more */ |
274 | if (readpos >= readeof) { | 274 | if (readpos >= readeof) { |
275 | ndelay_on(0); | 275 | ndelay_on(0); |
276 | eof_error = safe_read(0, readbuf, sizeof(readbuf)); | 276 | eof_error = safe_read(STDIN_FILENO, readbuf, sizeof(readbuf)); |
277 | ndelay_off(0); | 277 | ndelay_off(0); |
278 | readpos = 0; | 278 | readpos = 0; |
279 | readeof = eof_error; | 279 | readeof = eof_error; |
diff --git a/networking/httpd.c b/networking/httpd.c index 4094061a8..4da7e5c65 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -947,7 +947,7 @@ static void log_and_exit(void) | |||
947 | /* Why?? | 947 | /* Why?? |
948 | (this also messes up stdin when user runs httpd -i from terminal) | 948 | (this also messes up stdin when user runs httpd -i from terminal) |
949 | ndelay_on(0); | 949 | ndelay_on(0); |
950 | while (read(0, iobuf, IOBUF_SIZE) > 0) | 950 | while (read(STDIN_FILENO, iobuf, IOBUF_SIZE) > 0) |
951 | continue; | 951 | continue; |
952 | */ | 952 | */ |
953 | 953 | ||
@@ -1023,7 +1023,7 @@ static void send_headers(int responseNum) | |||
1023 | 1023 | ||
1024 | if (DEBUG) | 1024 | if (DEBUG) |
1025 | fprintf(stderr, "headers: '%s'\n", iobuf); | 1025 | fprintf(stderr, "headers: '%s'\n", iobuf); |
1026 | full_write(1, iobuf, len); | 1026 | full_write(STDOUT_FILENO, iobuf, len); |
1027 | if (DEBUG) | 1027 | if (DEBUG) |
1028 | fprintf(stderr, "writing error page: '%s'\n", error_page); | 1028 | fprintf(stderr, "writing error page: '%s'\n", error_page); |
1029 | return send_file_and_exit(error_page, SEND_BODY); | 1029 | return send_file_and_exit(error_page, SEND_BODY); |
@@ -1062,7 +1062,7 @@ static void send_headers(int responseNum) | |||
1062 | } | 1062 | } |
1063 | if (DEBUG) | 1063 | if (DEBUG) |
1064 | fprintf(stderr, "headers: '%s'\n", iobuf); | 1064 | fprintf(stderr, "headers: '%s'\n", iobuf); |
1065 | if (full_write(1, iobuf, len) != len) { | 1065 | if (full_write(STDOUT_FILENO, iobuf, len) != len) { |
1066 | if (verbose > 1) | 1066 | if (verbose > 1) |
1067 | bb_perror_msg("error"); | 1067 | bb_perror_msg("error"); |
1068 | log_and_exit(); | 1068 | log_and_exit(); |
@@ -1090,7 +1090,7 @@ static int get_line(void) | |||
1090 | 1090 | ||
1091 | while (1) { | 1091 | while (1) { |
1092 | if (hdr_cnt <= 0) { | 1092 | if (hdr_cnt <= 0) { |
1093 | hdr_cnt = safe_read(0, hdr_buf, sizeof(hdr_buf)); | 1093 | hdr_cnt = safe_read(STDIN_FILENO, hdr_buf, sizeof(hdr_buf)); |
1094 | if (hdr_cnt <= 0) | 1094 | if (hdr_cnt <= 0) |
1095 | break; | 1095 | break; |
1096 | hdr_ptr = hdr_buf; | 1096 | hdr_ptr = hdr_buf; |
@@ -1202,8 +1202,8 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post | |||
1202 | * and there *is* data to read from the peer | 1202 | * and there *is* data to read from the peer |
1203 | * (POSTDATA) */ | 1203 | * (POSTDATA) */ |
1204 | //count = post_len > (int)sizeof(hdr_buf) ? (int)sizeof(hdr_buf) : post_len; | 1204 | //count = post_len > (int)sizeof(hdr_buf) ? (int)sizeof(hdr_buf) : post_len; |
1205 | //count = safe_read(0, hdr_buf, count); | 1205 | //count = safe_read(STDIN_FILENO, hdr_buf, count); |
1206 | count = safe_read(0, hdr_buf, sizeof(hdr_buf)); | 1206 | count = safe_read(STDIN_FILENO, hdr_buf, sizeof(hdr_buf)); |
1207 | if (count > 0) { | 1207 | if (count > 0) { |
1208 | hdr_cnt = count; | 1208 | hdr_cnt = count; |
1209 | hdr_ptr = hdr_buf; | 1209 | hdr_ptr = hdr_buf; |
@@ -1237,8 +1237,8 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post | |||
1237 | /* eof (or error) and there was no "HTTP", | 1237 | /* eof (or error) and there was no "HTTP", |
1238 | * so write it, then write received data */ | 1238 | * so write it, then write received data */ |
1239 | if (out_cnt) { | 1239 | if (out_cnt) { |
1240 | full_write(1, HTTP_200, sizeof(HTTP_200)-1); | 1240 | full_write(STDOUT_FILENO, HTTP_200, sizeof(HTTP_200)-1); |
1241 | full_write(1, rbuf, out_cnt); | 1241 | full_write(STDOUT_FILENO, rbuf, out_cnt); |
1242 | } | 1242 | } |
1243 | break; /* CGI stdout is closed, exiting */ | 1243 | break; /* CGI stdout is closed, exiting */ |
1244 | } | 1244 | } |
@@ -1247,7 +1247,7 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post | |||
1247 | /* "Status" header format is: "Status: 302 Redirected\r\n" */ | 1247 | /* "Status" header format is: "Status: 302 Redirected\r\n" */ |
1248 | if (out_cnt >= 8 && memcmp(rbuf, "Status: ", 8) == 0) { | 1248 | if (out_cnt >= 8 && memcmp(rbuf, "Status: ", 8) == 0) { |
1249 | /* send "HTTP/1.0 " */ | 1249 | /* send "HTTP/1.0 " */ |
1250 | if (full_write(1, HTTP_200, 9) != 9) | 1250 | if (full_write(STDOUT_FILENO, HTTP_200, 9) != 9) |
1251 | break; | 1251 | break; |
1252 | rbuf += 8; /* skip "Status: " */ | 1252 | rbuf += 8; /* skip "Status: " */ |
1253 | count = out_cnt - 8; | 1253 | count = out_cnt - 8; |
@@ -1256,7 +1256,7 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post | |||
1256 | /* Did CGI add "HTTP"? */ | 1256 | /* Did CGI add "HTTP"? */ |
1257 | if (memcmp(rbuf, HTTP_200, 4) != 0) { | 1257 | if (memcmp(rbuf, HTTP_200, 4) != 0) { |
1258 | /* there is no "HTTP", do it ourself */ | 1258 | /* there is no "HTTP", do it ourself */ |
1259 | if (full_write(1, HTTP_200, sizeof(HTTP_200)-1) != sizeof(HTTP_200)-1) | 1259 | if (full_write(STDOUT_FILENO, HTTP_200, sizeof(HTTP_200)-1) != sizeof(HTTP_200)-1) |
1260 | break; | 1260 | break; |
1261 | } | 1261 | } |
1262 | /* Commented out: | 1262 | /* Commented out: |
@@ -1276,7 +1276,7 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post | |||
1276 | if (count <= 0) | 1276 | if (count <= 0) |
1277 | break; /* eof (or error) */ | 1277 | break; /* eof (or error) */ |
1278 | } | 1278 | } |
1279 | if (full_write(1, rbuf, count) != count) | 1279 | if (full_write(STDOUT_FILENO, rbuf, count) != count) |
1280 | break; | 1280 | break; |
1281 | if (DEBUG) | 1281 | if (DEBUG) |
1282 | fprintf(stderr, "cgi read %d bytes: '%.*s'\n", count, count, rbuf); | 1282 | fprintf(stderr, "cgi read %d bytes: '%.*s'\n", count, count, rbuf); |
@@ -1632,7 +1632,7 @@ static void send_file_and_exit(const char *url, int what) | |||
1632 | while ((count = safe_read(f, iobuf, IOBUF_SIZE)) > 0) { | 1632 | while ((count = safe_read(f, iobuf, IOBUF_SIZE)) > 0) { |
1633 | ssize_t n; | 1633 | ssize_t n; |
1634 | USE_FEATURE_HTTPD_RANGES(if (count > range_len) count = range_len;) | 1634 | USE_FEATURE_HTTPD_RANGES(if (count > range_len) count = range_len;) |
1635 | n = full_write(1, iobuf, count); | 1635 | n = full_write(STDOUT_FILENO, iobuf, count); |
1636 | if (count != n) | 1636 | if (count != n) |
1637 | break; | 1637 | break; |
1638 | USE_FEATURE_HTTPD_RANGES(range_len -= count;) | 1638 | USE_FEATURE_HTTPD_RANGES(range_len -= count;) |
diff --git a/networking/httpd_indexcgi.c b/networking/httpd_indexcgi.c index fd64af38f..94c6a692a 100644 --- a/networking/httpd_indexcgi.c +++ b/networking/httpd_indexcgi.c | |||
@@ -125,7 +125,7 @@ static void guarantee(int size) | |||
125 | { | 125 | { |
126 | if (buffer + (BUFFER_SIZE-HEADROOM) - dst >= size) | 126 | if (buffer + (BUFFER_SIZE-HEADROOM) - dst >= size) |
127 | return; | 127 | return; |
128 | write(1, buffer, dst - buffer); | 128 | write(STDOUT_FILENO, buffer, dst - buffer); |
129 | dst = buffer; | 129 | dst = buffer; |
130 | } | 130 | } |
131 | 131 | ||
diff --git a/networking/nc_bloaty.c b/networking/nc_bloaty.c index 4ba726eb5..5f7bd0372 100644 --- a/networking/nc_bloaty.c +++ b/networking/nc_bloaty.c | |||
@@ -562,7 +562,7 @@ static int readwrite(void) | |||
562 | /* if we have a timeout AND stdin is closed AND we haven't heard anything | 562 | /* if we have a timeout AND stdin is closed AND we haven't heard anything |
563 | from the net during that time, assume it's dead and close it too. */ | 563 | from the net during that time, assume it's dead and close it too. */ |
564 | if (rr == 0) { | 564 | if (rr == 0) { |
565 | if (!FD_ISSET(0, &ding1)) | 565 | if (!FD_ISSET(STDIN_FILENO, &ding1)) |
566 | netretry--; /* we actually try a coupla times. */ | 566 | netretry--; /* we actually try a coupla times. */ |
567 | if (!netretry) { | 567 | if (!netretry) { |
568 | if (o_verbose > 1) /* normally we don't care */ | 568 | if (o_verbose > 1) /* normally we don't care */ |
@@ -597,12 +597,12 @@ Debug("got %d from the net, errno %d", rr, errno); | |||
597 | goto shovel; | 597 | goto shovel; |
598 | 598 | ||
599 | /* okay, suck more stdin */ | 599 | /* okay, suck more stdin */ |
600 | if (FD_ISSET(0, &ding2)) { /* stdin: ding! */ | 600 | if (FD_ISSET(STDIN_FILENO, &ding2)) { /* stdin: ding! */ |
601 | rr = read(0, bigbuf_in, BIGSIZ); | 601 | rr = read(STDIN_FILENO, bigbuf_in, BIGSIZ); |
602 | /* Considered making reads here smaller for UDP mode, but 8192-byte | 602 | /* Considered making reads here smaller for UDP mode, but 8192-byte |
603 | mobygrams are kinda fun and exercise the reassembler. */ | 603 | mobygrams are kinda fun and exercise the reassembler. */ |
604 | if (rr <= 0) { /* at end, or fukt, or ... */ | 604 | if (rr <= 0) { /* at end, or fukt, or ... */ |
605 | FD_CLR(0, &ding1); /* disable and close stdin */ | 605 | FD_CLR(STDIN_FILENO, &ding1); /* disable and close stdin */ |
606 | close(0); | 606 | close(0); |
607 | } else { | 607 | } else { |
608 | rzleft = rr; | 608 | rzleft = rr; |
@@ -625,7 +625,7 @@ Debug("got %d from the net, errno %d", rr, errno); | |||
625 | return 1; | 625 | return 1; |
626 | } | 626 | } |
627 | if (rnleft) { | 627 | if (rnleft) { |
628 | rr = write(1, np, rnleft); | 628 | rr = write(STDOUT_FILENO, np, rnleft); |
629 | if (rr > 0) { | 629 | if (rr > 0) { |
630 | if (o_ofile) /* log the stdout */ | 630 | if (o_ofile) /* log the stdout */ |
631 | oprint('<', (unsigned char *)np, rr); | 631 | oprint('<', (unsigned char *)np, rr); |
@@ -783,7 +783,7 @@ int nc_main(int argc, char **argv) | |||
783 | } | 783 | } |
784 | #endif | 784 | #endif |
785 | 785 | ||
786 | FD_SET(0, &ding1); /* stdin *is* initially open */ | 786 | FD_SET(STDIN_FILENO, &ding1); /* stdin *is* initially open */ |
787 | if (proggie) { | 787 | if (proggie) { |
788 | close(0); /* won't need stdin */ | 788 | close(0); /* won't need stdin */ |
789 | option_mask32 &= ~OPT_o; /* -o with -e is meaningless! */ | 789 | option_mask32 &= ~OPT_o; /* -o with -e is meaningless! */ |
diff --git a/networking/telnet.c b/networking/telnet.c index b357e690c..3a06c167c 100644 --- a/networking/telnet.c +++ b/networking/telnet.c | |||
@@ -121,7 +121,7 @@ static void conescape(void) | |||
121 | " z suspend telnet\r\n" | 121 | " z suspend telnet\r\n" |
122 | " e exit telnet\r\n"); | 122 | " e exit telnet\r\n"); |
123 | 123 | ||
124 | if (read(0, &b, 1) <= 0) | 124 | if (read(STDIN_FILENO, &b, 1) <= 0) |
125 | doexit(EXIT_FAILURE); | 125 | doexit(EXIT_FAILURE); |
126 | 126 | ||
127 | switch (b) { | 127 | switch (b) { |
@@ -256,7 +256,7 @@ static void handlenetinput(int len) | |||
256 | } | 256 | } |
257 | 257 | ||
258 | if (len) | 258 | if (len) |
259 | write(1, G.buf, len); | 259 | write(STDOUT_FILENO, G.buf, len); |
260 | } | 260 | } |
261 | 261 | ||
262 | static void putiac(int c) | 262 | static void putiac(int c) |
@@ -601,7 +601,7 @@ int telnet_main(int argc, char **argv) | |||
601 | ufds[0].events = ufds[1].events = POLLIN; | 601 | ufds[0].events = ufds[1].events = POLLIN; |
602 | #else | 602 | #else |
603 | FD_ZERO(&readfds); | 603 | FD_ZERO(&readfds); |
604 | FD_SET(0, &readfds); | 604 | FD_SET(STDIN_FILENO, &readfds); |
605 | FD_SET(G.netfd, &readfds); | 605 | FD_SET(G.netfd, &readfds); |
606 | maxfd = G.netfd + 1; | 606 | maxfd = G.netfd + 1; |
607 | #endif | 607 | #endif |
@@ -629,10 +629,10 @@ int telnet_main(int argc, char **argv) | |||
629 | #ifdef USE_POLL | 629 | #ifdef USE_POLL |
630 | if (ufds[0].revents) /* well, should check POLLIN, but ... */ | 630 | if (ufds[0].revents) /* well, should check POLLIN, but ... */ |
631 | #else | 631 | #else |
632 | if (FD_ISSET(0, &rfds)) | 632 | if (FD_ISSET(STDIN_FILENO, &rfds)) |
633 | #endif | 633 | #endif |
634 | { | 634 | { |
635 | len = read(0, G.buf, DATABUFSIZE); | 635 | len = read(STDIN_FILENO, G.buf, DATABUFSIZE); |
636 | if (len <= 0) | 636 | if (len <= 0) |
637 | doexit(EXIT_SUCCESS); | 637 | doexit(EXIT_SUCCESS); |
638 | TRACE(0, ("Read con: %d\n", len)); | 638 | TRACE(0, ("Read con: %d\n", len)); |
diff --git a/procps/nmeter.c b/procps/nmeter.c index b6e754b7a..798afcf16 100644 --- a/procps/nmeter.c +++ b/procps/nmeter.c | |||
@@ -98,7 +98,7 @@ static void print_outbuf(void) | |||
98 | { | 98 | { |
99 | int sz = cur_outbuf - outbuf; | 99 | int sz = cur_outbuf - outbuf; |
100 | if (sz > 0) { | 100 | if (sz > 0) { |
101 | xwrite(1, outbuf, sz); | 101 | xwrite(STDOUT_FILENO, outbuf, sz); |
102 | cur_outbuf = outbuf; | 102 | cur_outbuf = outbuf; |
103 | } | 103 | } |
104 | } | 104 | } |
diff --git a/procps/top.c b/procps/top.c index de30ffb28..b861deb66 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -888,7 +888,7 @@ int top_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
888 | /* batch mode, or EOF on stdin ("top </dev/null") */ | 888 | /* batch mode, or EOF on stdin ("top </dev/null") */ |
889 | sleep(interval); | 889 | sleep(interval); |
890 | else if (safe_poll(pfd, 1, interval * 1000) > 0) { | 890 | else if (safe_poll(pfd, 1, interval * 1000) > 0) { |
891 | if (safe_read(0, &c, 1) != 1) { /* error/EOF? */ | 891 | if (safe_read(STDIN_FILENO, &c, 1) != 1) { /* error/EOF? */ |
892 | option_mask32 |= OPT_EOF; | 892 | option_mask32 |= OPT_EOF; |
893 | continue; | 893 | continue; |
894 | } | 894 | } |
diff --git a/runit/svlogd.c b/runit/svlogd.c index db3d4c540..bfb97166f 100644 --- a/runit/svlogd.c +++ b/runit/svlogd.c | |||
@@ -748,7 +748,7 @@ static int buffer_pread(/*int fd, */char *s, unsigned len) | |||
748 | poll(&input, 1, i * 1000); | 748 | poll(&input, 1, i * 1000); |
749 | sigprocmask(SIG_BLOCK, &blocked_sigset, NULL); | 749 | sigprocmask(SIG_BLOCK, &blocked_sigset, NULL); |
750 | 750 | ||
751 | i = ndelay_read(0, s, len); | 751 | i = ndelay_read(STDIN_FILENO, s, len); |
752 | if (i >= 0) | 752 | if (i >= 0) |
753 | break; | 753 | break; |
754 | if (errno == EINTR) | 754 | if (errno == EINTR) |
@@ -994,7 +994,7 @@ int svlogd_main(int argc, char **argv) | |||
994 | logmatch(ld); | 994 | logmatch(ld); |
995 | if (ld->matcherr == 'e') { | 995 | if (ld->matcherr == 'e') { |
996 | /* runit-1.8.0 compat: if timestamping, do it on stderr too */ | 996 | /* runit-1.8.0 compat: if timestamping, do it on stderr too */ |
997 | ////full_write(2, printptr, printlen); | 997 | ////full_write(STDERR_FILENO, printptr, printlen); |
998 | fwrite(printptr, 1, printlen, stderr); | 998 | fwrite(printptr, 1, printlen, stderr); |
999 | } | 999 | } |
1000 | if (ld->match != '+') continue; | 1000 | if (ld->match != '+') continue; |
@@ -1022,7 +1022,7 @@ int svlogd_main(int argc, char **argv) | |||
1022 | for (i = 0; i < dirn; ++i) { | 1022 | for (i = 0; i < dirn; ++i) { |
1023 | if (dir[i].fddir == -1) continue; | 1023 | if (dir[i].fddir == -1) continue; |
1024 | if (dir[i].matcherr == 'e') { | 1024 | if (dir[i].matcherr == 'e') { |
1025 | ////full_write(2, lineptr, linelen); | 1025 | ////full_write(STDERR_FILENO, lineptr, linelen); |
1026 | fwrite(lineptr, 1, linelen, stderr); | 1026 | fwrite(lineptr, 1, linelen, stderr); |
1027 | } | 1027 | } |
1028 | if (dir[i].match != '+') continue; | 1028 | if (dir[i].match != '+') continue; |
diff --git a/shell/ash.c b/shell/ash.c index fa063bf20..20b93f326 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -1258,7 +1258,7 @@ stunalloc(void *p) | |||
1258 | { | 1258 | { |
1259 | #if DEBUG | 1259 | #if DEBUG |
1260 | if (!p || (g_stacknxt < (char *)p) || ((char *)p < g_stackp->space)) { | 1260 | if (!p || (g_stacknxt < (char *)p) || ((char *)p < g_stackp->space)) { |
1261 | write(2, "stunalloc\n", 10); | 1261 | write(STDERR_FILENO, "stunalloc\n", 10); |
1262 | abort(); | 1262 | abort(); |
1263 | } | 1263 | } |
1264 | #endif | 1264 | #endif |
diff --git a/shell/msh.c b/shell/msh.c index 48fa56eb7..9e06a3bff 100644 --- a/shell/msh.c +++ b/shell/msh.c | |||
@@ -743,7 +743,7 @@ static void print_tree(struct op *head) | |||
743 | static void prs(const char *s) | 743 | static void prs(const char *s) |
744 | { | 744 | { |
745 | if (*s) | 745 | if (*s) |
746 | write(2, s, strlen(s)); | 746 | write(STDERR_FILENO, s, strlen(s)); |
747 | } | 747 | } |
748 | 748 | ||
749 | static void prn(unsigned u) | 749 | static void prn(unsigned u) |
@@ -3384,7 +3384,7 @@ static int doread(struct op *t ATTRIBUTE_UNUSED, char **args) | |||
3384 | } | 3384 | } |
3385 | for (wp = args + 1; *wp; wp++) { | 3385 | for (wp = args + 1; *wp; wp++) { |
3386 | for (cp = global_env.linep; !nl && cp < elinep - 1; cp++) { | 3386 | for (cp = global_env.linep; !nl && cp < elinep - 1; cp++) { |
3387 | nb = nonblock_safe_read(0, cp, sizeof(*cp)); | 3387 | nb = nonblock_safe_read(STDIN_FILENO, cp, sizeof(*cp)); |
3388 | if (nb != sizeof(*cp)) | 3388 | if (nb != sizeof(*cp)) |
3389 | break; | 3389 | break; |
3390 | nl = (*cp == '\n'); | 3390 | nl = (*cp == '\n'); |
@@ -4522,7 +4522,7 @@ static int readc(void) | |||
4522 | static void ioecho(char c) | 4522 | static void ioecho(char c) |
4523 | { | 4523 | { |
4524 | if (FLAG['v']) | 4524 | if (FLAG['v']) |
4525 | write(2, &c, sizeof c); | 4525 | write(STDERR_FILENO, &c, sizeof c); |
4526 | } | 4526 | } |
4527 | 4527 | ||
4528 | static void pushio(struct ioarg *argp, int (*fn) (struct ioarg *)) | 4528 | static void pushio(struct ioarg *argp, int (*fn) (struct ioarg *)) |
diff --git a/util-linux/script.c b/util-linux/script.c index c1883328f..e70294e6c 100644 --- a/util-linux/script.c +++ b/util-linux/script.c | |||
@@ -124,7 +124,7 @@ int script_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
124 | goto restore; | 124 | goto restore; |
125 | } | 125 | } |
126 | if (count > 0) { | 126 | if (count > 0) { |
127 | full_write(1, buf, count); | 127 | full_write(STDOUT_FILENO, buf, count); |
128 | full_write(outfd, buf, count); | 128 | full_write(outfd, buf, count); |
129 | if (opt & 4) { /* -f */ | 129 | if (opt & 4) { /* -f */ |
130 | fsync(outfd); | 130 | fsync(outfd); |
@@ -132,7 +132,7 @@ int script_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
132 | } | 132 | } |
133 | } | 133 | } |
134 | if (pfd[1].revents) { | 134 | if (pfd[1].revents) { |
135 | count = safe_read(0, buf, sizeof(buf)); | 135 | count = safe_read(STDIN_FILENO, buf, sizeof(buf)); |
136 | if (count <= 0) { | 136 | if (count <= 0) { |
137 | /* err/eof from stdin: don't read stdin anymore */ | 137 | /* err/eof from stdin: don't read stdin anymore */ |
138 | pfd[1].revents = 0; | 138 | pfd[1].revents = 0; |
@@ -152,7 +152,7 @@ int script_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
152 | loop = 999; | 152 | loop = 999; |
153 | /* pty is in O_NONBLOCK mode, we exit as soon as buffer is empty */ | 153 | /* pty is in O_NONBLOCK mode, we exit as soon as buffer is empty */ |
154 | while (--loop && (count = safe_read(pty, buf, sizeof(buf))) > 0) { | 154 | while (--loop && (count = safe_read(pty, buf, sizeof(buf))) > 0) { |
155 | full_write(1, buf, count); | 155 | full_write(STDOUT_FILENO, buf, count); |
156 | full_write(outfd, buf, count); | 156 | full_write(outfd, buf, count); |
157 | } | 157 | } |
158 | restore: | 158 | restore: |