-# define READ_ARGS(l, e, nmc, mc) (*read_args)(l, e, nmc, mc)
-# define OPT_INC_0 1 /* future use */
-#else
-# define OPT_INC_0 0 /* future use */
-# define READ_ARGS(l, e, nmc, mc) process_stdin(l, e, nmc, mc)
-#endif /* CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM */
-
-
-#define OPT_VERBOSE (1<<0)
-#define OPT_NO_EMPTY (1<<1)
-#define OPT_UPTO_NUMBER (1<<2)
-#define OPT_UPTO_SIZE (1<<3)
-#define OPT_EOF_STRING (1<<4)
-#ifdef CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION
-#define OPT_INTERACTIVE (1<<5)
+#endif /* CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM */
+
+/* Correct regardless of combination of CONFIG_xxx */
+enum {
+ OPTBIT_VERBOSE = 0,
+ OPTBIT_NO_EMPTY,
+ OPTBIT_UPTO_NUMBER,
+ OPTBIT_UPTO_SIZE,
+ OPTBIT_EOF_STRING,
+ USE_FEATURE_XARGS_SUPPORT_CONFIRMATION(OPTBIT_INTERACTIVE,)
+ USE_FEATURE_XARGS_SUPPORT_TERMOPT( OPTBIT_TERMINATE ,)
+ USE_FEATURE_XARGS_SUPPORT_ZERO_TERM( OPTBIT_ZEROTERM ,)
+
+ OPT_VERBOSE = 1<<OPTBIT_VERBOSE ,
+ OPT_NO_EMPTY = 1<<OPTBIT_NO_EMPTY ,
+ OPT_UPTO_NUMBER = 1<<OPTBIT_UPTO_NUMBER,
+ OPT_UPTO_SIZE = 1<<OPTBIT_UPTO_SIZE ,
+ OPT_EOF_STRING = 1<<OPTBIT_EOF_STRING ,
+ OPT_INTERACTIVE = USE_FEATURE_XARGS_SUPPORT_CONFIRMATION((1<<OPTBIT_INTERACTIVE)) + 0,
+ OPT_TERMINATE = USE_FEATURE_XARGS_SUPPORT_TERMOPT( (1<<OPTBIT_TERMINATE )) + 0,
+ OPT_ZEROTERM = USE_FEATURE_XARGS_SUPPORT_ZERO_TERM( (1<<OPTBIT_ZEROTERM )) + 0,
+};
+#define OPTION_STR "+trn:s:e::" \
+ USE_FEATURE_XARGS_SUPPORT_CONFIRMATION("p") \
+ USE_FEATURE_XARGS_SUPPORT_TERMOPT( "x") \
+ USE_FEATURE_XARGS_SUPPORT_ZERO_TERM( "0")
+
+int xargs_main(int argc, char **argv)
+{
+ char **args;
+ int i, n;
+ xlist_t *list = NULL;
+ xlist_t *cur;
+ int child_error = 0;
+ char *max_args, *max_chars;
+ int n_max_arg;
+ size_t n_chars = 0;
+ long orig_arg_max;
+ const char *eof_str = "_";
+ unsigned opt;
+ size_t n_max_chars;
+#if ENABLE_FEATURE_XARGS_SUPPORT_ZERO_TERM
+ xlist_t* (*read_args)(xlist_t*, const char*, size_t, char*) = process_stdin;