aboutsummaryrefslogtreecommitdiffstats
path: root/handerror.c
diff options
context:
space:
mode:
Diffstat (limited to 'handerror.c')
-rw-r--r--handerror.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/handerror.c b/handerror.c
index 753e834..35e8f28 100644
--- a/handerror.c
+++ b/handerror.c
@@ -1,5 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
+#include <sys/wait.h>
void callError(int num)
{
@@ -13,3 +15,16 @@ void printError(char *text)
exit(4);
}
+void easyFork(char *name, char *arguments[])
+{
+ int pid;
+ pid = fork();
+ if(pid == -1) callError(100);
+ if(pid == 0) { /* new process */
+ execvp(name, arguments);
+ perror(name);
+ exit(4);
+ }
+ wait(&pid);
+}
+