[git] Pinentry - branch, master, updated. pinentry-0.9.6-7-gf238a58

by Neal H. Walfield cvs at cvs.gnupg.org
Wed Nov 18 13:41:34 CET 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The standard pinentry collection".

The branch, master has been updated
       via  f238a58772b7d51362ca7d819e1648a64ff50d57 (commit)
      from  f143d216eff4eac3f05a85640b9f91431aec5588 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f238a58772b7d51362ca7d819e1648a64ff50d57
Author: Neal H. Walfield <neal at gnu.org>
Date:   Wed Nov 18 13:40:47 2015 +0100

    tty: Flush output.  Show an error if an invalid option is selected.
    
    * tty/pinentry-tty.c (confirm): Flush the output after printing the
    prompt.  Echo what the user typed.  If the user's selection is
    invalid, indicate as much.
    
    --
    Signed-off-by: Neal H. Walfield <neal at g10code.com>

diff --git a/tty/pinentry-tty.c b/tty/pinentry-tty.c
index 49571ba..76b6865 100644
--- a/tty/pinentry-tty.c
+++ b/tty/pinentry-tty.c
@@ -213,23 +213,28 @@ confirm (pinentry_t pinentry, FILE *ttyfi, FILE *ttyfo)
       return -1;
     }
 
-  if (pinentry->one_button)
-    fprintf (ttyfo, "Press any key to continue.");
-  else
-    {
-      fputc ('[', ttyfo);
-      if (ok)
-	fputc (tolower (ok), ttyfo);
-      if (cancel)
-	fputc (tolower (cancel), ttyfo);
-      if (notok)
-	fputc (tolower (notok), ttyfo);
-      fputs("]? ", ttyfo);
-    }
-
   while (1)
     {
-      int input = fgetc (ttyfi);
+      int input;
+
+      if (pinentry->one_button)
+        fprintf (ttyfo, "Press any key to continue.");
+      else
+        {
+          fputc ('[', ttyfo);
+          if (ok)
+            fputc (tolower (ok), ttyfo);
+          if (cancel)
+            fputc (tolower (cancel), ttyfo);
+          if (notok)
+            fputc (tolower (notok), ttyfo);
+          fputs("]? ", ttyfo);
+        }
+      fflush (ttyfo);
+
+      input = fgetc (ttyfi);
+      fprintf (ttyfo, "%c\n", input);
+
       if (input == EOF || input == 0x4)
 	/* End of file or control-d (= end of file).  */
 	{
@@ -262,10 +267,12 @@ confirm (pinentry_t pinentry, FILE *ttyfi, FILE *ttyfo)
 	  ret = 1;
 	  break;
 	}
+      else
+        {
+          fprintf (ttyfo, "Invalid selection.\n");
+        }
     }
 
-  fputc('\n', ttyfo);
-
   tcsetattr (fileno(ttyfi), TCSANOW, &o_term);
 
   return ret;

-----------------------------------------------------------------------

Summary of changes:
 tty/pinentry-tty.c | 41 ++++++++++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
The standard pinentry collection
http://git.gnupg.org




More information about the Gnupg-commits mailing list