How to provide Shell Escape from a C program?

Guy Harris guy at auspex.auspex.com
Sat Nov 24 10:24:38 AEST 1990


>>Can some body help me with this problem? 
>
>From the man page for strtok:

That's certainly *A* problem with his code, but far from the most
fundamental one, and not the one that's screwing him up.  The problem
that's screwing him up, as others have noted, is that the "-c" flag to
the shell takes *one* argument, which is a character string containing
the command to be executed, in its entirety; his use of "strtok()" to
try to carve the command up into tokens, and pass each token as an
individual argument to the shell, is incorrect - and would still be
incorrect even if he were correctly calling "strtok()" with a NULL
pointer as the first argument in all but the first call.



More information about the Comp.unix.programmer mailing list