#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>

int run_argv (char **argv)
{
    pid_t pid;
    int status;

    pid = fork ();
    if (pid < 0) {
	perror ("fork");
	return (-1);
    }
    if (pid == 0) {
	execv (argv[0], argv);
	_exit (-1);
    }
    pid = waitpid (pid, &status, 0);
    if (pid < 0)
	return (-1);
    if (WIFEXITED (status))
	return (WEXITSTATUS (status));
    return (status);
}
