1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +00:00

Added test programs for the exec() function.

This commit is contained in:
Greg King 2013-08-25 00:49:03 -04:00
parent d0fb1fe0ae
commit 2d66c27462
3 changed files with 50 additions and 0 deletions

View File

@ -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;
}

24
testcode/lib/exec-test1.c Normal file
View File

@ -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 <unistd.h>
#include <string.h>
#include <errno.h>
#include <conio.h>
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;
}

23
testcode/lib/exec-test2.c Normal file
View File

@ -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 <unistd.h>
#include <string.h>
#include <errno.h>
#include <conio.h>
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;
}