From 18894103fcf337dfa672481ffc6b4906f340adff Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 5 Dec 2015 00:22:34 +0100 Subject: accept input from any fd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- info/libpassphrase.texinfo | 52 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 16 deletions(-) (limited to 'info') diff --git a/info/libpassphrase.texinfo b/info/libpassphrase.texinfo index d981a3f..a5a27f1 100644 --- a/info/libpassphrase.texinfo +++ b/info/libpassphrase.texinfo @@ -105,33 +105,53 @@ Including @file{passphrase.h} gives you three functions: @table @code -@item void passphrase_disable_echo(void) -Invoking @code{passphrase_disable_echo} will hide +@item void passphrase_disable_echo1(int fdin) +@itemx void passphrase_disable_echo(void) +Invoking @code{passphrase_disable_echo1} will hide the user input in the terminal (unless passphrase hiding is diabled). This is the first thing you -should call. - -@item char* passphrase_read(void) -@code{passphrase_read} reads the passphrase -from standard input. On error @code{NULL} +should call. @code{fdin} should be a file descriptor +to the terminal. One can be acquired by opening +@file{/dev/tty}. + +@code{passphrase_disable_echo} is deprecated +and is equivalent to +@code{passphrase_disable_echo1(STDIN_FILENO)}. + +@item char* passphrase_read2(int fdin, int flags) +@itemx char* passphrase_read(void) +@code{passphrase_read2} reads the passphrase +from the terminal. On error @code{NULL} will be returned, otherwise a NUL-terminated -passphrase will be returned. +passphrase will be returned. @code{fdin} should +be a file descriptor to the terminal. One can +be acquired by opening @file{/dev/tty}. When you are done with the returned passphrase you should wipe it and free it. -@item void passphrase_reenable_echo(void) +@code{passphrase_read} is deprecated +and is equivalent to +@code{passphrase_read2(STDIN_FILENO, 0)}. + +@item void passphrase_reenable_echo1(int fdin) +@itemx void passphrase_reenable_echo(void) When you have read the passphrase you should -invoke @code{passphrase_reenable_echo}. It will +invoke @code{passphrase_reenable_echo1}. It will revert all settings to the terminal made by -@code{passphrase_disable_echo}. If you have +@code{passphrase_disable_echo1}. If you have made settings changes to the terminal after -@code{passphrase_reenable_echo} but before -@code{passphrase_disable_echo}, those change -may be lost as @code{passphrase_disable_echo} +@code{passphrase_reenable_echo1} but before +@code{passphrase_disable_echo1}, those change +may be lost as @code{passphrase_disable_echo1} saves all settings before changing them and -@code{passphrase_reenable_echo} applies to -saved settings. +@code{passphrase_reenable_echo1} applies to +saved settings. @code{fdin} should be a file +descriptor to the terminal. + +@code{passphrase_reenable_echo} is deprecated +and is equivalent to +@code{passphrase_reenable_echo1(STDIN_FILENO)}. @item void passphrase_wipe(char*, size_t) When you are done using passhprase you should -- cgit v1.2.3-70-g09d2