From 4d809c2211e680238b131b185f9d7a4506724f06 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Wed, 11 Jul 2007 12:44:47 -0400 Subject: [PATCH] Make the filename argument to pwmc optional. The command may be a cache command. --- pwmc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pwmc.c b/pwmc.c index 9346bfc1..1e624957 100644 --- a/pwmc.c +++ b/pwmc.c @@ -34,7 +34,7 @@ static void usage(const char *pn) { fprintf(stderr, "Reads PWMD protocol commands from standard input.\n\n" - "Usage: %s [-hv] [-E] [-s ] [[-a [-P pinentry]] | [-p ]] [-S] \n" + "Usage: %s [-hv] [-E] [-s ] [[-a [-P pinentry]] | [-p ]] [-S] [filename]\n" " -E exit after a command failure\n" " -s socket path\n" " -p password\n" @@ -102,10 +102,9 @@ int main(int argc, char *argv[]) if (use_pinentry && password) usage(argv[0]); - if (argc - optind != 1) - usage(argv[0]); + if (argc - optind == 1) + filename = argv[optind]; - filename = argv[optind]; pwmd_init(); if ((pwm = pwmd_connect(socketpath, &error)) == NULL) { @@ -156,7 +155,7 @@ int main(int argc, char *argv[]) xfree(password); } - if (pwmd_open(pwm, &error, filename) != PWMD_OK) { + if (filename && pwmd_open(pwm, &error, filename) != PWMD_OK) { show_error(error); pwmd_close(pwm); exit(EXIT_FAILURE); -- 2.11.4.GIT