From: Greg King Date: Sun, 25 Aug 2013 04:49:03 +0000 (-0400) Subject: Added test programs for the exec() function. X-Git-Tag: V2.15~236^2~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2d66c27462c45845e710cd2f21eff643fe7617bb;p=cc65 Added test programs for the exec() function. --- diff --git a/testcode/lib/arg-test.c b/testcode/lib/arg-test.c index c752acaeb..5c28faec0 100644 --- a/testcode/lib/arg-test.c +++ b/testcode/lib/arg-test.c @@ -9,6 +9,9 @@ int main (int argc, char* argv[]) for (I = 0; I < argc; ++I) { printf ("argv[%2d]: \"%s\"\n", I, argv[I]); } + + printf ("\n"); + getchar (); return EXIT_SUCCESS; } diff --git a/testcode/lib/exec-test1.c b/testcode/lib/exec-test1.c new file mode 100644 index 000000000..e2548fb0a --- /dev/null +++ b/testcode/lib/exec-test1.c @@ -0,0 +1,24 @@ +/* +** These programs test CC65's exec() program-chaining function. +** exec-test1 runs exec-test2 -- that tests the loading and starting of another +** program. Then, exec-test2 runs arg-test -- that tests command-line argument +** passing. +** +** 2013-08-24, Greg King +*/ + +#include +#include +#include +#include + +int main (void) { + clrscr (); + cprintf ("\nExec-test #1 -- launching #2...\r\n"); + + exec ("exec-test2", ""); + + cprintf ("\nFailed to find #2:\r\n %s.\r\n", _stroserror (_oserror)); + cgetc (); + return _oserror; +} diff --git a/testcode/lib/exec-test2.c b/testcode/lib/exec-test2.c new file mode 100644 index 000000000..e6c844a8e --- /dev/null +++ b/testcode/lib/exec-test2.c @@ -0,0 +1,23 @@ +/* +** These programs test CC65's exec() program-chaining function. +** exec-test1 runs exec-test2 -- that tests the loading and starting of another +** program. Then, exec-test2 runs arg-test -- that tests command-line argument +** passing. +** +** 2013-08-24, Greg King +*/ + +#include +#include +#include +#include + +int main (void) { + cprintf ("\nExec-test #2 -- launching arg-test...\r\n\n"); + + exec ("arg-test", "arg1 arg2 \"\" arg4"); + + cprintf ("\nFailed to find arg-test:\r\n %s.\r\n", _stroserror (_oserror)); + cgetc (); + return _oserror; +}