sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit 44a6d65832fcd7a6d21cb539bb2ceabbb467f6fd
parent 75611997f9c66d67faf6f909e37262c7cfb1e4c0
Author: Mattias Andrée <maandree@kth.se>
Date:   Wed Mar 23 19:12:28 +0100

*sum: support - when using -c

Signed-off-by: Mattias Andrée <maandree@kth.se>

Diffstat:
libutil/crypt.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/libutil/crypt.c b/libutil/crypt.c @@ -89,13 +89,16 @@ cryptcheck(int argc, char *argv[], struct crypt_ops *ops, uint8_t *md, size_t sz mdchecklist(stdin, ops, md, sz, &formatsucks, &noread, &nonmatch); } else { for (; *argv; argc--, argv++) { - if (!(fp = fopen(*argv, "r"))) { + if ((*argv)[0] == '-' && !(*argv)[1]) { + fp = stdin; + } else if (!(fp = fopen(*argv, "r"))) { weprintf("fopen %s:", *argv); ret = 1; continue; } mdchecklist(fp, ops, md, sz, &formatsucks, &noread, &nonmatch); - fclose(fp); + if (fp != stdin) + fclose(fp); } }