[uClibc] usage problem (linux - ash - system command)

Peter Kjellerstedt peter.kjellerstedt at axis.com
Tue Feb 1 08:04:02 UTC 2005


In cases like this, it is always a good idea to provide
a snippet of the actual code in use, as well as an extract 
of any debug messages.

Here is a small code example with two ways to use the system() 
call to call ls with your arguments (I use ls as it will print
the arguments when it fails to find them):

#include <stdlib.h>

int main()
{
  system("ls 1 2 \"00:11:22:33:44:55    00:11:22:44:55:66\"");
  system("ls 1 2 '00:11:22:33:44:55    00:11:22:44:55:66'");
  return 0;
}

Are you sure it is the arguments that is the problem, and not
for example that the aniSdkTool cannot be found in the current 
working directory?

//Peter

> -----Original Message-----
> From: uclibc-bounces at uclibc.org 
> [mailto:uclibc-bounces at uclibc.org] On Behalf Of Philip Rakity
> Sent: Tuesday, February 01, 2005 08:38
> To: uclibc at uclibc.org
> Subject: [uClibc] usage problem (linux - ash - system command)
> 
> I am writing a c program that uses the system command.
> 
> I am trying to use the system command to pass the following string for
> processing.  The double quotes are important.  I am using busybox ash.
> 
> ./aniSdkTool 1 2 "00:11:22:33:44:55    00:11:22:44:55:66"
> 
> I use sprintf to built the string. 
> 
>  I have tried backslashing the " (double quotes)  eg \"
> ./aniSdkTool 1 2 \"00:11:22:33:44:55    00:11:22:44:55:66\"
> 
> I have tried single quoting the the " eg  '"  or "'
> ./aniSdkTool 1 2 '"00:11:22:33:44:55    00:11:22:44:55:66"'
> 
> The command fails HOWEVER if I echo the cmd to a /var/xxx 
> file and then cat the command it looks just fine. 
> looks like the line above with the quotes
> 
>  I can do the following from the shell  (console)
> 
> sh /var/xxx  works just fine 
> as well as
> ./var/xxx  (one execute premission is given to the file)
> 
> any ideas ?



More information about the uClibc mailing list