diff --git a/src/p7/args.c b/src/p7/args.c index bc724df..156fc0f 100644 --- a/src/p7/args.c +++ b/src/p7/args.c @@ -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]); diff --git a/src/p7/main.c b/src/p7/main.c index 16d1e39..9eb669b 100644 --- a/src/p7/main.c +++ b/src/p7/main.c @@ -265,6 +265,8 @@ int main(int ac, char **av) case mn_info: err = dump(handle); break; + case mn_idle: + break; /* time! */ } /* put error */ diff --git a/src/p7/main.h b/src/p7/main.h index 77f7548..786ed42 100644 --- a/src/p7/main.h +++ b/src/p7/main.h @@ -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 */