Quick question, im trying to add this function to ioquake3: *void Loadexternal ( char *emu, char *rom )* *{* * pid_t pid;* * printf("%s %s \n", emu, rom);* * if ((pid = fork()) == 0) {* * char * const new_argv[] = { emu, rom, NULL };* * * * if (execv(new_argv[0], new_argv) < 0) {* * perror("execv error");* * exit(EXIT_FAILURE);* * }* * } else if (pid < 0) {* * perror("fork error");* * exit(EXIT_FAILURE);* * }* * * * /* You really should use waitpid here so you know when the * * * "emu" exits and you can startup the "frontend" again. */* * if (waitpid(pid, NULL, 0) == -1) {* * perror("waitpid error");* * exit(EXIT_FAILURE);* * }* * * * printf("Exited successfully\n");* *}*
But the trick is, it needs to be somewhere out of the way of the vm's because it gives me compiling errors because it includes system files *#include <stdio.h>* *#include <stdlib.h>* *#include <unistd.h>* *#include <sys/types.h>* *#include <sys/wait.h>* so it needs to be in the client code. The reason being is i need to call it from the ui. I did this by putting it in cl_ui.c but it has to go from the ui vm, through the syscalls, then to the client, and its hard to get arguments to pass correctly doing this, is there a better way of doing this? If more info is needed let me know, thank you in advance.
_______________________________________________ ioquake3 mailing list ioquake3@lists.ioquake.org http://lists.ioquake.org/listinfo.cgi/ioquake3-ioquake.org By sending this message I agree to love ioquake3 and libsdl.