tAllow file to be given on the command line - sick - sign and check files using ed25519
(HTM) git clone git://z3bra.org/sick
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 616c92c3d219c4775880f872ae931c82e5313fa5
(DIR) parent 414648b3011b742fb82ee6e2f997973d43184345
(HTM) Author: z3bra <willyatmailoodotorg>
Date: Mon, 16 May 2016 12:14:46 +0200
Allow file to be given on the command line
Diffstat:
M sick.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
---
(DIR) diff --git a/sick.c b/sick.c
t@@ -37,7 +37,8 @@ char *argv0;
static void
usage()
{
- fprintf(stderr, "usage: %s [-g ALIAS] [-f KEY] [-s [FILE..]]\n", argv0);
+ fprintf(stderr, "usage: %s [-sv] [-g ALIAS] [-f KEY] [FILE]\n",
+ argv0);
exit(EXIT_FAILURE);
}
t@@ -273,16 +274,15 @@ main(int argc, char *argv[])
return ERR_NOKEY;
}
- if (!argc) {
- fp = stdin;
- switch (action) {
- case ACT_SIGN:
- ret = sign(fp, key);
- break;
- case ACT_CHCK:
- ret = check(fp, key);
- break;
- }
+ fp = argc ? fopen(*argv, "r") : stdin;
+
+ switch (action) {
+ case ACT_SIGN:
+ ret |= sign(fp, key);
+ break;
+ case ACT_CHCK:
+ ret |= check(fp, key);
+ break;
}
if (fp)