diff --git a/js/js2/js2.cpp b/js/js2/js2.cpp index 698163951287..34cd91755630 100644 --- a/js/js2/js2.cpp +++ b/js/js2/js2.cpp @@ -27,35 +27,35 @@ #include "world.h" #include "interpreter.h" -namespace JavaScript { - namespace Shell { - using namespace Interpreter; #if defined(XP_MAC) && !defined(XP_MAC_MPW) #include #include - static char *mac_argv[] = {"js2", 0}; - - static void initConsole(StringPtr consoleName, - const char* startupMessage, - int &argc, char **&argv) - { - SIOUXSettings.autocloseonquit = false; - SIOUXSettings.asktosaveonclose = false; - SIOUXSetTitle(consoleName); - - // Set up a buffer for stderr (otherwise it's a pig). - static char buffer[BUFSIZ]; - setvbuf(stderr, buffer, _IOLBF, BUFSIZ); +static char *mac_argv[] = {"js2", 0}; - stdOut << startupMessage; +static void initConsole(StringPtr consoleName, + const char* startupMessage, + int &argc, char **&argv) +{ + SIOUXSettings.autocloseonquit = false; + SIOUXSettings.asktosaveonclose = false; + SIOUXSetTitle(consoleName); - argc = 1; - argv = mac_argv; - } + // Set up a buffer for stderr (otherwise it's a pig). + static char buffer[BUFSIZ]; + setvbuf(stderr, buffer, _IOLBF, BUFSIZ); + + JavaScript::stdOut << startupMessage; + + argc = 1; + argv = mac_argv; +} #endif +namespace JavaScript { + namespace Shell { + using namespace Interpreter; // Interactively read a line from the input stream in and put it into // s Return false if reached the end of input before reading anything. diff --git a/js2/tests/cpp/js2_shell.cpp b/js2/tests/cpp/js2_shell.cpp index 698163951287..34cd91755630 100644 --- a/js2/tests/cpp/js2_shell.cpp +++ b/js2/tests/cpp/js2_shell.cpp @@ -27,35 +27,35 @@ #include "world.h" #include "interpreter.h" -namespace JavaScript { - namespace Shell { - using namespace Interpreter; #if defined(XP_MAC) && !defined(XP_MAC_MPW) #include #include - static char *mac_argv[] = {"js2", 0}; - - static void initConsole(StringPtr consoleName, - const char* startupMessage, - int &argc, char **&argv) - { - SIOUXSettings.autocloseonquit = false; - SIOUXSettings.asktosaveonclose = false; - SIOUXSetTitle(consoleName); - - // Set up a buffer for stderr (otherwise it's a pig). - static char buffer[BUFSIZ]; - setvbuf(stderr, buffer, _IOLBF, BUFSIZ); +static char *mac_argv[] = {"js2", 0}; - stdOut << startupMessage; +static void initConsole(StringPtr consoleName, + const char* startupMessage, + int &argc, char **&argv) +{ + SIOUXSettings.autocloseonquit = false; + SIOUXSettings.asktosaveonclose = false; + SIOUXSetTitle(consoleName); - argc = 1; - argv = mac_argv; - } + // Set up a buffer for stderr (otherwise it's a pig). + static char buffer[BUFSIZ]; + setvbuf(stderr, buffer, _IOLBF, BUFSIZ); + + JavaScript::stdOut << startupMessage; + + argc = 1; + argv = mac_argv; +} #endif +namespace JavaScript { + namespace Shell { + using namespace Interpreter; // Interactively read a line from the input stream in and put it into // s Return false if reached the end of input before reading anything.