diff options
author | Mattias Andrée <maandree@operamail.com> | 2013-06-17 14:42:00 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2013-06-17 14:42:00 +0200 |
commit | ee09d35e3cc6be60f4fa424191ef6ef79d566ce3 (patch) | |
tree | 1de721adffeafcafd4ff1f7e0958c40cc56ae456 | |
parent | fix for exception catching with stdin as filename by None (diff) | |
download | sha3sum-ee09d35e3cc6be60f4fa424191ef6ef79d566ce3.tar.gz sha3sum-ee09d35e3cc6be60f4fa424191ef6ef79d566ce3.tar.bz2 sha3sum-ee09d35e3cc6be60f4fa424191ef6ef79d566ce3.tar.xz |
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | c/sha3sum.c | 6 | ||||
-rw-r--r-- | pure-java/sha3sum.java | 8 | ||||
-rwxr-xr-x | python3/sha3sum.py | 5 |
3 files changed, 4 insertions, 15 deletions
diff --git a/c/sha3sum.c b/c/sha3sum.c index a03f0c2..4c93833 100644 --- a/c/sha3sum.c +++ b/c/sha3sum.c @@ -567,11 +567,7 @@ int main(int argc, char** argv) char* chunk; char* bs; - if (((filename = *(files + f)) == null) && stdin) - { - printf("%s", stdin); - continue; - } + filename = *(files + f) fn = filename ? filename : "/dev/stdin"; file = fopen(fn, "r"); if (file == null) diff --git a/pure-java/sha3sum.java b/pure-java/sha3sum.java index 22427a5..000a57f 100644 --- a/pure-java/sha3sum.java +++ b/pure-java/sha3sum.java @@ -333,12 +333,8 @@ public class sha3sum String filename; for (int f = 0; f < fptr; f++) - { if (((filename = files[f]) == null) && (stdin != null)) - { System.out.write(stdin); - continue; - } - String rc = ""; - String fn = filename == null ? "/dev/stdin" : filename; + { String rc = ""; + String fn = (filename = files[f]) == null ? "/dev/stdin" : filename; InputStream file = null; try { diff --git a/python3/sha3sum.py b/python3/sha3sum.py index 4063443..eba5ecd 100755 --- a/python3/sha3sum.py +++ b/python3/sha3sum.py @@ -883,13 +883,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. printerr(cmd + ': sorry, I will only do at least one squeeze iteration!\n') sys.exit(3) stdin = None + fail = False for filename in files: - if (filename is None) and (stdin is not None): - print(stdin) - continue rc = '' fn = '/dev/stdin' if filename is None else filename - fail = False with open(fn, 'rb') as file: try: if (filename is not None) or (stdin is None): |