diff options
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/dd.c | 20 | ||||
-rw-r--r-- | coreutils/expr.c | 2 | ||||
-rw-r--r-- | coreutils/factor.c | 4 | ||||
-rw-r--r-- | coreutils/ls.c | 2 | ||||
-rw-r--r-- | coreutils/od_bloaty.c | 7 | ||||
-rw-r--r-- | coreutils/stat.c | 1 | ||||
-rw-r--r-- | coreutils/sum.c | 4 | ||||
-rw-r--r-- | coreutils/test.c | 15 | ||||
-rw-r--r-- | coreutils/yes.c | 4 |
9 files changed, 48 insertions, 11 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c index 630852205..b37615313 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c | |||
@@ -293,6 +293,7 @@ int dd_main(int argc UNUSED_PARAM, char **argv) | |||
293 | #endif | 293 | #endif |
294 | }; | 294 | }; |
295 | smallint exitcode = EXIT_FAILURE; | 295 | smallint exitcode = EXIT_FAILURE; |
296 | int devzero = 0; | ||
296 | int i; | 297 | int i; |
297 | size_t ibs = 512; | 298 | size_t ibs = 512; |
298 | char *ibuf; | 299 | char *ibuf; |
@@ -419,7 +420,12 @@ int dd_main(int argc UNUSED_PARAM, char **argv) | |||
419 | #endif | 420 | #endif |
420 | 421 | ||
421 | if (infile) { | 422 | if (infile) { |
422 | xmove_fd(xopen(infile, O_RDONLY), ifd); | 423 | if (ENABLE_PLATFORM_MINGW32 && !strcmp(infile, "/dev/zero")) { |
424 | G.flags |= FLAG_NOERROR; | ||
425 | devzero = 1; | ||
426 | } else { | ||
427 | xmove_fd(xopen(infile, O_RDONLY), ifd); | ||
428 | } | ||
423 | } else { | 429 | } else { |
424 | infile = bb_msg_standard_input; | 430 | infile = bb_msg_standard_input; |
425 | } | 431 | } |
@@ -446,7 +452,7 @@ int dd_main(int argc UNUSED_PARAM, char **argv) | |||
446 | } else { | 452 | } else { |
447 | outfile = bb_msg_standard_output; | 453 | outfile = bb_msg_standard_output; |
448 | } | 454 | } |
449 | if (skip) { | 455 | if (skip && !devzero) { |
450 | size_t blocksz = (G.flags & FLAG_SKIP_BYTES) ? 1 : ibs; | 456 | size_t blocksz = (G.flags & FLAG_SKIP_BYTES) ? 1 : ibs; |
451 | if (lseek(ifd, skip * blocksz, SEEK_CUR) < 0) { | 457 | if (lseek(ifd, skip * blocksz, SEEK_CUR) < 0) { |
452 | do { | 458 | do { |
@@ -466,7 +472,12 @@ int dd_main(int argc UNUSED_PARAM, char **argv) | |||
466 | while (!(G.flags & FLAG_COUNT) || (G.in_full + G.in_part != count)) { | 472 | while (!(G.flags & FLAG_COUNT) || (G.in_full + G.in_part != count)) { |
467 | ssize_t n; | 473 | ssize_t n; |
468 | 474 | ||
469 | n = safe_read(ifd, ibuf, ibs); | 475 | if (devzero) { |
476 | memset(ibuf, 0, ibs); | ||
477 | n = ibs; | ||
478 | } | ||
479 | else | ||
480 | n = safe_read(ifd, ibuf, ibs); | ||
470 | if (n == 0) | 481 | if (n == 0) |
471 | break; | 482 | break; |
472 | if (n < 0) { | 483 | if (n < 0) { |
@@ -542,7 +553,8 @@ int dd_main(int argc UNUSED_PARAM, char **argv) | |||
542 | if (write_and_stats(obuf, oc, obs, outfile)) | 553 | if (write_and_stats(obuf, oc, obs, outfile)) |
543 | goto out_status; | 554 | goto out_status; |
544 | } | 555 | } |
545 | if (close(ifd) < 0) { | 556 | |
557 | if (!devzero && close(ifd) < 0) { | ||
546 | die_infile: | 558 | die_infile: |
547 | bb_simple_perror_msg_and_die(infile); | 559 | bb_simple_perror_msg_and_die(infile); |
548 | } | 560 | } |
diff --git a/coreutils/expr.c b/coreutils/expr.c index 5d2fbf2f7..639d29a55 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c | |||
@@ -84,7 +84,7 @@ | |||
84 | #if ENABLE_EXPR_MATH_SUPPORT_64 | 84 | #if ENABLE_EXPR_MATH_SUPPORT_64 |
85 | typedef int64_t arith_t; | 85 | typedef int64_t arith_t; |
86 | 86 | ||
87 | #define PF_REZ "ll" | 87 | #define PF_REZ LL_FMT |
88 | #define PF_REZ_TYPE (long long) | 88 | #define PF_REZ_TYPE (long long) |
89 | #define STRTOL(s, e, b) strtoll(s, e, b) | 89 | #define STRTOL(s, e, b) strtoll(s, e, b) |
90 | #else | 90 | #else |
diff --git a/coreutils/factor.c b/coreutils/factor.c index 205cdc053..8782d3d1e 100644 --- a/coreutils/factor.c +++ b/coreutils/factor.c | |||
@@ -161,7 +161,7 @@ static NOINLINE void factorize(wide_t N) | |||
161 | } | 161 | } |
162 | end: | 162 | end: |
163 | if (N > 1) | 163 | if (N > 1) |
164 | printf(" %llu", N); | 164 | printf(" %"LL_FMT"u", N); |
165 | bb_putchar('\n'); | 165 | bb_putchar('\n'); |
166 | } | 166 | } |
167 | 167 | ||
@@ -175,7 +175,7 @@ static void factorize_numstr(const char *numstr) | |||
175 | N = bb_strtoull(numstr, NULL, 10); | 175 | N = bb_strtoull(numstr, NULL, 10); |
176 | if (errno) | 176 | if (errno) |
177 | bb_show_usage(); | 177 | bb_show_usage(); |
178 | printf("%llu:", N); | 178 | printf("%"LL_FMT"u:", N); |
179 | factorize(N); | 179 | factorize(N); |
180 | } | 180 | } |
181 | 181 | ||
diff --git a/coreutils/ls.c b/coreutils/ls.c index 6780057da..61b4409a7 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -496,7 +496,7 @@ static NOINLINE unsigned display_single(const struct dnode *dn) | |||
496 | lpath = xmalloc_readlink_or_warn(dn->fullname); | 496 | lpath = xmalloc_readlink_or_warn(dn->fullname); |
497 | 497 | ||
498 | if (opt & OPT_i) /* show inode# */ | 498 | if (opt & OPT_i) /* show inode# */ |
499 | column += printf("%7llu ", (long long) dn->dn_ino); | 499 | column += printf("%7"LL_FMT"u ", (long long) dn->dn_ino); |
500 | //TODO: -h should affect -s too: | 500 | //TODO: -h should affect -s too: |
501 | if (opt & OPT_s) /* show allocated blocks */ | 501 | if (opt & OPT_s) /* show allocated blocks */ |
502 | column += printf("%6"OFF_FMT"u ", (off_t) (dn->dn_blocks >> 1)); | 502 | column += printf("%6"OFF_FMT"u ", (off_t) (dn->dn_blocks >> 1)); |
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index f13bdfc11..b02fb09bd 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c | |||
@@ -101,6 +101,13 @@ typedef long long llong; | |||
101 | # define LDBL_DIG DBL_DIG | 101 | # define LDBL_DIG DBL_DIG |
102 | #endif | 102 | #endif |
103 | 103 | ||
104 | #if ENABLE_PLATFORM_MINGW32 | ||
105 | /* symbol conflict */ | ||
106 | #define CHAR SIZE_CHAR | ||
107 | #define SHORT SIZE_SHORT | ||
108 | #define LONG SIZE_LONG | ||
109 | #define INT SIZE_INT | ||
110 | #endif | ||
104 | enum size_spec { | 111 | enum size_spec { |
105 | NO_SIZE, | 112 | NO_SIZE, |
106 | CHAR, | 113 | CHAR, |
diff --git a/coreutils/stat.c b/coreutils/stat.c index b918ec62e..109b5258c 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c | |||
@@ -31,7 +31,6 @@ | |||
31 | //config: bool "Enable display of filesystem status (-f)" | 31 | //config: bool "Enable display of filesystem status (-f)" |
32 | //config: default y | 32 | //config: default y |
33 | //config: depends on STAT | 33 | //config: depends on STAT |
34 | //config: select PLATFORM_LINUX # statfs() | ||
35 | //config: help | 34 | //config: help |
36 | //config: Without this, stat will not support the '-f' option to display | 35 | //config: Without this, stat will not support the '-f' option to display |
37 | //config: information about filesystem status. | 36 | //config: information about filesystem status. |
diff --git a/coreutils/sum.c b/coreutils/sum.c index c55293dc9..2a91f963c 100644 --- a/coreutils/sum.c +++ b/coreutils/sum.c | |||
@@ -82,9 +82,9 @@ static unsigned sum_file(const char *file, unsigned type) | |||
82 | if (type >= SUM_SYSV) { | 82 | if (type >= SUM_SYSV) { |
83 | r = (s & 0xffff) + ((s & 0xffffffff) >> 16); | 83 | r = (s & 0xffff) + ((s & 0xffffffff) >> 16); |
84 | s = (r & 0xffff) + (r >> 16); | 84 | s = (r & 0xffff) + (r >> 16); |
85 | printf("%u %llu %s\n", s, (total_bytes + 511) / 512, file); | 85 | printf("%u %"LL_FMT"u %s\n", s, (total_bytes + 511) / 512, file); |
86 | } else | 86 | } else |
87 | printf("%05u %5llu %s\n", s, (total_bytes + 1023) / 1024, file); | 87 | printf("%05u %5"OFF_FMT"u %s\n", s, (total_bytes + 1023) / 1024, file); |
88 | return 1; | 88 | return 1; |
89 | #undef buf | 89 | #undef buf |
90 | } | 90 | } |
diff --git a/coreutils/test.c b/coreutils/test.c index edcf2a2d8..d4f93312a 100644 --- a/coreutils/test.c +++ b/coreutils/test.c | |||
@@ -637,6 +637,21 @@ static int filstat(char *nm, enum token mode) | |||
637 | return 0; | 637 | return 0; |
638 | } | 638 | } |
639 | 639 | ||
640 | #if ENABLE_PLATFORM_MINGW32 | ||
641 | if (mode == FILEX) { | ||
642 | char *p; | ||
643 | |||
644 | if (file_is_executable(nm)) { | ||
645 | return 1; | ||
646 | } | ||
647 | else if ((p=file_is_win32_executable(nm))) { | ||
648 | free(p); | ||
649 | return 1; | ||
650 | } | ||
651 | return 0; | ||
652 | } | ||
653 | #endif | ||
654 | |||
640 | if (stat(nm, &s) != 0) | 655 | if (stat(nm, &s) != 0) |
641 | return 0; | 656 | return 0; |
642 | if (mode == FILEXIST) | 657 | if (mode == FILEXIST) |
diff --git a/coreutils/yes.c b/coreutils/yes.c index 81d875589..ce6a90fc0 100644 --- a/coreutils/yes.c +++ b/coreutils/yes.c | |||
@@ -40,6 +40,10 @@ int yes_main(int argc UNUSED_PARAM, char **argv) | |||
40 | ++argv; | 40 | ++argv; |
41 | 41 | ||
42 | do { | 42 | do { |
43 | #if ENABLE_PLATFORM_MINGW32 | ||
44 | if (ferror(stdout) != 0) | ||
45 | break; | ||
46 | #endif | ||
43 | pp = argv; | 47 | pp = argv; |
44 | while (1) { | 48 | while (1) { |
45 | fputs(*pp, stdout); | 49 | fputs(*pp, stdout); |