sick

sign and check files using ed25519
Log | Files | Refs | Submodules | README | LICENSE

commit 616c92c3d219c4775880f872ae931c82e5313fa5
parent 414648b3011b742fb82ee6e2f997973d43184345
Author: z3bra <willyatmailoodotorg>
Date:   Mon May 16 12:14:46 +12000

Allow file to be given on the command line

Diffstat:
sick.c | 22+++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/sick.c b/sick.c @@ -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); } @@ -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)