[BusyBox] Problems with xargs !!!

Ronny Arild Ronny.Arild at no.thalesgroup.com
Mon Mar 31 18:45:03 UTC 2003


|  -----Original Message-----
|  From: Steven Scholz [mailto:steven.scholz at imc-berlin.de]

|  But would it be hard to change busybox's xargs to behave 
|  like xargs on other (let's say MY) machine!?
|  
|  So while parsing the command line just treat everything 
|  after (and including) the first argument without a "-" as the [command 
|  [initial-arguments]] as stated in xargs' man page.
|  
|  ~# find . -name rc.sh | xargs -t egrep -n "ipcal"
|                                  |   |    |
|                                  |   |    +- initial-arguments
|                                  |   +------ command (no "-")
|                                  +---------- xargs argument

You can solve this by adding the following code to xargs_main():

 int xargs_argc;

 for (xargs_argc = 1; xargs_argc < argc; xargs_argc++)
        if (*argv[xargs_argc] != '-')
                break;

Then use xargs_argc as parameter to getopt() instead of argc, and
also use xargs_argc instead of optind below.

Ronny






More information about the busybox mailing list