diff --git a/.check_md5.php.swp b/.check_md5.php.swp deleted file mode 100644 index 0aa91c1..0000000 Binary files a/.check_md5.php.swp and /dev/null differ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..69832a3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.check_md5.php.swp diff --git a/check_md5.php b/check_md5.php index 2ff9164..a742656 100755 --- a/check_md5.php +++ b/check_md5.php @@ -84,8 +84,9 @@ Options: EOD; // Print the help print_version(); - echo "$AUTHOR\n"; - echo "\n$HELP_TEXT\n"; + fwrite(STDOUT, "\n"); + fwrite(STDOUT, "$AUTHOR\n"); + fwrite(STDOUT, "\n$HELP_TEXT\n"); } @@ -98,8 +99,10 @@ $longoptions = array("warning", "file=", "md5="); $args = $options->readPHPArgv(); $ret = $options->getopt($args, $shortoptions, $longoptions); -if (PEAR::isError($ret)) { - fwrite(STDERR,$ret->getMessage() . "\n"); +if (PEAR::isError($ret)) +{ + fwrite(STDERR,$ret->getMessage() . "\n\n"); + print_help(); exit ($STATE_UNKNOWN); } @@ -144,6 +147,12 @@ if (empty($filename)) exit($STATE_UNKNOWN); } +if (file_exists($filename) == FALSE) +{ + fwrite(STDERR, "File $filename does not exsist!\n"); + exit($STATE_UNKNOWN); +} + if (empty($md5)) { fwrite(STDERR,"You need to enter an MD5 checksum\n");