summaryrefslogtreecommitdiff
path: root/utils/hwstub/tools/hwstub_shell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/hwstub/tools/hwstub_shell.cpp')
-rw-r--r--utils/hwstub/tools/hwstub_shell.cpp20
1 files changed, 5 insertions, 15 deletions
diff --git a/utils/hwstub/tools/hwstub_shell.cpp b/utils/hwstub/tools/hwstub_shell.cpp
index 8b7a8b9e80..f59ca8b82a 100644
--- a/utils/hwstub/tools/hwstub_shell.cpp
+++ b/utils/hwstub/tools/hwstub_shell.cpp
@@ -29,6 +29,9 @@
29#include <lua.hpp> 29#include <lua.hpp>
30#include <unistd.h> 30#include <unistd.h>
31#include "soc_desc.hpp" 31#include "soc_desc.hpp"
32extern "C" {
33#include "prompt.h"
34}
32 35
33#if LUA_VERSION_NUM < 502 36#if LUA_VERSION_NUM < 502
34#warning You need at least lua 5.2 37#warning You need at least lua 5.2
@@ -941,21 +944,8 @@ int main(int argc, char **argv)
941 printf("error: %s\n", lua_tostring(g_lua, -1)); 944 printf("error: %s\n", lua_tostring(g_lua, -1));
942 } 945 }
943 946
944 // use readline to provide some history and completion 947 // start interactive shell
945 rl_bind_key('\t', rl_complete); 948 luap_enter(g_lua, &g_exit);
946 while(!g_exit)
947 {
948 char *input = readline("> ");
949 if(!input)
950 break;
951 add_history(input);
952 // evaluate string
953 if(luaL_dostring(g_lua, input))
954 printf("error: %s\n", lua_tostring(g_lua, -1));
955 // pop everything to start from a clean stack
956 lua_pop(g_lua, lua_gettop(g_lua));
957 free(input);
958 }
959 949
960 Lerr: 950 Lerr:
961 // display log if handled 951 // display log if handled