Here are two more proposals, designed to avoid the drawbacks of the
previous ones:
3) A new API
/* Constructs a command line for the platform's command interpreter
that executes argv[0] with the arguments argv[1...] and invokes
popen() on it. */
FILE *popenv (const char * const *argv, const char *type);
/* Constructs a command line for the platform's command interpreter
that executes argv[0] with the arguments argv[1...] and invokes
system() on it. */
int systemv (const char * const *argv);
4) A new API
/* Constructs a command line for the platform's command interpreter
that executes argv[0] with the arguments argv[1...]. */
char *create_system_command (const char * const *argv);
These APIs would not break existing programs, would not do redundant
processing, would not be artificially limited, and would be usable without
any #ifs.
Bruno