From 6f26772e66534384a8e0bdf4f50030d99e9365ba Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Thu, 25 Aug 2016 22:38:34 -0400 Subject: [PATCH] pwmc: --interactive -> --no-interactive. --- doc/pwmc.1.in | 7 ++++--- src/pwmc.c | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/doc/pwmc.1.in b/doc/pwmc.1.in index fb73f452..c9e112dc 100644 --- a/doc/pwmc.1.in +++ b/doc/pwmc.1.in @@ -312,9 +312,10 @@ The default is Do not show informational messages from pwmc. Implies --no-status. .TP -.I "\--interactive" -Use an interactive pwmc shell. This will let you send more than one command -per connection and is the default when input is from a terminal. See +.I "\--no-interactive" +Disable interactive mode. By default, interactive mode is enabled when input +is from a terminal. Interactive mode allows for sending more than one command +per connection. See .B INTERACTIVE for more information. diff --git a/src/pwmc.c b/src/pwmc.c index bc184efc..8e629a2a 100644 --- a/src/pwmc.c +++ b/src/pwmc.c @@ -250,8 +250,8 @@ usage (const char *pn, int status) " --quiet\n" " disable showing of extra messages (implies --no-status)\n" #ifdef HAVE_LIBREADLINE - " --interactive\n" - " use a shell like interface to pwmd (allows more than one command)\n" + " --no-interactive\n" + " disable interactive mode\n" #endif " --version\n" " --help\n"), @@ -1540,6 +1540,9 @@ main (int argc, char *argv[]) long socket_timeout = 300; int connect_timeout = 120; #endif +#ifdef HAVE_LIBREADLINE + int no_interactive = 0; +#endif int lock_on_open = 1; long lock_timeout = 50; char *url = NULL; @@ -1567,7 +1570,7 @@ main (int argc, char *argv[]) OPT_VERSION, OPT_HELP, OPT_KEYID, OPT_SIGN_KEYID, OPT_SYMMETRIC, OPT_KEYPARAMS, OPT_NO_PINENTRY, OPT_QUIET, #ifdef HAVE_LIBREADLINE - OPT_INTERACTIVE, + OPT_NO_INTERACTIVE, #endif }; const struct option long_opts[] = { @@ -1628,7 +1631,7 @@ main (int argc, char *argv[]) {"no-pinentry", 0, 0, 0}, {"quiet", 0, 0, 0}, #ifdef HAVE_LIBREADLINE - {"interactive", 0, 0}, + {"no-interactive", 0, 0}, #endif {0, 0, 0, 0} }; @@ -1841,8 +1844,8 @@ main (int argc, char *argv[]) no_pinentry = 1; break; #ifdef HAVE_LIBREADLINE - case OPT_INTERACTIVE: - interactive = 1; + case OPT_NO_INTERACTIVE: + no_interactive = 1; break; #endif default: @@ -1889,9 +1892,7 @@ main (int argc, char *argv[]) } #ifdef HAVE_LIBREADLINE - if (interactive && !isatty (STDIN_FILENO)) - usage (argv[0], EXIT_FAILURE); - else if (isatty (STDIN_FILENO) && !inquire && !inquire_line) + if (isatty (STDIN_FILENO) && !inquire && !inquire_line && !no_interactive) interactive = 1; #endif -- 2.11.4.GIT