mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Add Lua scripting feature
Add support for running Lua scripts that can manipulate the tty control lines. Script is activated automatically on connect or manually via in session key command. The Lua scripting feature opens up for many posibilities in the future such as adding expect like functionality to easily and programatically interact with the connected device.
This commit is contained in:
parent
6fee8514f4
commit
0becfa3274
12 changed files with 590 additions and 72 deletions
|
|
@ -60,6 +60,9 @@ struct config_t
|
|||
char *log_filename;
|
||||
char *socket;
|
||||
char *map;
|
||||
char *script;
|
||||
char *script_filename;
|
||||
bool script_run;
|
||||
};
|
||||
|
||||
static struct config_t c;
|
||||
|
|
@ -297,6 +300,20 @@ static int data_handler(void *user, const char *section, const char *name,
|
|||
{
|
||||
// Do nothing
|
||||
}
|
||||
else if (!strcmp(name, "script"))
|
||||
{
|
||||
asprintf(&c.script, "%s", value);
|
||||
option.script = c.script;
|
||||
}
|
||||
else if (!strcmp(name, "script-file"))
|
||||
{
|
||||
asprintf(&c.script_filename, "%s", value);
|
||||
option.script_filename = c.script_filename;
|
||||
}
|
||||
else if (!strcmp(name, "script-run"))
|
||||
{
|
||||
option.script_run = script_run_option_parse(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
tio_warning_printf("Unknown option '%s' in configuration file, ignored", name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue