Small test app for the execl() function.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9251 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-10-07 15:39:37 +00:00
parent acfca1a3f5
commit d82bfbadd6
2 changed files with 34 additions and 0 deletions

View File

@ -1,6 +1,7 @@
SubDir OBOS_TOP src kernel apps ;
KernelObjects
exec_test.c
false_main.c
fibo_main.c
init.c

View File

@ -0,0 +1,33 @@
/*
** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
** Distributed under the terms of the Haiku License.
*/
#include <OS.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
int
main(int argc, char **argv)
{
printf("exec_test: this is thread %ld\n", find_thread(NULL));
if (argc < 2) {
puts("going to execl()...");
execl("/bin/exec_test", "/bin/exec_test", "argument 1", NULL);
printf("execl() returned: %s\n", strerror(errno));
} else {
int i;
puts("got arguments:");
for (i = 0; i < argc; i++)
printf("%d: \"%s\"\n", i, argv[i]);
}
return 0;
}