forked from len0rd/rockbox
hwstub: allow to escape shell with a function call
Change-Id: I65b7b230d3b89a5014db134d3159861474fd889f
This commit is contained in:
parent
f617da0552
commit
7827b7ccdb
1 changed files with 14 additions and 1 deletions
|
|
@ -37,6 +37,7 @@
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
bool g_quiet = false;
|
bool g_quiet = false;
|
||||||
|
bool g_exit = false;
|
||||||
struct hwstub_device_t g_hwdev;
|
struct hwstub_device_t g_hwdev;
|
||||||
struct usb_resp_info_version_t g_hwdev_ver;
|
struct usb_resp_info_version_t g_hwdev_ver;
|
||||||
struct usb_resp_info_layout_t g_hwdev_layout;
|
struct usb_resp_info_layout_t g_hwdev_layout;
|
||||||
|
|
@ -210,6 +211,12 @@ int my_lua_printlog(lua_State *state)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int my_lua_exit(lua_State *state)
|
||||||
|
{
|
||||||
|
g_exit = true;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool my_lua_import_hwstub()
|
bool my_lua_import_hwstub()
|
||||||
{
|
{
|
||||||
int oldtop = lua_gettop(g_lua);
|
int oldtop = lua_gettop(g_lua);
|
||||||
|
|
@ -340,6 +347,12 @@ bool my_lua_import_hwstub()
|
||||||
lua_pushcfunction(g_lua, my_lua_help);
|
lua_pushcfunction(g_lua, my_lua_help);
|
||||||
lua_setglobal(g_lua, "help");
|
lua_setglobal(g_lua, "help");
|
||||||
|
|
||||||
|
lua_pushcfunction(g_lua, my_lua_exit);
|
||||||
|
lua_setglobal(g_lua, "exit");
|
||||||
|
|
||||||
|
lua_pushcfunction(g_lua, my_lua_exit);
|
||||||
|
lua_setglobal(g_lua, "quit");
|
||||||
|
|
||||||
if(lua_gettop(g_lua) != oldtop)
|
if(lua_gettop(g_lua) != oldtop)
|
||||||
{
|
{
|
||||||
printf("internal error: unbalanced my_lua_import_soc");
|
printf("internal error: unbalanced my_lua_import_soc");
|
||||||
|
|
@ -824,7 +837,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
// use readline to provide some history and completion
|
// use readline to provide some history and completion
|
||||||
rl_bind_key('\t', rl_complete);
|
rl_bind_key('\t', rl_complete);
|
||||||
while(1)
|
while(!g_exit)
|
||||||
{
|
{
|
||||||
char *input = readline("> ");
|
char *input = readline("> ");
|
||||||
if(!input)
|
if(!input)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue