Garance A Drosihn <[EMAIL PROTECTED]> writes:
> At 1:19 PM -0700 4/21/01, Dima Dorfman wrote:
> >Does that mean everyone is blind and missed my arrogant
> >cross-post of the amazingly short patch to do this, or
> >are we just interested in discussing it and not testing
> >the implementation? ;-)
>
> Well, I'm in the middle of a massive reorganization of
> all my machines at home (to fit in a new G4 Cube!), so
> I'm not paying as much attention to this as I would like.
> I think it's really great that Dima has volunteered to do
> the work... :-)
>
> From what I have been following, you had one patch to add
> the '-I' and '-i' options, and a different patch to add
> the newly proposed '-Y' option. Right?
No, not quite. It's the same patch. The second one just has the 'Y'
option renamed to 'I' because I thought they did the same thing: they
don't.
>
> The '-I' option is of interest because it is used in some
> other OS's, and is even defined in some standards, such as
> the SingleUnixSpec. From that:
>
> -I replstr
> Insert mode: utility will be executed for each line from
> standard input, taking the entire line as a single argument,
> inserting it in arguments for each occurrence of replstr.
> A maximum of five arguments in arguments can each contain
> one or more instances of replstr. Any blank characters at
> the beginning of each line are ignored. Constructed arguments
> cannot grow larger than 255 bytes. Option -x is forced on.
>
> I think that if we're going to add a '-I', then we should
> follow that description. Note that '-I', by definition,
> forces '-n 1'. It will always pick up only one file from
> the input to xargs per command that xarg will generate.
> It allows things like:
Adding support for 'I' the way it's described above wouldn't be a
trivial as it was to add 'Y'. The latter adds about 15 lines, while
the former may involve some restructuring of the code.
Xargs compiles the arguments to <utility> as an array of pointers. It
also has assumptions that argv is only touched in the begining. It
wasn't a problem for -Y since it doesn't support the replstr being
embedded in an argument (e.g., for a replstr of "{}", "something{}"
will not work as one arugment, only "{}" will), and it didn't have to
touch argv more than twice (I just added a small loop before all
invocations of run()). With -I, it'd probably be necessary to put a
large chuck of what is now main() inside a loop. It's not exactly
rocket science, but not something I can whip up in an hour, either.
I'll see what I can do probably later this week.
Dima Dorfman
[EMAIL PROTECTED]
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message