> > > I don't see a problem with adding an option to cp to treat the first
> > > argument as the target instead of the last argument.  It's a simple
> > > solution, the code change is simple, and it produces the exact desired
> > > result.  What's the problem?
> > 
> > It's yet another non-portable option.
> 
> I hate to appear rude, but has anybody in this discussion actually used 
> xargs for what it's meant to be used ?
> 
> How do you do this in a script:
> 
>   cd /topdir; find . -type f | xargs -i {} cp {} /otherdir/.
> 

My example should work for that, just replace the initial echo
with ``cd /topdir; find . -type f'', and replace your xargs
with my script, using -n 100 or -s of some sane value.

> Before anyone starts writing scripts, consider that {} will be 
> replaced by xargs with (roughly) ARG_MAX - 10 characters worth of the 
> stuff coming off the pipe.  If your combined arguments plus 
> environment exceeds ARG_MAX execve(2) will give you E2BIG.

No rain here, it is ARG_MAX - 2048:
     -s size
             Set the maximum number of bytes for the command line length pro-
             vided to utility. The sum of the length of the utility name and
             the arguments passed to utility (including NULL terminators) will
             be less than or equal to this number.  The current default value
             for size is ARG_MAX - 2048.

2K would be a pretty big env, root default std is about 367 bytes.

Yes, that is probably not a portable assumption to make, but it is
far better than using non-standard options to xargs.

-- 
Rod Grimes - KD7CAX @ CN85sl - (RWG25)               [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to