diff options
author | Manuel Novoa III <mjn3@codepoet.org> | 2003-03-19 09:13:01 +0000 |
---|---|---|
committer | Manuel Novoa III <mjn3@codepoet.org> | 2003-03-19 09:13:01 +0000 |
commit | cad5364599eb5062d59e0c397ed638ddd61a8d5d (patch) | |
tree | a318d0f03aa076c74b576ea45dc543a5669e8e91 /coreutils/md5sum.c | |
parent | e01f9662a5bd5d91be4f6b3941b57fff73cd5af1 (diff) | |
download | busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.gz busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.bz2 busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.zip |
Major coreutils update.
Diffstat (limited to 'coreutils/md5sum.c')
-rw-r--r-- | coreutils/md5sum.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/coreutils/md5sum.c b/coreutils/md5sum.c index f5be4486c..c1480cd32 100644 --- a/coreutils/md5sum.c +++ b/coreutils/md5sum.c | |||
@@ -770,13 +770,13 @@ static int md5_file(const char *filename, | |||
770 | have_read_stdin = 1; | 770 | have_read_stdin = 1; |
771 | fp = stdin; | 771 | fp = stdin; |
772 | } else { | 772 | } else { |
773 | fp = wfopen(filename, "r"); | 773 | fp = bb_wfopen(filename, "r"); |
774 | if (fp == NULL) | 774 | if (fp == NULL) |
775 | return FALSE; | 775 | return FALSE; |
776 | } | 776 | } |
777 | 777 | ||
778 | if (md5_stream(fp, md5_result)) { | 778 | if (md5_stream(fp, md5_result)) { |
779 | perror_msg("%s", filename); | 779 | bb_perror_msg("%s", filename); |
780 | 780 | ||
781 | if (fp != stdin) | 781 | if (fp != stdin) |
782 | fclose(fp); | 782 | fclose(fp); |
@@ -784,7 +784,7 @@ static int md5_file(const char *filename, | |||
784 | } | 784 | } |
785 | 785 | ||
786 | if (fp != stdin && fclose(fp) == EOF) { | 786 | if (fp != stdin && fclose(fp) == EOF) { |
787 | perror_msg("%s", filename); | 787 | bb_perror_msg("%s", filename); |
788 | return FALSE; | 788 | return FALSE; |
789 | } | 789 | } |
790 | 790 | ||
@@ -805,7 +805,7 @@ static int md5_check(const char *checkfile_name) | |||
805 | have_read_stdin = 1; | 805 | have_read_stdin = 1; |
806 | checkfile_stream = stdin; | 806 | checkfile_stream = stdin; |
807 | } else { | 807 | } else { |
808 | checkfile_stream = wfopen(checkfile_name, "r"); | 808 | checkfile_stream = bb_wfopen(checkfile_name, "r"); |
809 | if (checkfile_stream == NULL) | 809 | if (checkfile_stream == NULL) |
810 | return FALSE; | 810 | return FALSE; |
811 | } | 811 | } |
@@ -836,7 +836,7 @@ static int md5_check(const char *checkfile_name) | |||
836 | if (split_3(line, line_length, &md5num, &filename) | 836 | if (split_3(line, line_length, &md5num, &filename) |
837 | || !hex_digits(md5num)) { | 837 | || !hex_digits(md5num)) { |
838 | if (warn) { | 838 | if (warn) { |
839 | error_msg("%s: %lu: improperly formatted MD5 checksum line", | 839 | bb_error_msg("%s: %lu: improperly formatted MD5 checksum line", |
840 | checkfile_name, (unsigned long) line_number); | 840 | checkfile_name, (unsigned long) line_number); |
841 | } | 841 | } |
842 | } else { | 842 | } else { |
@@ -881,18 +881,18 @@ static int md5_check(const char *checkfile_name) | |||
881 | while (!feof(checkfile_stream) && !ferror(checkfile_stream)); | 881 | while (!feof(checkfile_stream) && !ferror(checkfile_stream)); |
882 | 882 | ||
883 | if (ferror(checkfile_stream)) { | 883 | if (ferror(checkfile_stream)) { |
884 | error_msg("%s: read error", checkfile_name); | 884 | bb_error_msg("%s: read error", checkfile_name); |
885 | return FALSE; | 885 | return FALSE; |
886 | } | 886 | } |
887 | 887 | ||
888 | if (checkfile_stream != stdin && fclose(checkfile_stream) == EOF) { | 888 | if (checkfile_stream != stdin && fclose(checkfile_stream) == EOF) { |
889 | perror_msg("md5sum: %s", checkfile_name); | 889 | bb_perror_msg("md5sum: %s", checkfile_name); |
890 | return FALSE; | 890 | return FALSE; |
891 | } | 891 | } |
892 | 892 | ||
893 | if (n_properly_formated_lines == 0) { | 893 | if (n_properly_formated_lines == 0) { |
894 | /* Warn if no tests are found. */ | 894 | /* Warn if no tests are found. */ |
895 | error_msg("%s: no properly formatted MD5 checksum lines found", | 895 | bb_error_msg("%s: no properly formatted MD5 checksum lines found", |
896 | checkfile_name); | 896 | checkfile_name); |
897 | return FALSE; | 897 | return FALSE; |
898 | } else { | 898 | } else { |
@@ -901,13 +901,13 @@ static int md5_check(const char *checkfile_name) | |||
901 | - n_open_or_read_failures); | 901 | - n_open_or_read_failures); |
902 | 902 | ||
903 | if (n_open_or_read_failures > 0) { | 903 | if (n_open_or_read_failures > 0) { |
904 | error_msg("WARNING: %d of %d listed files could not be read", | 904 | bb_error_msg("WARNING: %d of %d listed files could not be read", |
905 | n_open_or_read_failures, n_properly_formated_lines); | 905 | n_open_or_read_failures, n_properly_formated_lines); |
906 | return FALSE; | 906 | return FALSE; |
907 | } | 907 | } |
908 | 908 | ||
909 | if (n_mismatched_checksums > 0) { | 909 | if (n_mismatched_checksums > 0) { |
910 | error_msg("WARNING: %d of %d computed checksums did NOT match", | 910 | bb_error_msg("WARNING: %d of %d computed checksums did NOT match", |
911 | n_mismatched_checksums, n_computed_checkums); | 911 | n_mismatched_checksums, n_computed_checkums); |
912 | return FALSE; | 912 | return FALSE; |
913 | } | 913 | } |
@@ -965,31 +965,31 @@ int md5sum_main(int argc, | |||
965 | break; | 965 | break; |
966 | 966 | ||
967 | default: | 967 | default: |
968 | show_usage(); | 968 | bb_show_usage(); |
969 | } | 969 | } |
970 | } | 970 | } |
971 | 971 | ||
972 | if (file_type_specified && do_check) { | 972 | if (file_type_specified && do_check) { |
973 | error_msg_and_die("the -b and -t options are meaningless when verifying checksums"); | 973 | bb_error_msg_and_die("the -b and -t options are meaningless when verifying checksums"); |
974 | } | 974 | } |
975 | 975 | ||
976 | if (n_strings > 0 && do_check) { | 976 | if (n_strings > 0 && do_check) { |
977 | error_msg_and_die("the -g and -c options are mutually exclusive"); | 977 | bb_error_msg_and_die("the -g and -c options are mutually exclusive"); |
978 | } | 978 | } |
979 | 979 | ||
980 | if (status_only && !do_check) { | 980 | if (status_only && !do_check) { |
981 | error_msg_and_die("the -s option is meaningful only when verifying checksums"); | 981 | bb_error_msg_and_die("the -s option is meaningful only when verifying checksums"); |
982 | } | 982 | } |
983 | 983 | ||
984 | if (warn && !do_check) { | 984 | if (warn && !do_check) { |
985 | error_msg_and_die("the -w option is meaningful only when verifying checksums"); | 985 | bb_error_msg_and_die("the -w option is meaningful only when verifying checksums"); |
986 | } | 986 | } |
987 | 987 | ||
988 | if (n_strings > 0) { | 988 | if (n_strings > 0) { |
989 | size_t i; | 989 | size_t i; |
990 | 990 | ||
991 | if (optind < argc) { | 991 | if (optind < argc) { |
992 | error_msg_and_die("no files may be specified when using -g"); | 992 | bb_error_msg_and_die("no files may be specified when using -g"); |
993 | } | 993 | } |
994 | for (i = 0; i < n_strings; ++i) { | 994 | for (i = 0; i < n_strings; ++i) { |
995 | size_t cnt; | 995 | size_t cnt; |
@@ -1002,7 +1002,7 @@ int md5sum_main(int argc, | |||
1002 | } | 1002 | } |
1003 | } else if (do_check) { | 1003 | } else if (do_check) { |
1004 | if (optind + 1 < argc) { | 1004 | if (optind + 1 < argc) { |
1005 | error_msg("only one argument may be specified when using -c"); | 1005 | bb_error_msg("only one argument may be specified when using -c"); |
1006 | } | 1006 | } |
1007 | 1007 | ||
1008 | err = md5_check ((optind == argc) ? "-" : argv[optind]); | 1008 | err = md5_check ((optind == argc) ? "-" : argv[optind]); |
@@ -1060,11 +1060,11 @@ int md5sum_main(int argc, | |||
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | if (fclose (stdout) == EOF) { | 1062 | if (fclose (stdout) == EOF) { |
1063 | error_msg_and_die("write error"); | 1063 | bb_error_msg_and_die("write error"); |
1064 | } | 1064 | } |
1065 | 1065 | ||
1066 | if (have_read_stdin && fclose (stdin) == EOF) { | 1066 | if (have_read_stdin && fclose (stdin) == EOF) { |
1067 | error_msg_and_die("standard input"); | 1067 | bb_error_msg_and_die(bb_msg_standard_input); |
1068 | } | 1068 | } |
1069 | 1069 | ||
1070 | if (err == 0) | 1070 | if (err == 0) |