summaryrefslogtreecommitdiffstats
path: root/isomd5sum/checkisomd5.c
diff options
context:
space:
mode:
authorMike Fulbright <msf@redhat.com>2003-06-13 16:07:57 +0000
committerMike Fulbright <msf@redhat.com>2003-06-13 16:07:57 +0000
commitb5ae1650387a68a9521935c36d6e5f94dd46c458 (patch)
tree63f6056b2afb2d876c3a41d6d6c2ec84efee213a /isomd5sum/checkisomd5.c
parent6a64bb0898f3bf431b1d0d3b3ad4133b35e931f6 (diff)
downloadanaconda-b5ae1650387a68a9521935c36d6e5f94dd46c458.tar.gz
anaconda-b5ae1650387a68a9521935c36d6e5f94dd46c458.tar.xz
anaconda-b5ae1650387a68a9521935c36d6e5f94dd46c458.zip
pulling in isomd5sum fixes from taroon branch
Diffstat (limited to 'isomd5sum/checkisomd5.c')
-rw-r--r--isomd5sum/checkisomd5.c37
1 files changed, 30 insertions, 7 deletions
diff --git a/isomd5sum/checkisomd5.c b/isomd5sum/checkisomd5.c
index 6ddd37fdf..75ad87279 100644
--- a/isomd5sum/checkisomd5.c
+++ b/isomd5sum/checkisomd5.c
@@ -8,20 +8,43 @@
#include "libcheckisomd5.h"
int main(int argc, char **argv) {
+ int i;
int rc;
+ int verbose;
+ int md5only;
+ int filearg;
if (argc < 2) {
- printf("Usage: checkisomd5 [--md5sumonly] <isofilename>|<blockdevice>\n\n");
+ printf("Usage: checkisomd5 [--md5sumonly] [--verbose] <isofilename>|<blockdevice>\n\n");
exit(1);
}
- /* see if they just want md5sum */
- if (strcmp(argv[1], "--md5sumonly") == 0) {
- printMD5SUM(argv[2]);
- exit(0);
+ md5only = 0;
+ verbose = 0;
+ filearg = 1;
+ for (i=1; i < argc; i++) {
+ if (strcmp(argv[i], "--md5sumonly") == 0) {
+ md5only = 1;
+ filearg++;
+ } else if (strcmp(argv[i], "--verbose") == 0) {
+ filearg++;
+ verbose = 1;
+ } else
+ break;
}
- rc = mediaCheckFile(argv[1], 1);
+ if (md5only|verbose)
+ printMD5SUM(argv[filearg]);
+
+ if (md5only)
+ exit(0);
+
+ rc = mediaCheckFile(argv[filearg], !verbose);
- exit(rc ? 0 : 1);
+ /* 1 means it passed, 0 means it failed, -1 means we couldnt find chksum */
+ if (rc == 1)
+ exit(0);
+ else
+ exit(1);
}
+