Add lua expect(string)

Add simple expect functionality.

The expect(string) function will wait for input from the tty device and
only return when there is a string match. Regular expressions are
supported.

Example:

script = expect('password:'); send('my_password\n')
This commit is contained in:
Martin Lund 2024-04-12 18:20:27 +02:00
parent 0afae5d3ee
commit fc54df1f22
4 changed files with 133 additions and 7 deletions

View file

@ -32,3 +32,4 @@ int ctrl_key_code(unsigned char key);
void alert_connect(void);
void alert_disconnect(void);
bool fs_dir_exists(const char *path);
bool regex_match(const char *string, const char *pattern);