bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] findutils-4.1.20: POSIX xargs options


From: Tim Waugh
Subject: [patch] findutils-4.1.20: POSIX xargs options
Date: Thu, 18 Mar 2004 14:22:11 +0000
User-agent: Mutt/1.4.1i

Hi,

This patch brings xargs in line with the Single UNIX specification
with regard to -E, -I, and -L.

What do you think?

Tim.
*/

--- findutils-4.1.20/xargs/xargs.c.xargs-EIL    2004-03-18 14:20:29.000000000 
+0000
+++ findutils-4.1.20/xargs/xargs.c      2004-03-18 14:20:29.000000000 +0000
@@ -308,7 +308,7 @@
   if (arg_max <= 0)
     error (1, 0, _("environment is too large for exec"));
 
-  while ((optc = getopt_long (argc, argv, "+0e::i::l::n:prs:txP:",
+  while ((optc = getopt_long (argc, argv, "+0e::E:i::I:l::L:n:prs:txP:",
                              longopts, (int *) 0)) != -1)
     {
       switch (optc)
@@ -317,8 +317,9 @@
          read_args = read_string;
          break;
 
+       case 'E':
        case 'e':
-         if (optarg)
+         if (optarg && *optarg)
            eof_str = optarg;
          else
            eof_str = 0;
@@ -327,6 +328,7 @@
        case 'h':
          usage (stdout, 0);
 
+       case 'I':
        case 'i':
          if (optarg)
            replace_pat = optarg;
@@ -337,9 +339,10 @@
          lines_per_exec = 0;
          break;
 
+       case 'L':
        case 'l':
          if (optarg)
-           lines_per_exec = parse_num (optarg, 'l', 1L, -1L);
+           lines_per_exec = parse_num (optarg, optc, 1L, -1L);
          else
            lines_per_exec = 1;
          /* -l excludes -i -n.  */
@@ -926,8 +929,9 @@
 usage (FILE *stream, int status)
 {
   fprintf (stream, _("\
-Usage: %s [-0prtx] [-e[eof-str]] [-i[replace-str]] [-l[max-lines]]\n\
-       [-n max-args] [-s max-chars] [-P max-procs] [--null] 
[--eof[=eof-str]]\n\
+Usage: %s [-0prtx] [-E eof-str] [-e[eof-str]] [-I replace-str]\n\
+       [-i[replace-str]] [-L max-lines] [-l[max-lines]] [-n max-args]\n\
+       [-s max-chars] [-P max-procs] [--null] [--eof[=eof-str]]\n\
        [--replace[=replace-str]] [--max-lines[=max-lines]] [--interactive]\n\
        [--max-chars=max-chars] [--verbose] [--exit] [--max-procs=max-procs]\n\
        [--max-args=max-args] [--no-run-if-empty] [--version] [--help]\n\
--- findutils-4.1.20/xargs/xargs.1.xargs-EIL    1996-02-04 20:35:11.000000000 
+0000
+++ findutils-4.1.20/xargs/xargs.1      2004-03-18 14:20:29.000000000 +0000
@@ -3,12 +3,12 @@
 xargs \- build and execute command lines from standard input
 .SH SYNOPSIS
 .B xargs
-[\-0prtx] [\-e[eof-str]] [\-i[replace-str]] [\-l[max-lines]]
-[\-n max-args] [\-s max-chars] [\-P max-procs] [\-\-null] [\-\-eof[=eof-str]]
-[\-\-replace[=replace-str]] [\-\-max-lines[=max-lines]] [\-\-interactive]
-[\-\-max-chars=max-chars] [\-\-verbose] [\-\-exit] [\-\-max-procs=max-procs]
-[\-\-max-args=max-args] [\-\-no-run-if-empty] [\-\-version] [\-\-help]
-[command [initial-arguments]]
+[\-0prtx] [\-E eof-str] [\-e[eof-str]] [\-I replace-str] [\-i[replace-str]]
+[\-L max-lines] [\-l[max-lines]] [\-n max-args] [\-s max-chars]
+[\-P max-procs] [\-\-null] [\-\-eof[=eof-str]] [\-\-replace[=replace-str]]
+[\-\-max-lines[=max-lines]] [\-\-interactive] [\-\-max-chars=max-chars]
+[\-\-verbose] [\-\-exit] [\-\-max-procs=max-procs] [\-\-max-args=max-args]
+[\-\-no-run-if-empty] [\-\-version] [\-\-help] [command [initial-arguments]]
 .SH DESCRIPTION
 This manual page
 documents the GNU version of
@@ -44,10 +44,11 @@
 contain white space, quote marks, or backslashes.  The GNU find
 \-print0 option produces input suitable for this mode.
 .TP
-.I "\-\-eof[=eof-str], \-e[eof-str]"
+.I "\-\-eof[=eof-str], \-E eof-str, \-e[eof-str]"
 Set the end of file string to \fIeof-str\fR.  If the end of file
 string occurs as a line of input, the rest of the input is ignored.
-If \fIeof-str\fR is omitted, there is no end of file string.  If this
+If \fIeof-str\fR is omitted or if \fI\-E\fP option's argument is
+an empty string, there is no end of file string.  If this
 option is not given, the end of file string defaults to "_".
 .TP
 .I "\-\-help"
@@ -55,15 +56,15 @@
 .B xargs
 and exit.
 .TP
-.I "\-\-replace[=replace-str], \-i[replace-str]"
+.I "\-\-replace[=replace-str], \-I replace-str, \-i[replace-str]"
 Replace occurences of \fIreplace-str\fR in the initial arguments with
 names read from standard input.
 Also, unquoted blanks do not terminate arguments.
 If \fIreplace-str\fR is omitted, it
 defaults to "{}" (like for `find \-exec').  Implies \fI\-x\fP and
-\fI\-l 1\fP.
+\fI\-L 1\fP.
 .TP
-.I "\-\-max-lines[=max-lines], -l[max-lines]"
+.I "\-\-max-lines[=max-lines], \-L max-lines, \-l[max-lines]"
 Use at most \fImax-lines\fR nonblank input lines per command line;
 \fImax-lines\fR defaults to 1 if omitted.  Trailing blanks cause an
 input line to be logically continued on the next input line.  Implies
--- findutils-4.1.20/doc/find.texi.xargs-EIL    2001-05-20 20:45:13.000000000 
+0100
+++ findutils-4.1.20/doc/find.texi      2004-03-18 14:20:29.000000000 +0000
@@ -1459,6 +1459,7 @@
 command.  By default, the command is run once even if there is no input.
 
 @item address@hidden@address@hidden
address@hidden -L @var{max-lines}
 @itemx address@hidden@address@hidden
 Use at most @var{max-lines} nonblank input lines per command line;
 @var{max-lines} defaults to 1 if omitted.  Trailing blanks cause an
@@ -1497,16 +1498,17 @@
 
 @table @code
 @item address@hidden@address@hidden
address@hidden -I @var{replace-str}
 @itemx address@hidden@address@hidden
 Replace occurrences of @var{replace-str} in the initial arguments with
 names read from standard input.  Also, unquoted blanks do not terminate
 arguments.  If @var{replace-str} is omitted, it defaults to @address@hidden@}}
-(like for @samp{find -exec}).  Implies @samp{-x} and @samp{-l 1}.  As an
+(like for @samp{find -exec}).  Implies @samp{-x} and @samp{-L 1}.  As an
 example, to sort each file the @file{bills} directory, leaving the
 output in that file name with @file{.sorted} appended, you could do:
 
 @example
-find bills -type f | xargs -iXX sort -o XX.sorted XX
+find bills -type f | xargs -I XX sort -o XX.sorted XX
 @end example
 
 @noindent
@@ -2182,23 +2184,27 @@
 is treated like any other argument.
 
 @item address@hidden@address@hidden
address@hidden -E @var{eof-str}
 @itemx address@hidden@address@hidden
 Set the end of file string to @var{eof-str}.  If the end of file string
 occurs as a line of input, the rest of the input is ignored.  If
address@hidden is omitted, there is no end of file string.  If this
-option is not given, the end of file string defaults to @samp{_}.
address@hidden is omitted or if @samp{-E} option's argument is an empty
+string, there is no end of file string.  If this option is not given,
+the end of file string defaults to @samp{_}.
 
 @item --help
 Print a summary of the options to @code{xargs} and exit.
 
 @item address@hidden@address@hidden
address@hidden -I @var{replace-str}
 @itemx address@hidden@address@hidden
 Replace occurrences of @var{replace-str} in the initial arguments with
 names read from standard input.  Also, unquoted blanks do not terminate
 arguments.  If @var{replace-str} is omitted, it defaults to @address@hidden@}}
-(like for @samp{find -exec}).  Implies @samp{-x} and @samp{-l 1}.
+(like for @samp{find -exec}).  Implies @samp{-x} and @samp{-L 1}.
 
 @item address@hidden@address@hidden
address@hidden -L @var{max-lines}
 @itemx address@hidden@address@hidden
 Use at most @var{max-lines} nonblank input lines per command line;
 @var{max-lines} defaults to 1 if omitted.  Trailing blanks cause an




reply via email to

[Prev in Thread] Current Thread [Next in Thread]