diff --git a/src/console.c b/src/console.c index 7b2b2bc..0cea4f5 100644 --- a/src/console.c +++ b/src/console.c @@ -49,14 +49,13 @@ typedef enum LuaConsoleError { // usage message const char HELP_MESSAGE[] = - "Lua Console | Version: 5/6/2017\n" + "Lua Console | Version: 6/13/2017\n" LUA_COPYRIGHT LUA_CONSOLE_COPYRIGHT "\n" "Supports Lua5.3, Lua5.2, Lua5.1\n" "5.2.x and 5.1.x assume that you have enough memory for initial functions.\n" "\n" - "\t- Line by Line interpretation\n" "\t- Files executed by passing\n" "\t- Working directory support\n" "\t- Built in stack-dump\n" @@ -79,7 +78,6 @@ static lua_State* L; // necessary to put this outside of main, print doesn't work static int no_libraries = 0; -static int squelch = 0; @@ -153,6 +151,7 @@ int main(int argc, char* argv[]) int no_file = 0; char* start = 0; int no_additions = 0; + int copyright_squelch = 0; int parameters = 0; char** parameters_argv = 0; @@ -193,7 +192,7 @@ int main(int argc, char* argv[]) no_additions = 1; break; case 'c': case 'C': - squelch = 1; + copyright_squelch = 1; break; case 'n': case 'N': parameters = argc - i - 1; @@ -245,6 +244,11 @@ int main(int argc, char* argv[]) lua_close(gL); } + // copyright + if(copyright_squelch == 0) { + fprintf(stdout, LUA_COPYRIGHT "\n"); + fprintf(stdout, LUA_CONSOLE_COPYRIGHT); + } // if there is nothing to do, then exit, as there is nothing left to do if(no_file == 1) { @@ -257,7 +261,6 @@ int main(int argc, char* argv[]) if(no_additions == 0) additions_add(L); - // load function into protected mode (pcall) int status = start_protective_mode(&lua_main_dofile, argv[1], parameters_argv, parameters); diff --git a/src/consolew.c b/src/consolew.c index ab3c7c9..49359f3 100644 --- a/src/consolew.c +++ b/src/consolew.c @@ -38,7 +38,6 @@ #define PRIMARY_BUFFER_SIZE 1025 #define SECONDARY_BUFFER_SIZE 1033 - // internal enums, represent lua error category typedef enum LuaConsoleError { INTERNAL_ERROR = 0, @@ -49,7 +48,7 @@ typedef enum LuaConsoleError { // usage message const char HELP_MESSAGE[] = - "Lua Console | Version: 5/6/2017\n" + "Lua Console | Version: 6/13/2017\n" LUA_COPYRIGHT LUA_CONSOLE_COPYRIGHT "\n" @@ -78,12 +77,11 @@ const char HELP_MESSAGE[] = static lua_State* L; -// variable to end line by line iterpretation loop +// variable to end line by line iterpretation loop, for adaption static int should_close = 0; // necessary to put this outside of main, print doesn't work static int no_libraries = 0; -static int squelch = 0; @@ -123,11 +121,6 @@ static int lua_main_postexist(lua_State* L) { exit(EXIT_FAILURE); } - if(squelch == 0) { - printf(LUA_COPYRIGHT "\n"); - printf(LUA_CONSOLE_COPYRIGHT); - } - int status = 0; while(should_close != 1) { // reset @@ -238,6 +231,7 @@ int main(int argc, char* argv[]) int no_file = 0; char* start = 0; int no_additions = 0; + int copyright_squelch = 0; int parameters = 0; char** parameters_argv = 0; @@ -283,7 +277,7 @@ int main(int argc, char* argv[]) no_additions = 1; break; case 'c': case 'C': - squelch = 1; + copyright_squelch = 1; break; case 'n': case 'N': parameters = argc - i - 1; @@ -335,6 +329,12 @@ int main(int argc, char* argv[]) lua_close(gL); } + // copyright + if(copyright_squelch == 0) { + fprintf(stdout, LUA_COPYRIGHT "\n"); + fprintf(stdout, LUA_CONSOLE_COPYRIGHT); + } + // if there is nothing to do, then exit, as there is nothing left to do if(no_file == 1 && post_exist != 1) { @@ -347,7 +347,6 @@ int main(int argc, char* argv[]) if(no_additions == 0) additions_add(L); - // load function into protected mode (pcall) int status = 0; if(post_exist == 1) {