diff options
author | obrien <obrien@FreeBSD.org> | 1999-12-04 01:29:43 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 1999-12-04 01:29:43 +0000 |
commit | b6b57faeef807ca8b13a23e047d8479ab962044b (patch) | |
tree | 6eee565e226210d35d2874a1b94cdb99067b8e52 /sbin/md5/md5.c | |
parent | 27b8e11386a5c439de38b788b854c370bb42b9f2 (diff) | |
download | FreeBSD-src-b6b57faeef807ca8b13a23e047d8479ab962044b.zip FreeBSD-src-b6b57faeef807ca8b13a23e047d8479ab962044b.tar.gz |
Add -q quite mode.
Diffstat (limited to 'sbin/md5/md5.c')
-rw-r--r-- | sbin/md5/md5.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c index c20d659..9a764b1 100644 --- a/sbin/md5/md5.c +++ b/sbin/md5/md5.c @@ -38,6 +38,7 @@ static const char rcsid[] = #define TEST_BLOCK_LEN 10000 #define TEST_BLOCK_COUNT 100000 +int qflag; int rflag; static void MDString PROTO_LIST((char *)); @@ -65,11 +66,14 @@ main(argc, argv) char buf[33]; if (argc > 1) { - while ((ch = getopt(argc, argv, "ps:rtx")) != -1) { + while ((ch = getopt(argc, argv, "ps:qrtx")) != -1) { switch (ch) { case 'p': MDFilter(1); break; + case 'q': + qflag = 1; + break; case 'r': rflag = 1; break; @@ -91,7 +95,9 @@ main(argc, argv) if (!p) warn("%s", argv[optind]); else - if (rflag) + if (qflag) + printf("%s\n", p); + else if (rflag) printf("%s %s\n", p, argv[optind]); else printf("MD5 (%s) = %s\n", argv[optind], @@ -113,7 +119,9 @@ MDString(string) size_t len = strlen(string); char buf[33]; - if (rflag) + if (qflag) + printf("%s\n", MD5Data(string, len, buf)); + else if (rflag) printf("%s \"%s\"\n", MD5Data(string, len, buf), string); else printf("MD5 (\"%s\") = %s\n", string, MD5Data(string, len, buf)); |