Commit Graph

8 Commits

Author SHA1 Message Date
Michael Forney 9a3b12525b Don't use buffered IO (fread) when not appropriate
fread reads the entire requested size (BUFSIZ), which causes tools to
block if only small amounts of data are available at a time. At best,
this causes unnecessary copies and inefficiency, at worst, tools like
tee and cat are almost unusable in some cases since they only display
large chunks of data at a time.
2017-07-03 21:04:14 +02:00
FRIGN 9b06720f62 Refactor cryptcheck() to allow multiple list-files and stdin
Previously, it was not possible to use

sha1sum test.c | sha1sum -c

because the program would not differenciate between an empty
argument and a non-specified argument.
Moreover, why not allow this?

sha1sum -c hashlist1 hashlist2

Digging deeper I found that using function pointers and a
modification in the crypt-backend might simplify the program
a lot by passing the argument-list to both cryptmain and
cryptcheck.
Allowing more than one list-file to be specified is also
consistent with what the other implementations support,
so we not only have simpler code, we also do not silently
break if there's a script around passing multiple files to
check.
2015-03-01 22:51:52 +01:00
Hiltjo Posthuma 04f32f4d9a checksum tools: implement -c
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-03-23 18:02:39 +00:00
sin f1f0fba630 Forgot to remove argc from function decl
Thanks FRIGN for noticing this.
2013-11-30 21:12:40 +00:00
sin abd5a0e573 We do not name parameters in declarations 2013-11-30 20:58:49 +00:00
sin 5b5f062184 Add license file details at top of files 2013-10-07 17:03:34 +01:00
sin 573d1954b2 Add cryptmain() and factor out the code from the crypt tools 2013-10-05 13:51:45 +01:00
sin 9ac01f59be Add crypt.[ch] and update md5sum and sha1sum
Factor out the code from md5sum and sha1sum into a util function.

Use FILE * instead of a file descriptor.  This will make it a bit
easier/more consistent when we implement support for the -c option.
2013-07-18 09:51:17 -04:00