- while (!eof_stdin_detected) {
- c = getchar();
- if (c == EOF) {
- eof_stdin_detected = 1;
- if (s == NULL)
- break;
- c = '\0';
- }
- if (s == NULL)
- s = p = buf;
- if ((size_t)(p - buf) >= mc)
- bb_error_msg_and_die("argument line too long");
- *p++ = c;
- if (c == '\0') { /* word's delimiter or EOF detected */
- /* word loaded */
- size_t length = (p - buf);
- /* Dont xzalloc - it can be quite big */
- cur = xmalloc(offsetof(xlist_t, xstr) + length);
- cur->link = NULL;
- cur->length = length;
- memcpy(cur->xstr, s, length);
- if (prev == NULL) {
- list_arg = cur;
- } else {
- prev->link = cur;
- }
- prev = cur;
- line_l += length;
- if (line_l > mc) {
- /* stop memory usage :-) */
- break;
- }
- s = NULL;
- }
- }
- return list_arg;
-}
-#endif /* FEATURE_XARGS_SUPPORT_ZERO_TERM */
+//usage:#define xargs_trivial_usage
+//usage: "[OPTIONS] [PROG ARGS]"
+//usage:#define xargs_full_usage "\n\n"
+//usage: "Run PROG on every item given by stdin\n"
+//usage: IF_FEATURE_XARGS_SUPPORT_CONFIRMATION(
+//usage: "\n -p Ask user whether to run each command"
+//usage: )
+//usage: "\n -r Don't run command if input is empty"
+//usage: IF_FEATURE_XARGS_SUPPORT_ZERO_TERM(
+//usage: "\n -0 Input is separated by NUL characters"
+//usage: )
+//usage: "\n -t Print the command on stderr before execution"
+//usage: "\n -e[STR] STR stops input processing"
+//usage: "\n -n N Pass no more than N args to PROG"
+//usage: "\n -s N Pass command line of no more than N bytes"
+//usage: IF_FEATURE_XARGS_SUPPORT_TERMOPT(
+//usage: "\n -x Exit if size is exceeded"
+//usage: )
+//usage:#define xargs_example_usage
+//usage: "$ ls | xargs gzip\n"
+//usage: "$ find . -name '*.c' -print | xargs rm\n"