Added a command line argument to the apple2enh target.
One command line argument is accpeted which is the name of the application to be started initially - basically instead of 'welcome.prg'. The directory part is removed because application can only be loaded from the Contiki directory.
The intended usecase is selecting a Contiki *.prg file in the Apple GS/OS Finder with an Icon File in place for *.prg files which contains in the 'boss' section a reference to my ProDOS binary file loader. The loader supports the ProDOS startup file protocol used by the ProDOS launcher of GS/OS and emulates a BASIC REM command line understood by the cc65 C-Library command line handler.
diff --git a/contiki-apple2/main.c b/contiki-apple2/main.c
index 33b9fc1..e012c35 100644
--- a/contiki-apple2/main.c
+++ b/contiki-apple2/main.c
@@ -32,10 +32,12 @@
*
* This file is part of the Contiki desktop environment
*
- * $Id: main.c,v 1.13 2005/05/16 21:18:47 oliverschmidt Exp $
+ * $Id: main.c,v 1.14 2006/05/18 16:20:08 oliverschmidt Exp $
*
*/
+#include <string.h>
+
#include "ctk.h"
#include "ctk-draw.h"
#include "ek.h"
@@ -102,7 +104,11 @@
}
/*-----------------------------------------------------------------------------------*/
void
+#ifdef __APPLE2__
main(void)
+#else /* __APPLE2__ */
+main(int argc, char *argv[])
+#endif /* __APPLE2__ */
{
ek_init();
ek_start(&init);
@@ -121,7 +127,28 @@
while(1) {
if(ek_run() == 0) {
+
+#ifdef __APPLE2__
+
program_handler_load("welcome.prg", NULL);
+
+#else /* __APPLE2__ */
+
+ static char *startup;
+ static char *slash;
+
+ if(argc == 1) {
+ startup = "welcome.prg";
+ } else {
+ startup = argv[1];
+ while(slash = strchr(startup, '/')) {
+ startup = slash + 1;
+ }
+ }
+ program_handler_load(startup, NULL);
+
+#endif /* __APPLE2__ */
+
break;
}
}