diff options
author | Ron Yorston <rmy@pobox.com> | 2023-01-05 08:57:39 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-01-05 08:57:39 +0000 |
commit | 54f3a4c6bd9e4dcba5d7296072d8ba0871cd30e0 (patch) | |
tree | 0e588870b92a37d6c73aa18bbc1cebcd4219fe1d | |
parent | e5e4a2fec5435192d1672e6db2f335cb5e89f877 (diff) | |
download | busybox-w32-54f3a4c6bd9e4dcba5d7296072d8ba0871cd30e0.tar.gz busybox-w32-54f3a4c6bd9e4dcba5d7296072d8ba0871cd30e0.tar.bz2 busybox-w32-54f3a4c6bd9e4dcba5d7296072d8ba0871cd30e0.zip |
xargs: omit support for -o
Upstream added the -o option to reopen stdin as /dev/tty. Since
/dev/tty isn't available in Microsoft Windows -o isn't applicable.
-rw-r--r-- | findutils/xargs.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/findutils/xargs.c b/findutils/xargs.c index dd6aa9592..d6cdec22e 100644 --- a/findutils/xargs.c +++ b/findutils/xargs.c | |||
@@ -114,8 +114,10 @@ struct globals { | |||
114 | #endif | 114 | #endif |
115 | const char *eof_str; | 115 | const char *eof_str; |
116 | int idx; | 116 | int idx; |
117 | #if !ENABLE_PLATFORM_MINGW32 | ||
117 | int fd_tty; | 118 | int fd_tty; |
118 | int fd_stdin; | 119 | int fd_stdin; |
120 | #endif | ||
119 | #if ENABLE_FEATURE_XARGS_SUPPORT_PARALLEL | 121 | #if ENABLE_FEATURE_XARGS_SUPPORT_PARALLEL |
120 | int running_procs; | 122 | int running_procs; |
121 | int max_procs; | 123 | int max_procs; |
@@ -157,7 +159,7 @@ enum { | |||
157 | OPTBIT_UPTO_SIZE, | 159 | OPTBIT_UPTO_SIZE, |
158 | OPTBIT_EOF_STRING, | 160 | OPTBIT_EOF_STRING, |
159 | OPTBIT_EOF_STRING1, | 161 | OPTBIT_EOF_STRING1, |
160 | OPTBIT_STDIN_TTY, | 162 | IF_NOT_PLATFORM_MINGW32( OPTBIT_STDIN_TTY ,) |
161 | IF_FEATURE_XARGS_SUPPORT_CONFIRMATION(OPTBIT_INTERACTIVE,) | 163 | IF_FEATURE_XARGS_SUPPORT_CONFIRMATION(OPTBIT_INTERACTIVE,) |
162 | IF_FEATURE_XARGS_SUPPORT_TERMOPT( OPTBIT_TERMINATE ,) | 164 | IF_FEATURE_XARGS_SUPPORT_TERMOPT( OPTBIT_TERMINATE ,) |
163 | IF_FEATURE_XARGS_SUPPORT_ZERO_TERM( OPTBIT_ZEROTERM ,) | 165 | IF_FEATURE_XARGS_SUPPORT_ZERO_TERM( OPTBIT_ZEROTERM ,) |
@@ -170,14 +172,15 @@ enum { | |||
170 | OPT_UPTO_SIZE = 1 << OPTBIT_UPTO_SIZE , | 172 | OPT_UPTO_SIZE = 1 << OPTBIT_UPTO_SIZE , |
171 | OPT_EOF_STRING = 1 << OPTBIT_EOF_STRING , /* GNU: -e[<param>] */ | 173 | OPT_EOF_STRING = 1 << OPTBIT_EOF_STRING , /* GNU: -e[<param>] */ |
172 | OPT_EOF_STRING1 = 1 << OPTBIT_EOF_STRING1, /* SUS: -E<param> */ | 174 | OPT_EOF_STRING1 = 1 << OPTBIT_EOF_STRING1, /* SUS: -E<param> */ |
173 | OPT_STDIN_TTY = 1 << OPTBIT_STDIN_TTY, | 175 | OPT_STDIN_TTY = IF_NOT_PLATFORM_MINGW32( (1 << OPTBIT_STDIN_TTY )) + 0, |
174 | OPT_INTERACTIVE = IF_FEATURE_XARGS_SUPPORT_CONFIRMATION((1 << OPTBIT_INTERACTIVE)) + 0, | 176 | OPT_INTERACTIVE = IF_FEATURE_XARGS_SUPPORT_CONFIRMATION((1 << OPTBIT_INTERACTIVE)) + 0, |
175 | OPT_TERMINATE = IF_FEATURE_XARGS_SUPPORT_TERMOPT( (1 << OPTBIT_TERMINATE )) + 0, | 177 | OPT_TERMINATE = IF_FEATURE_XARGS_SUPPORT_TERMOPT( (1 << OPTBIT_TERMINATE )) + 0, |
176 | OPT_ZEROTERM = IF_FEATURE_XARGS_SUPPORT_ZERO_TERM( (1 << OPTBIT_ZEROTERM )) + 0, | 178 | OPT_ZEROTERM = IF_FEATURE_XARGS_SUPPORT_ZERO_TERM( (1 << OPTBIT_ZEROTERM )) + 0, |
177 | OPT_REPLSTR = IF_FEATURE_XARGS_SUPPORT_REPL_STR( (1 << OPTBIT_REPLSTR )) + 0, | 179 | OPT_REPLSTR = IF_FEATURE_XARGS_SUPPORT_REPL_STR( (1 << OPTBIT_REPLSTR )) + 0, |
178 | OPT_REPLSTR1 = IF_FEATURE_XARGS_SUPPORT_REPL_STR( (1 << OPTBIT_REPLSTR1 )) + 0, | 180 | OPT_REPLSTR1 = IF_FEATURE_XARGS_SUPPORT_REPL_STR( (1 << OPTBIT_REPLSTR1 )) + 0, |
179 | }; | 181 | }; |
180 | #define OPTION_STR "+trn:s:e::E:o" \ | 182 | #define OPTION_STR "+trn:s:e::E:" \ |
183 | IF_NOT_PLATFORM_MINGW32( "o") \ | ||
181 | IF_FEATURE_XARGS_SUPPORT_CONFIRMATION("p") \ | 184 | IF_FEATURE_XARGS_SUPPORT_CONFIRMATION("p") \ |
182 | IF_FEATURE_XARGS_SUPPORT_TERMOPT( "x") \ | 185 | IF_FEATURE_XARGS_SUPPORT_TERMOPT( "x") \ |
183 | IF_FEATURE_XARGS_SUPPORT_ZERO_TERM( "0") \ | 186 | IF_FEATURE_XARGS_SUPPORT_ZERO_TERM( "0") \ |
@@ -244,8 +247,10 @@ static int xargs_exec(void) | |||
244 | { | 247 | { |
245 | int status; | 248 | int status; |
246 | 249 | ||
250 | #if !ENABLE_PLATFORM_MINGW32 | ||
247 | if (option_mask32 & OPT_STDIN_TTY) | 251 | if (option_mask32 & OPT_STDIN_TTY) |
248 | xdup2(G.fd_tty, STDIN_FILENO); | 252 | xdup2(G.fd_tty, STDIN_FILENO); |
253 | #endif | ||
249 | 254 | ||
250 | #if !ENABLE_FEATURE_XARGS_SUPPORT_PARALLEL | 255 | #if !ENABLE_FEATURE_XARGS_SUPPORT_PARALLEL |
251 | status = spawn_and_wait(G.args); | 256 | status = spawn_and_wait(G.args); |
@@ -351,8 +356,10 @@ static int xargs_exec(void) | |||
351 | ret: | 356 | ret: |
352 | if (status != 0) | 357 | if (status != 0) |
353 | G.xargs_exitcode = status; | 358 | G.xargs_exitcode = status; |
359 | #if !ENABLE_PLATFORM_MINGW32 | ||
354 | if (option_mask32 & OPT_STDIN_TTY) | 360 | if (option_mask32 & OPT_STDIN_TTY) |
355 | xdup2(G.fd_stdin, STDIN_FILENO); | 361 | xdup2(G.fd_stdin, STDIN_FILENO); |
362 | #endif | ||
356 | return status; | 363 | return status; |
357 | } | 364 | } |
358 | 365 | ||
@@ -671,7 +678,9 @@ static int xargs_ask_confirmation(void) | |||
671 | //usage: IF_FEATURE_XARGS_SUPPORT_ARGS_FILE( | 678 | //usage: IF_FEATURE_XARGS_SUPPORT_ARGS_FILE( |
672 | //usage: "\n -a FILE Read from FILE instead of stdin" | 679 | //usage: "\n -a FILE Read from FILE instead of stdin" |
673 | //usage: ) | 680 | //usage: ) |
681 | //usage: IF_NOT_PLATFORM_MINGW32( | ||
674 | //usage: "\n -o Reopen stdin as /dev/tty" | 682 | //usage: "\n -o Reopen stdin as /dev/tty" |
683 | //usage: ) | ||
675 | //usage: "\n -r Don't run command if input is empty" | 684 | //usage: "\n -r Don't run command if input is empty" |
676 | //usage: "\n -t Print the command on stderr before execution" | 685 | //usage: "\n -t Print the command on stderr before execution" |
677 | //usage: IF_FEATURE_XARGS_SUPPORT_CONFIRMATION( | 686 | //usage: IF_FEATURE_XARGS_SUPPORT_CONFIRMATION( |
@@ -827,12 +836,14 @@ int xargs_main(int argc UNUSED_PARAM, char **argv) | |||
827 | store_param(argv[i]); | 836 | store_param(argv[i]); |
828 | } | 837 | } |
829 | 838 | ||
839 | #if !ENABLE_PLATFORM_MINGW32 | ||
830 | if (opt & OPT_STDIN_TTY) { | 840 | if (opt & OPT_STDIN_TTY) { |
831 | G.fd_tty = xopen(CURRENT_TTY, O_RDONLY); | 841 | G.fd_tty = xopen(CURRENT_TTY, O_RDONLY); |
832 | close_on_exec_on(G.fd_tty); | 842 | close_on_exec_on(G.fd_tty); |
833 | G.fd_stdin = dup(STDIN_FILENO); | 843 | G.fd_stdin = dup(STDIN_FILENO); |
834 | close_on_exec_on(G.fd_stdin); | 844 | close_on_exec_on(G.fd_stdin); |
835 | } | 845 | } |
846 | #endif | ||
836 | 847 | ||
837 | initial_idx = G.idx; | 848 | initial_idx = G.idx; |
838 | while (1) { | 849 | while (1) { |