*sum: support - when using -c

Signed-off-by: Mattias Andrée <maandree@kth.se>
This commit is contained in:
Mattias Andrée 2016-03-23 19:12:28 +01:00 committed by sin
parent 75611997f9
commit 44a6d65832
1 changed files with 5 additions and 2 deletions

View File

@ -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);
}
}