X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=coreutils%2Fdd.c;h=297d0ab51a056245ab91627c51d96a9a13af8d57;hb=6aabfd5e30087bb0ffdb6404aa6d650014de2dc0;hp=dac9ccdf3907fd06fc1d00902ea4922bdaeb2423;hpb=ed3ef50c233ffb1b50ea0e7382a8e60b86491009;p=oweals%2Fbusybox.git diff --git a/coreutils/dd.c b/coreutils/dd.c index dac9ccdf3..297d0ab51 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c @@ -21,16 +21,16 @@ * */ -#include "busybox.h" - #include #include #include #include #include #include +#include "busybox.h" + -static struct suffix_mult dd_suffixes[] = { +static const struct suffix_mult dd_suffixes[] = { { "c", 1 }, { "w", 2 }, { "b", 512 }, @@ -45,7 +45,7 @@ static struct suffix_mult dd_suffixes[] = { int dd_main(int argc, char **argv) { - int i, ifd, ofd, oflag, sync = FALSE, trunc = TRUE; + int i, ifd, ofd, oflag, sync_flag = FALSE, trunc = TRUE; size_t in_full = 0, in_part = 0, out_full = 0, out_part = 0; size_t bs = 512, count = -1; ssize_t n; @@ -73,10 +73,10 @@ int dd_main(int argc, char **argv) trunc = FALSE; buf += 7; } else if (strncmp("sync", buf, 4) == 0) { - sync = TRUE; + sync_flag = TRUE; buf += 4; } else { - error_msg_and_die("invalid conversion `%s'\n", argv[i]+5); + error_msg_and_die("invalid conversion `%s'", argv[i]+5); } if (buf[0] == '\0') break; @@ -84,7 +84,7 @@ int dd_main(int argc, char **argv) buf++; } } else - usage(dd_usage); + show_usage(); } buf = xmalloc(bs); @@ -138,7 +138,7 @@ int dd_main(int argc, char **argv) in_full++; else in_part++; - if (sync) { + if (sync_flag) { memset(buf + n, '\0', bs - n); n = bs; } @@ -151,8 +151,8 @@ int dd_main(int argc, char **argv) out_part++; } - fprintf(statusfp, "%d+%d records in\n", in_full, in_part); - fprintf(statusfp, "%d+%d records out\n", out_full, out_part); + fprintf(statusfp, "%ld+%ld records in\n", (long)in_full, (long)in_part); + fprintf(statusfp, "%ld+%ld records out\n", (long)out_full, (long)out_part); return EXIT_SUCCESS; }