cake
/
p7utils
Archived
1
0
Fork 0

Added an 'idle' subcommand.

This commit is contained in:
Thomas Touhey 2017-04-04 23:34:17 +02:00
parent 5ff68c806b
commit 746f97f061
3 changed files with 14 additions and 1 deletions

View File

@ -51,6 +51,7 @@ static const char help_main[] =
" optimize Optimize the distant filesystem.\n"
" list List files on the distant filesystem.\n"
" info Dump info about the calculator.\n"
" idle Do nothing (only start or end the communication)\n"
"\n"
"General options:\n"
" -h, --help Display the help page of the (sub)command and quit.\n"
@ -151,6 +152,14 @@ static const char help_listcom[] =
"List serial devices.\n"
FOOT;
/* Idle */
static const char help_idle[] =
"Usage: " QUOTE(BIN) " idle\n"
"Only initialize or end the communication.\n"
"This subcommand is useful when used with `--no-init` and/or `--no-exit`.\n"
"It allows you to prepare the communication state for the next calls, or to\n"
"end a series of calls, without any side effects.\n"
FOOT;
/* ************************************************************************** */
/* Main function */
/* ************************************************************************** */
@ -316,6 +325,8 @@ int parse_args(int ac, char **av, args_t *args)
/* get filename */
args->filename = aav[1];
args->dirname = s_dir;
} else if (!strcmp(aav[0], "idle") || !strcmp(aav[0], "laze")) {
sub_init(idle, 0)
} else {
/* unknown subcommand ! */
log("Unknown subcommand '%s'.\n", aav[0]);

View File

@ -265,6 +265,8 @@ int main(int ac, char **av)
case mn_info:
err = dump(handle);
break;
case mn_idle:
break; /* time! */
}
/* put error */

View File

@ -27,7 +27,7 @@
/* Menus */
typedef enum {
mn_send, mn_get, mn_copy, mn_del, mn_list, mn_reset,
mn_optimize, mn_info
mn_optimize, mn_info, mn_idle
} menu_t;
/* Arguments */