Lines Matching +full:- +full:- +full:no +full:- +full:tty
1 /* xargs.c - Run command with arguments taken from stdin.
8 * TODO: -I Insert mode
9 * TODO: -L Max number of lines of input per command
10 * TODO: -x Exit if can't fit everything in one command
12 USE_XARGS(NEWTOY(xargs, "^E:P#<0(null)=1optr(no-run-if-empty)n#<1(max-args)s#0[!0E]", TOYFLAG_USR|T…
18 usage: xargs [-0prt] [-snE STR] COMMAND...
24 -0 Each argument is NULL terminated, no whitespace or quote processing
25 -E Stop at line matching string
26 -n Max number of arguments per command
27 -o Open tty for COMMAND's stdin (default /dev/null)
28 -p Prompt for y/n from tty before running each command
29 -P Parallel processes (default 1)
30 -r Don't run with empty input (otherwise always run command once)
31 -s Size in bytes per command line
32 -t Trace, print command line to stderr
44 FILE *tty;
53 // Returning 2 means hit -E STR
67 // Specifying -s can cause "argument too long" errors.
81 // -0 support
94 // Handle SIGUSR1 and SIGUSR2 for -P
97 if (sig == SIGUSR2 && TT.P>1) TT.P--; in signal_P()
112 // with -s. POSIX also says we have to reserve 2048 bytes "to guarantee in xargs_main()
116 if (!FLAG(s)) TT.s = sysconf(_SC_ARG_MAX) - environ_bytes() - 4096; in xargs_main()
120 // If no optargs, call echo. in xargs_main()
128 for (entries = 0, bytes = -1; entries < toys.optc; entries++) in xargs_main()
170 if (dlist) dlist->prev->next = 0; in xargs_main()
171 for (dtemp = dlist; dtemp; dtemp = dtemp->next) in xargs_main()
172 handle_entries(dtemp->data, out+entries); in xargs_main()
180 if (!TT.tty) TT.tty = xfopen("/dev/tty", "re"); in xargs_main()
181 if (!fyesno(TT.tty, 0)) goto reap_children; in xargs_main()
187 xopen_stdio(FLAG(o) ? "/dev/tty" : "/dev/null", O_RDONLY|O_CLOEXEC); in xargs_main()
196 if (1>(xv = waitpid(-1, &status, WNOHANG*!xv))) break; in xargs_main()
197 TT.np--; in xargs_main()
214 while (TT.np && -1 != wait(&status)) TT.np--; in xargs_main()
215 if (TT.tty) fclose(TT.tty); in xargs_main()