aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-11-24 02:23:51 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-11-24 02:23:51 +0000
commitfe5e23bf75043302a3492c9a7cd2f30f20f51b2e (patch)
treec6d5a70e6430755a0e20c682c090dfbedbd254ce
parentc3c6659f12e4133054ae4a6708fc4ac299c0d098 (diff)
downloadbusybox-w32-fe5e23bf75043302a3492c9a7cd2f30f20f51b2e.tar.gz
busybox-w32-fe5e23bf75043302a3492c9a7cd2f30f20f51b2e.tar.bz2
busybox-w32-fe5e23bf75043302a3492c9a7cd2f30f20f51b2e.zip
remove echo_main -> bb_echo indirection
-rw-r--r--coreutils/echo.c20
-rw-r--r--include/libbb.h2
-rw-r--r--shell/ash.c2
-rw-r--r--shell/hush.c2
4 files changed, 11 insertions, 15 deletions
diff --git a/coreutils/echo.c b/coreutils/echo.c
index 4c7a91743..e39b466c0 100644
--- a/coreutils/echo.c
+++ b/coreutils/echo.c
@@ -25,9 +25,13 @@
25 25
26#include "libbb.h" 26#include "libbb.h"
27 27
28/* This is a NOFORK applet. Be very careful! */
29
28/* argc is unused, but removing it precludes compiler from 30/* argc is unused, but removing it precludes compiler from
29 * using call -> jump optimization */ 31 * using call -> jump optimization */
30int bb_echo(int argc, char **argv) 32
33int echo_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
34int echo_main(int argc, char **argv)
31{ 35{
32 const char *arg; 36 const char *arg;
33#if !ENABLE_FEATURE_FANCY_ECHO 37#if !ENABLE_FEATURE_FANCY_ECHO
@@ -38,7 +42,7 @@ int bb_echo(int argc, char **argv)
38 42
39 /* We must check that stdout is not closed. 43 /* We must check that stdout is not closed.
40 * The reason for this is highly non-obvious. 44 * The reason for this is highly non-obvious.
41 * bb_echo is used from shell. Shell must correctly handle "echo foo" 45 * echo_main is used from shell. Shell must correctly handle "echo foo"
42 * if stdout is closed. With stdio, output gets shoveled into 46 * if stdout is closed. With stdio, output gets shoveled into
43 * stdout buffer, and even fflush cannot clear it out. It seems that 47 * stdout buffer, and even fflush cannot clear it out. It seems that
44 * even if libc receives EBADF on write attempts, it feels determined 48 * even if libc receives EBADF on write attempts, it feels determined
@@ -135,14 +139,6 @@ int bb_echo(int argc, char **argv)
135 return fflush(stdout); 139 return fflush(stdout);
136} 140}
137 141
138/* This is a NOFORK applet. Be very careful! */
139
140int echo_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
141int echo_main(int argc, char **argv)
142{
143 return bb_echo(argc, argv);
144}
145
146/*- 142/*-
147 * Copyright (c) 1991, 1993 143 * Copyright (c) 1991, 1993
148 * The Regents of the University of California. All rights reserved. 144 * The Regents of the University of California. All rights reserved.
@@ -185,7 +181,7 @@ int echo_main(int argc, char **argv)
185#ifdef VERSION_WITH_WRITEV 181#ifdef VERSION_WITH_WRITEV
186/* We can't use stdio. 182/* We can't use stdio.
187 * The reason for this is highly non-obvious. 183 * The reason for this is highly non-obvious.
188 * bb_echo is used from shell. Shell must correctly handle "echo foo" 184 * echo_main is used from shell. Shell must correctly handle "echo foo"
189 * if stdout is closed. With stdio, output gets shoveled into 185 * if stdout is closed. With stdio, output gets shoveled into
190 * stdout buffer, and even fflush cannot clear it out. It seems that 186 * stdout buffer, and even fflush cannot clear it out. It seems that
191 * even if libc receives EBADF on write attempts, it feels determined 187 * even if libc receives EBADF on write attempts, it feels determined
@@ -195,7 +191,7 @@ int echo_main(int argc, char **argv)
195 * Using writev instead, with 'direct' conversion of argv vector. 191 * Using writev instead, with 'direct' conversion of argv vector.
196 */ 192 */
197 193
198int bb_echo(int argc, char **argv) 194int echo_main(int argc, char **argv)
199{ 195{
200 struct iovec io[argc]; 196 struct iovec io[argc];
201 struct iovec *cur_io = io; 197 struct iovec *cur_io = io;
diff --git a/include/libbb.h b/include/libbb.h
index 77392d09c..095647dd4 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -728,7 +728,7 @@ extern void bb_verror_msg(const char *s, va_list p, const char *strerr);
728 728
729/* applets which are useful from another applets */ 729/* applets which are useful from another applets */
730int bb_cat(char** argv); 730int bb_cat(char** argv);
731int bb_echo(int argc, char** argv); 731int echo_main(int argc, char** argv) MAIN_EXTERNALLY_VISIBLE;
732int test_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 732int test_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
733int kill_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 733int kill_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
734#if ENABLE_ROUTE 734#if ENABLE_ROUTE
diff --git a/shell/ash.c b/shell/ash.c
index 4113ce8e2..7f7531650 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -11003,7 +11003,7 @@ exitcmd(int argc, char **argv)
11003static int 11003static int
11004echocmd(int argc, char **argv) 11004echocmd(int argc, char **argv)
11005{ 11005{
11006 return bb_echo(argc, argv); 11006 return echo_main(argc, argv);
11007} 11007}
11008#endif 11008#endif
11009 11009
diff --git a/shell/hush.c b/shell/hush.c
index a9c1fe7dd..f7e2a4a14 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -853,7 +853,7 @@ static int builtin_echo(char **argv)
853 argc++; 853 argc++;
854 argv++; 854 argv++;
855 } 855 }
856 return bb_echo(argc, argv - argc); 856 return echo_main(argc, argv - argc);
857} 857}
858 858
859/* built-in 'eval' handler */ 859/* built-in 'eval' handler */