#include "libbb.h"
+/* This is a NOFORK applet. Be very careful! */
+
/* argc is unused, but removing it precludes compiler from
* using call -> jump optimization */
-int bb_echo(int argc, char **argv)
+
+int echo_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+int echo_main(int argc, char **argv)
{
const char *arg;
#if !ENABLE_FEATURE_FANCY_ECHO
/* We must check that stdout is not closed.
* The reason for this is highly non-obvious.
- * bb_echo is used from shell. Shell must correctly handle "echo foo"
+ * echo_main is used from shell. Shell must correctly handle "echo foo"
* if stdout is closed. With stdio, output gets shoveled into
* stdout buffer, and even fflush cannot clear it out. It seems that
* even if libc receives EBADF on write attempts, it feels determined
return fflush(stdout);
}
-/* This is a NOFORK applet. Be very careful! */
-
-int echo_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int echo_main(int argc, char **argv)
-{
- return bb_echo(argc, argv);
-}
-
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
#ifdef VERSION_WITH_WRITEV
/* We can't use stdio.
* The reason for this is highly non-obvious.
- * bb_echo is used from shell. Shell must correctly handle "echo foo"
+ * echo_main is used from shell. Shell must correctly handle "echo foo"
* if stdout is closed. With stdio, output gets shoveled into
* stdout buffer, and even fflush cannot clear it out. It seems that
* even if libc receives EBADF on write attempts, it feels determined
* Using writev instead, with 'direct' conversion of argv vector.
*/
-int bb_echo(int argc, char **argv)
+int echo_main(int argc, char **argv)
{
struct iovec io[argc];
struct iovec *cur_io = io;
/* applets which are useful from another applets */
int bb_cat(char** argv);
-int bb_echo(int argc, char** argv);
+int echo_main(int argc, char** argv) MAIN_EXTERNALLY_VISIBLE;
int test_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int kill_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
#if ENABLE_ROUTE