X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;ds=sidebyside;f=md5sum.c;h=84e037a612f7b6cf54d7bead86bc9954f04fc767;hb=87559829ffc79b94adcee00b64706ce78ff2f3fb;hp=a791a41b0a5a90b17fc0e68c2af435fc9942e19d;hpb=616d13bcd1a431eb21d1d3e48b17be6c26443c1d;p=oweals%2Fbusybox.git diff --git a/md5sum.c b/md5sum.c index a791a41b0..84e037a61 100644 --- a/md5sum.c +++ b/md5sum.c @@ -20,7 +20,7 @@ /* Written by Ulrich Drepper */ /* Hacked to work with BusyBox by Alfred M. Szmidt */ -#include "internal.h" +#include "busybox.h" #include #include #include @@ -66,7 +66,7 @@ extern _IO_ssize_t getline __P ((char **, size_t *, FILE *)); #include #include -#include "internal.h" +#include "busybox.h" //---------------------------------------------------------------------------- //--------md5.h //---------------------------------------------------------------------------- @@ -107,48 +107,8 @@ extern _IO_ssize_t getline __P ((char **, size_t *, FILE *)); the resulting executable. Locally running cross-compiled executables is usually not possible. */ -#ifdef _LIBC # include typedef u_int32_t md5_uint32; -#else -# if defined __STDC__ && __STDC__ -# define UINT_MAX_32_BITS 4294967295U -# else -# define UINT_MAX_32_BITS 0xFFFFFFFF -# endif - -/* If UINT_MAX isn't defined, assume it's a 32-bit type. - This should be valid for all systems GNU cares about because - that doesn't include 16-bit systems, and only modern systems - (that certainly have ) have 64+-bit integral types. */ - -# ifndef UINT_MAX -# define UINT_MAX UINT_MAX_32_BITS -# endif - -# if UINT_MAX == UINT_MAX_32_BITS - typedef unsigned int md5_uint32; -# else -# if USHRT_MAX == UINT_MAX_32_BITS - typedef unsigned short md5_uint32; -# else -# if ULONG_MAX == UINT_MAX_32_BITS - typedef unsigned long md5_uint32; -# else - /* The following line is intended to evoke an error. - Using #error is not portable enough. */ - "Cannot determine unsigned 32-bit data type." -# endif -# endif -# endif -#endif - -#undef __P -#if defined (__STDC__) && __STDC__ -#define __P(x) x -#else -#define __P(x) () -#endif /* Structure to save state of computation between the single steps. */ struct md5_ctx @@ -810,7 +770,7 @@ static int md5_check(const char *checkfile_name) free(line); if (ferror(checkfile_stream)) { - errorMsg("%s: read error", checkfile_name); /* */ + errorMsg("%s: read error\n", checkfile_name); /* */ return FALSE; } @@ -902,22 +862,22 @@ int md5sum_main(int argc, if (file_type_specified && do_check) { errorMsg("the -b and -t options are meaningless when verifying checksums\n"); - exit FALSE; + return EXIT_FAILURE; } if (n_strings > 0 && do_check) { errorMsg("the -g and -c options are mutually exclusive\n"); - exit FALSE; + return EXIT_FAILURE; } if (status_only && !do_check) { errorMsg("the -s option is meaningful only when verifying checksums\n"); - exit FALSE; + return EXIT_FAILURE; } if (warn && !do_check) { errorMsg("the -w option is meaningful only when verifying checksums\n"); - exit FALSE; + return EXIT_FAILURE; } if (n_strings > 0) { @@ -925,7 +885,7 @@ int md5sum_main(int argc, if (optind < argc) { errorMsg("no files may be specified when using -g\n"); - exit FALSE; + return EXIT_FAILURE; } for (i = 0; i < n_strings; ++i) { size_t cnt; @@ -991,14 +951,17 @@ int md5sum_main(int argc, } if (fclose (stdout) == EOF) { - errorMsg("write error"); - exit FALSE; + errorMsg("write error\n"); + return EXIT_FAILURE; } if (have_read_stdin && fclose (stdin) == EOF) { - errorMsg("standard input"); - exit FALSE; + errorMsg("standard input\n"); + return EXIT_FAILURE; } - exit (err == 0 ? TRUE : FALSE); + if (err == 0) + return EXIT_SUCCESS; + else + return EXIT_FAILURE; }