master - refactor: move 'interactive' field from struct command_line to struct cmd_context as 'is_interactive' switch
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c33c0545aff1d531972682c8777e5db5e8da5676 Commit: c33c0545aff1d531972682c8777e5db5e8da5676 Parent: 0ab118774029cc955512c4a41930956ccd96a138 Author: Peter Rajnoha <[email protected]> AuthorDate: Fri May 20 14:23:43 2016 +0200 Committer: Peter Rajnoha <[email protected]> CommitterDate: Mon Jun 20 11:33:43 2016 +0200
refactor: move 'interactive' field from struct command_line to struct cmd_context as 'is_interactive' switch
--- lib/commands/toolcontext.h | 1 + tools/lvm.c | 3 ++- tools/lvm2cmdline.h | 1 - tools/lvmcmdline.c | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-)
lib/commands/toolcontext.h +1 -0
@@ -113,6 +113,7 @@ struct cmd_context {* Switches. */ unsigned is_long_lived:1; /* optimises persistent_filter handling */ + unsigned is_interactive:1; unsigned check_pv_dev_sizes:1; unsigned handles_missing_pvs:1; unsigned handles_unknown_segments:1;
tools/lvm.c +2 -1
@@ -193,7 +193,7 @@ int lvm_shell(struct cmd_context *cmd, struct cmdline_context *cmdline) _cmdline = cmdline; - _cmdline->interactive =1 ; + cmd->is_interactive =1 ;while (1 ) {free (input); input =readline ("lvm> " );
@@ -246,6 +246,7 @@ int lvm_shell(struct cmd_context *cmd, struct cmdline_context *cmdline) }_write_history (); } + cmd->is_interactive =0 ;free (input);return 0 ;
tools/lvm2cmdline.h +0 -1
@@ -23,7 +23,6 @@ struct cmdline_context {struct command *commands;int num_commands;int commands_size; -int interactive; };int lvm2_main (int argc,char **argv);
tools/lvmcmdline.c +1 -1
@@ -1739,7 +1739,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv) stack; } -if (ret ==EINVALID_CMD_LINE && !_cmdline.interactive) +if (ret ==EINVALID_CMD_LINE && !cmd->is_interactive)_short_usage (cmd->command->name);log_debug ("Completed: %s" , cmd->cmd_line);