From 9b5a30ca3e9661514a016de9b7cad1d26bad623d Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Mon, 21 Jan 2008 19:36:25 -0500 Subject: [PATCH] Added pwmc command line option -M to specified a timeout when pinentry method 3 is used. --- pwmc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pwmc.c b/pwmc.c index f85847a8..24f238e4 100644 --- a/pwmc.c +++ b/pwmc.c @@ -16,7 +16,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define DEBUG 1 #include #include #include @@ -70,6 +69,7 @@ static void usage(const char *pn) " [-c ] [-d ] [-I ] [filename]\n" #ifdef DEBUG " -E pinentry method (0=pwmd, 1=pwmd async, 2=libpwmd, 3=libpwmd nb)\n" + " -M pinentry timeout (method 3 only)\n" #endif " -X disable showing of status messages from the server\n" " -c set the client name\n" @@ -211,13 +211,14 @@ int main(int argc, char *argv[]) #ifdef DEBUG int method = 0; pwmd_async_t s; + int timeout = 0; #endif setlocale(LC_ALL, ""); bindtextdomain("libpwmd", LOCALEDIR); #ifdef DEBUG - while ((opt = getopt(argc, argv, "E:c:I:XT:N:D:hvP:p:s:Sd:")) != EOF) { + while ((opt = getopt(argc, argv, "E:M:c:I:XT:N:D:hvP:p:s:Sd:")) != EOF) { #else while ((opt = getopt(argc, argv, "c:I:XT:N:D:hvP:p:s:Sd:")) != EOF) { #endif @@ -226,6 +227,9 @@ int main(int argc, char *argv[]) case 'E': method = atoi(optarg); break; + case 'M': + timeout = atoi(optarg); + break; #endif case 'c': clientname = xstrdup(optarg); @@ -371,7 +375,7 @@ int main(int argc, char *argv[]) } } else if (method == 3) { - int fd = pwmd_open_nb(pwm, &error, filename, 0); + int fd = pwmd_open_nb(pwm, &error, filename, timeout); if (fd == -1) goto done; -- 2.11.4.GIT