@@ -67,6 +67,23 @@ test_hello()
LDFLAGS_EXTRA="-static -e_main"
}
+test_to_fork()
+{
+ BUILD_IN="to_fork.c"
+ BUILD_OUT="to_fork"
+ CLEAN_COM="rm -f *.o"
+ LIBS_TO_LINK="stdio c"
+ LDFLAGS_EXTRA="-static -e_main"
+}
+
+test_saymyname()
+ BUILD_IN="say.c"
+ BUILD_OUT="say"
cmd_cp()
{
BUILD_IN="cp.c"
@@ -0,0 +1,11 @@
+#include <u.h>
+#include <libc.h>
+#include <stdio.h>
+void main()
+ char nombre[25];
+ printf("Your name?: ");
+ scanf("%s", &nombre);
+ printf("\n\nHello %s\n",nombre);
@@ -0,0 +1,20 @@
+ int pid = fork();
+ if (pid == 0)
+ {
+ printf("I'm the father\n");
+ }
+ else if (pid > 0)
+ printf("I'm the child\n");
+ else
+ printf("fork() error\n");