I can write a C program with strings and to pass it to the system to avoid the ugly bash syntax?
My Program
#include <stdlib.h>
#include <stdio.h>
static char command_name[2040] = {0};
int main(int argc, char** argv) {
if ( argc != 2 ) {
fprintf(stderr, "Provide command line argument for virtual image \n");
exit(1);
} else {
sprintf(command_name, "qemu-kvm -m 1024 %s -netdev user,id=user.0 -device rtl8139,netdev=user.0",
argv[1]);
}
return system(command_name);
}
Any suggestions are welcome?