Lines Matching refs:G
128 #define G (*(struct globals*)bb_common_bufsiz1) macro
131 IF_FEATURE_XARGS_SUPPORT_REPL_STR(G.repl_str = "{}";) \
132 IF_FEATURE_XARGS_SUPPORT_REPL_STR(G.eol_ch = '\n';) \
134 G.eof_str = NULL; \
135 G.idx = 0; \
136 IF_FEATURE_XARGS_SUPPORT_PARALLEL(G.running_procs = 0;) \
137 IF_FEATURE_XARGS_SUPPORT_PARALLEL(G.max_procs = 1;) \
138 G.xargs_exitcode = 0; \
139 IF_FEATURE_XARGS_SUPPORT_QUOTES(G.process_stdin__state = NORM;) \
140 IF_FEATURE_XARGS_SUPPORT_QUOTES(G.process_stdin__q = '\0';) \
155 status = spawn_and_wait(G.args); in xargs_exec()
157 if (G.max_procs == 1) { in xargs_exec()
158 status = spawn_and_wait(G.args); in xargs_exec()
163 if (G.running_procs >= G.max_procs) in xargs_exec()
172 if (G.running_procs != 0) in xargs_exec()
173 G.running_procs--; in xargs_exec()
179 G.xargs_exitcode = 123; in xargs_exec()
185 } else if (G.max_procs != 0) { in xargs_exec()
189 status = spawn(G.args); in xargs_exec()
192 G.running_procs++; in xargs_exec()
216 bb_simple_perror_msg(G.args[0]); in xargs_exec()
221 G.args[0], status - 0x180); in xargs_exec()
226 bb_error_msg("%s: exited with status 255; aborting", G.args[0]); in xargs_exec()
234 G.xargs_exitcode = 123; in xargs_exec()
239 G.xargs_exitcode = status; in xargs_exec()
251 if (!(G.idx & 0xff)) { /* G.idx == N*256? */ in store_param()
253 G.args = xrealloc(G.args, sizeof(G.args[0]) * (G.idx + 0x100)); in store_param()
255 G.args[G.idx++] = s; in store_param()
273 #define q G.process_stdin__q in process_stdin()
274 #define state G.process_stdin__state in process_stdin()
326 if (G.eof_str) { in process_stdin()
327 if (strcmp(s, G.eof_str) == 0) { in process_stdin()
377 if (G.eof_str) { in process_stdin()
378 if (strcmp(s, G.eof_str) == 0) { in process_stdin()
462 for (i = 0; G.args && G.args[i]; i++) in process_stdin_with_replace()
463 if (G.args[i] != G.argv[i]) in process_stdin_with_replace()
464 free(G.args[i]); in process_stdin_with_replace()
474 if (c == G.eol_ch) in process_stdin_with_replace()
482 if (c == EOF || c == G.eol_ch) { in process_stdin_with_replace()
488 while (G.argv[i]) { in process_stdin_with_replace()
489 char *arg = G.argv[i]; in process_stdin_with_replace()
490 int count = count_strstr(arg, G.repl_str); in process_stdin_with_replace()
492 arg = xmalloc_substitute_string(arg, count, G.repl_str, buf); in process_stdin_with_replace()
623 &max_args, &max_chars, &G.eof_str, &G.eof_str in xargs_main()
624 IF_FEATURE_XARGS_SUPPORT_REPL_STR(, &G.repl_str, &G.repl_str) in xargs_main()
625 IF_FEATURE_XARGS_SUPPORT_PARALLEL(, &G.max_procs) in xargs_main()
630 if (G.max_procs <= 0) /* -P0 means "run lots of them" */ in xargs_main()
631 G.max_procs = 100; /* let's not go crazy high */ in xargs_main()
642 if ((opt & OPT_EOF_STRING1) && G.eof_str[0] == '\0') in xargs_main()
643 G.eof_str = NULL; in xargs_main()
647 IF_FEATURE_XARGS_SUPPORT_REPL_STR(G.eol_ch = '\0';) in xargs_main()
708 G.args = NULL; in xargs_main()
709 G.argv = argv; in xargs_main()
729 initial_idx = G.idx; in xargs_main()
733 G.idx = initial_idx; in xargs_main()
737 if (!G.args[initial_idx]) { /* not even one ARG was added? */ in xargs_main()
747 char **args = G.args; in xargs_main()
765 free(G.args); in xargs_main()
770 G.max_procs = 0; in xargs_main()
774 return G.xargs_exitcode; in xargs_main()