svn commit: trunk/busybox: applets archival/libunarchive coreutils etc...

aldot at busybox.net aldot at busybox.net
Mon May 19 09:48:17 UTC 2008


Author: aldot
Date: 2008-05-19 02:48:17 -0700 (Mon, 19 May 2008)
New Revision: 22009

Log:
- use STD*_FILENO some more. No object-code changes


Modified:
   trunk/busybox/applets/usage.c
   trunk/busybox/archival/libunarchive/decompress_bunzip2.c
   trunk/busybox/coreutils/split.c
   trunk/busybox/editors/ed.c
   trunk/busybox/editors/vi.c
   trunk/busybox/init/init.c
   trunk/busybox/libbb/appletlib.c
   trunk/busybox/libbb/verror_msg.c
   trunk/busybox/loginutils/getty.c
   trunk/busybox/miscutils/hdparm.c
   trunk/busybox/miscutils/less.c
   trunk/busybox/networking/httpd.c
   trunk/busybox/networking/httpd_indexcgi.c
   trunk/busybox/networking/nc_bloaty.c
   trunk/busybox/networking/telnet.c
   trunk/busybox/procps/nmeter.c
   trunk/busybox/procps/top.c
   trunk/busybox/runit/svlogd.c
   trunk/busybox/shell/ash.c
   trunk/busybox/shell/msh.c
   trunk/busybox/util-linux/script.c


Changeset:
Modified: trunk/busybox/applets/usage.c
===================================================================
--- trunk/busybox/applets/usage.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/applets/usage.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -13,6 +13,6 @@
 
 int main(void)
 {
-	write(1, usage_messages, sizeof(usage_messages));
+	write(STDOUT_FILENO, usage_messages, sizeof(usage_messages));
 	return 0;
 }

Modified: trunk/busybox/archival/libunarchive/decompress_bunzip2.c
===================================================================
--- trunk/busybox/archival/libunarchive/decompress_bunzip2.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/archival/libunarchive/decompress_bunzip2.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -762,7 +762,7 @@
 
 	if (i < 0)
 		fprintf(stderr,"%s\n", bunzip_errors[-i]);
-	else if (read(0, &c, 1))
+	else if (read(STDIN_FILENO, &c, 1))
 		fprintf(stderr,"Trailing garbage ignored\n");
 	return -i;
 }

Modified: trunk/busybox/coreutils/split.c
===================================================================
--- trunk/busybox/coreutils/split.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/coreutils/split.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -98,7 +98,7 @@
 	}
 
 	while (1) {
-		bytes_read = safe_read(0, read_buffer, READ_BUFFER_SIZE);
+		bytes_read = safe_read(STDIN_FILENO, read_buffer, READ_BUFFER_SIZE);
 		if (!bytes_read)
 			break;
 		if (bytes_read < 0)
@@ -130,7 +130,7 @@
 				}
 			}
 
-			xwrite(1, src, to_write);
+			xwrite(STDOUT_FILENO, src, to_write);
 			bytes_read -= to_write;
 			src += to_write;
 		} while (bytes_read);

Modified: trunk/busybox/editors/ed.c
===================================================================
--- trunk/busybox/editors/ed.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/editors/ed.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -825,7 +825,7 @@
 
 	while (num1 <= num2) {
 		if (!expandFlag) {
-			write(1, lp->data, lp->len);
+			write(STDOUT_FILENO, lp->data, lp->len);
 			setCurNum(num1++);
 			lp = lp->next;
 			continue;

Modified: trunk/busybox/editors/vi.c
===================================================================
--- trunk/busybox/editors/vi.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/editors/vi.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -2220,7 +2220,7 @@
 	// get input from User- are there already input chars in Q?
 	if (n <= 0) {
 		// the Q is empty, wait for a typed char
-		n = safe_read(0, readbuffer, sizeof(readbuffer));
+		n = safe_read(STDIN_FILENO, readbuffer, sizeof(readbuffer));
 		if (n < 0) {
 			if (errno == EBADF || errno == EFAULT || errno == EINVAL
 			 || errno == EIO)
@@ -2243,7 +2243,7 @@
 			 && ((size_t)n <= (sizeof(readbuffer) - 8))
 			) {
 				// read the rest of the ESC string
-				int r = safe_read(0, readbuffer + n, sizeof(readbuffer) - n);
+				int r = safe_read(STDIN_FILENO, readbuffer + n, sizeof(readbuffer) - n);
 				if (r > 0)
 					n += r;
 			}
@@ -4035,7 +4035,7 @@
 		printf("\n\n%d: \'%c\' %s\n\n\n%s[Hit return to continue]%s",
 			totalcmds, last_input_char, msg, SOs, SOn);
 		fflush(stdout);
-		while (safe_read(0, d, 1) > 0) {
+		while (safe_read(STDIN_FILENO, d, 1) > 0) {
 			if (d[0] == '\n' || d[0] == '\r')
 				break;
 		}

Modified: trunk/busybox/init/init.c
===================================================================
--- trunk/busybox/init/init.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/init/init.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -175,7 +175,7 @@
 
 	if (where & L_CONSOLE) {
 		/* Send console messages to console so people will see them. */
-		full_write(2, msg, l);
+		full_write(STDERR_FILENO, msg, l);
 	}
 }
 
@@ -471,8 +471,8 @@
 		messageD(L_LOG, "waiting for enter to start '%s'"
 					"(pid %d, tty '%s')\n",
 				a->command, getpid(), a->terminal);
-		full_write(1, press_enter, sizeof(press_enter) - 1);
-		while (safe_read(0, &c, 1) == 1 && c != '\n')
+		full_write(STDOUT_FILENO, press_enter, sizeof(press_enter) - 1);
+		while (safe_read(STDIN_FILENO, &c, 1) == 1 && c != '\n')
 			continue;
 	}
 

Modified: trunk/busybox/libbb/appletlib.c
===================================================================
--- trunk/busybox/libbb/appletlib.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/libbb/appletlib.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -98,7 +98,7 @@
 
 static void full_write2_str(const char *str)
 {
-	full_write(2, str, strlen(str));
+	full_write(STDERR_FILENO, str, strlen(str));
 }
 
 void bb_show_usage(void)

Modified: trunk/busybox/libbb/verror_msg.c
===================================================================
--- trunk/busybox/libbb/verror_msg.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/libbb/verror_msg.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -56,7 +56,7 @@
 
 	if (logmode & LOGMODE_STDIO) {
 		fflush(stdout);
-		full_write(2, msg, used + msgeol_len);
+		full_write(STDERR_FILENO, msg, used + msgeol_len);
 	}
 	if (logmode & LOGMODE_SYSLOG) {
 		syslog(LOG_ERR, "%s", msg + applet_len);

Modified: trunk/busybox/loginutils/getty.c
===================================================================
--- trunk/busybox/loginutils/getty.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/loginutils/getty.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -344,7 +344,7 @@
 	 * try to extract the speed of the dial-in call.
 	 */
 	sleep(1);
-	nread = safe_read(0, buf, size_buf - 1);
+	nread = safe_read(STDIN_FILENO, buf, size_buf - 1);
 	if (nread > 0) {
 		buf[nread] = '\0';
 		for (bp = buf; bp < buf + nread; bp++) {
@@ -421,7 +421,7 @@
 		while (cp->eol == '\0') {
 
 			/* Do not report trivial EINTR/EIO errors. */
-			if (read(0, &c, 1) < 1) {
+			if (read(STDIN_FILENO, &c, 1) < 1) {
 				if (errno == EINTR || errno == EIO)
 					exit(EXIT_SUCCESS);
 				bb_perror_msg_and_die("%s: read", op->tty);
@@ -460,7 +460,7 @@
 #endif
 				cp->erase = ascval;     /* set erase character */
 				if (bp > logname) {
-					full_write(1, erase[cp->parity], 3);
+					full_write(STDOUT_FILENO, erase[cp->parity], 3);
 					bp--;
 				}
 				break;
@@ -470,7 +470,7 @@
 #endif
 				cp->kill = ascval;      /* set kill character */
 				while (bp > logname) {
-					full_write(1, erase[cp->parity], 3);
+					full_write(STDOUT_FILENO, erase[cp->parity], 3);
 					bp--;
 				}
 				break;
@@ -482,7 +482,7 @@
 				} else if ((int)(bp - logname) >= size_logname - 1) {
 					bb_error_msg_and_die("%s: input overrun", op->tty);
 				} else {
-					full_write(1, &c, 1); /* echo the character */
+					full_write(STDOUT_FILENO, &c, 1); /* echo the character */
 					*bp++ = ascval; /* and store it */
 				}
 				break;
@@ -715,7 +715,7 @@
 	/* Write the modem init string and DON'T flush the buffers */
 	if (options.flags & F_INITSTRING) {
 		debug("writing init string\n");
-		full_write(1, options.initstring, strlen(options.initstring));
+		full_write(STDOUT_FILENO, options.initstring, strlen(options.initstring));
 	}
 
 	/* Optionally detect the baud rate from the modem status message */
@@ -731,7 +731,7 @@
 		char ch;
 
 		debug("waiting for cr-lf\n");
-		while (safe_read(0, &ch, 1) == 1) {
+		while (safe_read(STDIN_FILENO, &ch, 1) == 1) {
 			debug("read %x\n", (unsigned char)ch);
 			ch &= 0x7f;                     /* strip "parity bit" */
 			if (ch == '\n' || ch == '\r')
@@ -767,7 +767,7 @@
 	termios_final(&options, &termios, &chardata);
 
 	/* Now the newline character should be properly written. */
-	full_write(1, "\n", 1);
+	full_write(STDOUT_FILENO, "\n", 1);
 
 	/* Let the login program take care of password validation. */
 	/* We use PATH because we trust that root doesn't set "bad" PATH,

Modified: trunk/busybox/miscutils/hdparm.c
===================================================================
--- trunk/busybox/miscutils/hdparm.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/miscutils/hdparm.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -1924,7 +1924,7 @@
 	unsigned char *b = (unsigned char *)buf;
 	int i;
 
-	xread(0, buf, 1280);
+	xread(STDIN_FILENO, buf, 1280);
 
 	// Convert the newline-separated hex data into an identify block.
 

Modified: trunk/busybox/miscutils/less.c
===================================================================
--- trunk/busybox/miscutils/less.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/miscutils/less.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -273,7 +273,7 @@
 			/* if no unprocessed chars left, eat more */
 			if (readpos >= readeof) {
 				ndelay_on(0);
-				eof_error = safe_read(0, readbuf, sizeof(readbuf));
+				eof_error = safe_read(STDIN_FILENO, readbuf, sizeof(readbuf));
 				ndelay_off(0);
 				readpos = 0;
 				readeof = eof_error;

Modified: trunk/busybox/networking/httpd.c
===================================================================
--- trunk/busybox/networking/httpd.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/networking/httpd.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -947,7 +947,7 @@
 	/* Why??
 	(this also messes up stdin when user runs httpd -i from terminal)
 	ndelay_on(0);
-	while (read(0, iobuf, IOBUF_SIZE) > 0)
+	while (read(STDIN_FILENO, iobuf, IOBUF_SIZE) > 0)
 		continue;
 	*/
 
@@ -1023,7 +1023,7 @@
 
 		if (DEBUG)
 			fprintf(stderr, "headers: '%s'\n", iobuf);
-		full_write(1, iobuf, len);
+		full_write(STDOUT_FILENO, iobuf, len);
 		if (DEBUG)
 			fprintf(stderr, "writing error page: '%s'\n", error_page);
 		return send_file_and_exit(error_page, SEND_BODY);
@@ -1062,7 +1062,7 @@
 	}
 	if (DEBUG)
 		fprintf(stderr, "headers: '%s'\n", iobuf);
-	if (full_write(1, iobuf, len) != len) {
+	if (full_write(STDOUT_FILENO, iobuf, len) != len) {
 		if (verbose > 1)
 			bb_perror_msg("error");
 		log_and_exit();
@@ -1090,7 +1090,7 @@
 
 	while (1) {
 		if (hdr_cnt <= 0) {
-			hdr_cnt = safe_read(0, hdr_buf, sizeof(hdr_buf));
+			hdr_cnt = safe_read(STDIN_FILENO, hdr_buf, sizeof(hdr_buf));
 			if (hdr_cnt <= 0)
 				break;
 			hdr_ptr = hdr_buf;
@@ -1202,8 +1202,8 @@
 			 * and there *is* data to read from the peer
 			 * (POSTDATA) */
 			//count = post_len > (int)sizeof(hdr_buf) ? (int)sizeof(hdr_buf) : post_len;
-			//count = safe_read(0, hdr_buf, count);
-			count = safe_read(0, hdr_buf, sizeof(hdr_buf));
+			//count = safe_read(STDIN_FILENO, hdr_buf, count);
+			count = safe_read(STDIN_FILENO, hdr_buf, sizeof(hdr_buf));
 			if (count > 0) {
 				hdr_cnt = count;
 				hdr_ptr = hdr_buf;
@@ -1237,8 +1237,8 @@
 					/* eof (or error) and there was no "HTTP",
 					 * so write it, then write received data */
 					if (out_cnt) {
-						full_write(1, HTTP_200, sizeof(HTTP_200)-1);
-						full_write(1, rbuf, out_cnt);
+						full_write(STDOUT_FILENO, HTTP_200, sizeof(HTTP_200)-1);
+						full_write(STDOUT_FILENO, rbuf, out_cnt);
 					}
 					break; /* CGI stdout is closed, exiting */
 				}
@@ -1247,7 +1247,7 @@
 				/* "Status" header format is: "Status: 302 Redirected\r\n" */
 				if (out_cnt >= 8 && memcmp(rbuf, "Status: ", 8) == 0) {
 					/* send "HTTP/1.0 " */
-					if (full_write(1, HTTP_200, 9) != 9)
+					if (full_write(STDOUT_FILENO, HTTP_200, 9) != 9)
 						break;
 					rbuf += 8; /* skip "Status: " */
 					count = out_cnt - 8;
@@ -1256,7 +1256,7 @@
 					/* Did CGI add "HTTP"? */
 					if (memcmp(rbuf, HTTP_200, 4) != 0) {
 						/* there is no "HTTP", do it ourself */
-						if (full_write(1, HTTP_200, sizeof(HTTP_200)-1) != sizeof(HTTP_200)-1)
+						if (full_write(STDOUT_FILENO, HTTP_200, sizeof(HTTP_200)-1) != sizeof(HTTP_200)-1)
 							break;
 					}
 					/* Commented out:
@@ -1276,7 +1276,7 @@
 				if (count <= 0)
 					break;  /* eof (or error) */
 			}
-			if (full_write(1, rbuf, count) != count)
+			if (full_write(STDOUT_FILENO, rbuf, count) != count)
 				break;
 			if (DEBUG)
 				fprintf(stderr, "cgi read %d bytes: '%.*s'\n", count, count, rbuf);
@@ -1632,7 +1632,7 @@
 	while ((count = safe_read(f, iobuf, IOBUF_SIZE)) > 0) {
 		ssize_t n;
 		USE_FEATURE_HTTPD_RANGES(if (count > range_len) count = range_len;)
-		n = full_write(1, iobuf, count);
+		n = full_write(STDOUT_FILENO, iobuf, count);
 		if (count != n)
 			break;
 		USE_FEATURE_HTTPD_RANGES(range_len -= count;)

Modified: trunk/busybox/networking/httpd_indexcgi.c
===================================================================
--- trunk/busybox/networking/httpd_indexcgi.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/networking/httpd_indexcgi.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -125,7 +125,7 @@
 {
 	if (buffer + (BUFFER_SIZE-HEADROOM) - dst >= size)
 		return;
-	write(1, buffer, dst - buffer);
+	write(STDOUT_FILENO, buffer, dst - buffer);
 	dst = buffer;
 }
 

Modified: trunk/busybox/networking/nc_bloaty.c
===================================================================
--- trunk/busybox/networking/nc_bloaty.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/networking/nc_bloaty.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -562,7 +562,7 @@
 	/* if we have a timeout AND stdin is closed AND we haven't heard anything
 	 from the net during that time, assume it's dead and close it too. */
 		if (rr == 0) {
-			if (!FD_ISSET(0, &ding1))
+			if (!FD_ISSET(STDIN_FILENO, &ding1))
 				netretry--;                        /* we actually try a coupla times. */
 			if (!netretry) {
 				if (o_verbose > 1)                /* normally we don't care */
@@ -597,12 +597,12 @@
 			goto shovel;
 
 	/* okay, suck more stdin */
-		if (FD_ISSET(0, &ding2)) {                /* stdin: ding! */
-			rr = read(0, bigbuf_in, BIGSIZ);
+		if (FD_ISSET(STDIN_FILENO, &ding2)) {                /* stdin: ding! */
+			rr = read(STDIN_FILENO, bigbuf_in, BIGSIZ);
 	/* Considered making reads here smaller for UDP mode, but 8192-byte
 	 mobygrams are kinda fun and exercise the reassembler. */
 			if (rr <= 0) {                        /* at end, or fukt, or ... */
-				FD_CLR(0, &ding1);                /* disable and close stdin */
+				FD_CLR(STDIN_FILENO, &ding1);                /* disable and close stdin */
 				close(0);
 			} else {
 				rzleft = rr;
@@ -625,7 +625,7 @@
 			return 1;
 		}
 		if (rnleft) {
-			rr = write(1, np, rnleft);
+			rr = write(STDOUT_FILENO, np, rnleft);
 			if (rr > 0) {
 				if (o_ofile) /* log the stdout */
 					oprint('<', (unsigned char *)np, rr);
@@ -783,7 +783,7 @@
 	}
 #endif
 
-	FD_SET(0, &ding1);                        /* stdin *is* initially open */
+	FD_SET(STDIN_FILENO, &ding1);                        /* stdin *is* initially open */
 	if (proggie) {
 		close(0); /* won't need stdin */
 		option_mask32 &= ~OPT_o; /* -o with -e is meaningless! */

Modified: trunk/busybox/networking/telnet.c
===================================================================
--- trunk/busybox/networking/telnet.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/networking/telnet.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -121,7 +121,7 @@
 			" z	suspend telnet\r\n"
 			" e	exit telnet\r\n");
 
-	if (read(0, &b, 1) <= 0)
+	if (read(STDIN_FILENO, &b, 1) <= 0)
 		doexit(EXIT_FAILURE);
 
 	switch (b) {
@@ -256,7 +256,7 @@
 	}
 
 	if (len)
-		write(1, G.buf, len);
+		write(STDOUT_FILENO, G.buf, len);
 }
 
 static void putiac(int c)
@@ -601,7 +601,7 @@
 	ufds[0].events = ufds[1].events = POLLIN;
 #else
 	FD_ZERO(&readfds);
-	FD_SET(0, &readfds);
+	FD_SET(STDIN_FILENO, &readfds);
 	FD_SET(G.netfd, &readfds);
 	maxfd = G.netfd + 1;
 #endif
@@ -629,10 +629,10 @@
 #ifdef USE_POLL
 			if (ufds[0].revents) /* well, should check POLLIN, but ... */
 #else
-			if (FD_ISSET(0, &rfds))
+			if (FD_ISSET(STDIN_FILENO, &rfds))
 #endif
 			{
-				len = read(0, G.buf, DATABUFSIZE);
+				len = read(STDIN_FILENO, G.buf, DATABUFSIZE);
 				if (len <= 0)
 					doexit(EXIT_SUCCESS);
 				TRACE(0, ("Read con: %d\n", len));

Modified: trunk/busybox/procps/nmeter.c
===================================================================
--- trunk/busybox/procps/nmeter.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/procps/nmeter.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -98,7 +98,7 @@
 {
 	int sz = cur_outbuf - outbuf;
 	if (sz > 0) {
-		xwrite(1, outbuf, sz);
+		xwrite(STDOUT_FILENO, outbuf, sz);
 		cur_outbuf = outbuf;
 	}
 }

Modified: trunk/busybox/procps/top.c
===================================================================
--- trunk/busybox/procps/top.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/procps/top.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -888,7 +888,7 @@
 			 /* batch mode, or EOF on stdin ("top </dev/null") */
 			sleep(interval);
 		else if (safe_poll(pfd, 1, interval * 1000) > 0) {
-			if (safe_read(0, &c, 1) != 1) { /* error/EOF? */
+			if (safe_read(STDIN_FILENO, &c, 1) != 1) { /* error/EOF? */
 				option_mask32 |= OPT_EOF;
 				continue;
 			}

Modified: trunk/busybox/runit/svlogd.c
===================================================================
--- trunk/busybox/runit/svlogd.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/runit/svlogd.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -748,7 +748,7 @@
 		poll(&input, 1, i * 1000);
 		sigprocmask(SIG_BLOCK, &blocked_sigset, NULL);
 
-		i = ndelay_read(0, s, len);
+		i = ndelay_read(STDIN_FILENO, s, len);
 		if (i >= 0)
 			break;
 		if (errno == EINTR)
@@ -994,7 +994,7 @@
 				logmatch(ld);
 			if (ld->matcherr == 'e') {
 				/* runit-1.8.0 compat: if timestamping, do it on stderr too */
-				////full_write(2, printptr, printlen);
+				////full_write(STDERR_FILENO, printptr, printlen);
 				fwrite(printptr, 1, printlen, stderr);
 			}
 			if (ld->match != '+') continue;
@@ -1022,7 +1022,7 @@
 			for (i = 0; i < dirn; ++i) {
 				if (dir[i].fddir == -1) continue;
 				if (dir[i].matcherr == 'e') {
-					////full_write(2, lineptr, linelen);
+					////full_write(STDERR_FILENO, lineptr, linelen);
 					fwrite(lineptr, 1, linelen, stderr);
 				}
 				if (dir[i].match != '+') continue;

Modified: trunk/busybox/shell/ash.c
===================================================================
--- trunk/busybox/shell/ash.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/shell/ash.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -1258,7 +1258,7 @@
 {
 #if DEBUG
 	if (!p || (g_stacknxt < (char *)p) || ((char *)p < g_stackp->space)) {
-		write(2, "stunalloc\n", 10);
+		write(STDERR_FILENO, "stunalloc\n", 10);
 		abort();
 	}
 #endif

Modified: trunk/busybox/shell/msh.c
===================================================================
--- trunk/busybox/shell/msh.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/shell/msh.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -743,7 +743,7 @@
 static void prs(const char *s)
 {
 	if (*s)
-		write(2, s, strlen(s));
+		write(STDERR_FILENO, s, strlen(s));
 }
 
 static void prn(unsigned u)
@@ -3384,7 +3384,7 @@
 	}
 	for (wp = args + 1; *wp; wp++) {
 		for (cp = global_env.linep; !nl && cp < elinep - 1; cp++) {
-			nb = nonblock_safe_read(0, cp, sizeof(*cp));
+			nb = nonblock_safe_read(STDIN_FILENO, cp, sizeof(*cp));
 			if (nb != sizeof(*cp))
 				break;
 			nl = (*cp == '\n');
@@ -4522,7 +4522,7 @@
 static void ioecho(char c)
 {
 	if (FLAG['v'])
-		write(2, &c, sizeof c);
+		write(STDERR_FILENO, &c, sizeof c);
 }
 
 static void pushio(struct ioarg *argp, int (*fn) (struct ioarg *))

Modified: trunk/busybox/util-linux/script.c
===================================================================
--- trunk/busybox/util-linux/script.c	2008-05-19 09:29:47 UTC (rev 22008)
+++ trunk/busybox/util-linux/script.c	2008-05-19 09:48:17 UTC (rev 22009)
@@ -124,7 +124,7 @@
 					goto restore;
 				}
 				if (count > 0) {
-					full_write(1, buf, count);
+					full_write(STDOUT_FILENO, buf, count);
 					full_write(outfd, buf, count);
 					if (opt & 4) { /* -f */
 						fsync(outfd);
@@ -132,7 +132,7 @@
 				}
 			}
 			if (pfd[1].revents) {
-				count = safe_read(0, buf, sizeof(buf));
+				count = safe_read(STDIN_FILENO, buf, sizeof(buf));
 				if (count <= 0) {
 					/* err/eof from stdin: don't read stdin anymore */
 					pfd[1].revents = 0;
@@ -152,7 +152,7 @@
 		loop = 999;
 		/* pty is in O_NONBLOCK mode, we exit as soon as buffer is empty */
 		while (--loop && (count = safe_read(pty, buf, sizeof(buf))) > 0) {
-			full_write(1, buf, count);
+			full_write(STDOUT_FILENO, buf, count);
 			full_write(outfd, buf, count);
 		}
  restore:




More information about the busybox-cvs mailing list