diff options
Diffstat (limited to 'utils/hwstub/tools/hwstub_shell.cpp')
-rw-r--r-- | utils/hwstub/tools/hwstub_shell.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/utils/hwstub/tools/hwstub_shell.cpp b/utils/hwstub/tools/hwstub_shell.cpp index 5fb3e13840..b2cf2cec60 100644 --- a/utils/hwstub/tools/hwstub_shell.cpp +++ b/utils/hwstub/tools/hwstub_shell.cpp | |||
@@ -1239,6 +1239,7 @@ void usage(void) | |||
1239 | printf("options:\n"); | 1239 | printf("options:\n"); |
1240 | printf(" --help/-? Display this help\n"); | 1240 | printf(" --help/-? Display this help\n"); |
1241 | printf(" --quiet/-q Quiet non-command messages\n"); | 1241 | printf(" --quiet/-q Quiet non-command messages\n"); |
1242 | printf(" -b/--batch Disable interactive mode after running commands and files\n"); | ||
1242 | printf(" --verbose/-v Verbose output\n"); | 1243 | printf(" --verbose/-v Verbose output\n"); |
1243 | printf(" -i <init> Set lua init file (default is init.lua)\n"); | 1244 | printf(" -i <init> Set lua init file (default is init.lua)\n"); |
1244 | printf(" -e <cmd> Execute <cmd> at startup\n"); | 1245 | printf(" -e <cmd> Execute <cmd> at startup\n"); |
@@ -1293,6 +1294,7 @@ int main(int argc, char **argv) | |||
1293 | { | 1294 | { |
1294 | std::string dev_uri = hwstub::uri::default_uri().full_uri(); | 1295 | std::string dev_uri = hwstub::uri::default_uri().full_uri(); |
1295 | bool verbose = false; | 1296 | bool verbose = false; |
1297 | bool batch = false; | ||
1296 | 1298 | ||
1297 | const char *lua_init = "init.lua"; | 1299 | const char *lua_init = "init.lua"; |
1298 | std::vector< std::pair< exec_type, std::string > > startup_cmds; | 1300 | std::vector< std::pair< exec_type, std::string > > startup_cmds; |
@@ -1309,11 +1311,12 @@ int main(int argc, char **argv) | |||
1309 | {"startfile", required_argument, 0, 'f'}, | 1311 | {"startfile", required_argument, 0, 'f'}, |
1310 | {"dev", required_argument, 0, 'd'}, | 1312 | {"dev", required_argument, 0, 'd'}, |
1311 | {"verbose", no_argument, 0, 'v'}, | 1313 | {"verbose", no_argument, 0, 'v'}, |
1314 | {"batch", no_argument, 0, 'b'}, | ||
1312 | {"debug-rw", no_argument, 0, OPT_DBG_RW}, | 1315 | {"debug-rw", no_argument, 0, OPT_DBG_RW}, |
1313 | {0, 0, 0, 0} | 1316 | {0, 0, 0, 0} |
1314 | }; | 1317 | }; |
1315 | 1318 | ||
1316 | int c = getopt_long(argc, argv, "?qi:e:f:d:v", long_options, NULL); | 1319 | int c = getopt_long(argc, argv, "?qi:e:f:d:vb", long_options, NULL); |
1317 | if(c == -1) | 1320 | if(c == -1) |
1318 | break; | 1321 | break; |
1319 | switch(c) | 1322 | switch(c) |
@@ -1344,6 +1347,9 @@ int main(int argc, char **argv) | |||
1344 | case OPT_DBG_RW: | 1347 | case OPT_DBG_RW: |
1345 | g_print_mem_rw = true; | 1348 | g_print_mem_rw = true; |
1346 | break; | 1349 | break; |
1350 | case 'b': | ||
1351 | batch = true; | ||
1352 | break; | ||
1347 | default: | 1353 | default: |
1348 | abort(); | 1354 | abort(); |
1349 | } | 1355 | } |
@@ -1441,7 +1447,9 @@ int main(int argc, char **argv) | |||
1441 | /* intercept CTRL+C */ | 1447 | /* intercept CTRL+C */ |
1442 | signal(SIGINT, do_signal); | 1448 | signal(SIGINT, do_signal); |
1443 | // start interactive shell | 1449 | // start interactive shell |
1444 | luap_enter(g_lua, &g_exit); | 1450 | if(!batch) |
1451 | luap_enter(g_lua, &g_exit); | ||
1452 | // cleanup | ||
1445 | lua_close(g_lua); | 1453 | lua_close(g_lua); |
1446 | 1454 | ||
1447 | // display log if handled | 1455 | // display log if handled |