On Sat, 2008-08-09 at 19:28 +0000, Derick Eddington wrote:
> ikarus --r6rs-script is not equivalent to scheme-script:
>
> $ ./command-line -b
> ("./command-line" "-b")
> $ ikarus --r6rs-script command-line -b
> ikarus error: option -b requires a value, none provided
> ikarus -h for more help
>
>
> I'm glad to investigate how to fix these.
Here's what I've done to fix --r6rs-script and --script :
=== modified file 'src/ikarus.c'
--- src/ikarus.c 2008-08-09 12:47:44 +0000
+++ src/ikarus.c 2008-08-09 22:06:48 +0000
@@ -82,7 +82,9 @@
exit(-1);
}
}
- else if(strcmp("--", argv[i]) == 0){
+ else if(strcmp("--", argv[i]) == 0
+ || strcmp("--r6rs-script", argv[i]) == 0
+ || strcmp("--script", argv[i]) == 0){
return 0;
}
}
@@ -100,7 +102,9 @@
}
return 1;
}
- else if(strcmp("--", argv[i]) == 0){
+ else if(strcmp("--", argv[i]) == 0
+ || strcmp("--r6rs-script", argv[i]) == 0
+ || strcmp("--script", argv[i]) == 0){
return 0;
}
}
And now scheme-script can go back to just exec'ing ikarus:
[You'll still need to do automake.]
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2008-08-09 12:47:44 +0000
+++ src/Makefile.am 2008-08-09 23:19:23 +0000
@@ -10,7 +10,7 @@
ikarus-errno.c ikarus-main.h
ikarus_SOURCES = $(SRCS) ikarus.c
-scheme_script_SOURCES = $(SRCS) scheme-script.c
+scheme_script_SOURCES = scheme-script.c
nodist_ikarus_SOURCES = bootfileloc.h
BUILT_SOURCES = bootfileloc.h
=== modified file 'src/scheme-script.c'
--- src/scheme-script.c 2008-08-09 12:47:44 +0000
+++ src/scheme-script.c 2008-08-09 23:27:18 +0000
@@ -15,20 +15,14 @@
* along with this program. If not, see .
*/
-
-
-#include "ikarus-main.h"
#include "bootfileloc.h"
+#include
#include
#include
-#include
-#include
-
-void ikarus_usage_short(){
- fprintf(stderr, "scheme-script arguments ...\n");
-}
-
-void ikarus_usage(){
+#include
+#include
+
+static void usage(){
static char* helpstring =
"Usage: \n\
scheme-script arguments ...\n\
@@ -42,19 +36,25 @@
int main(int argc, char** argv){
if(argc < 2) {
- ikarus_usage();
- exit(-1);
- }
- char* boot_file = BOOTFILE;
- char** args = calloc(sizeof(char*), argc+1);
- args[0] = argv[0];
+ usage();
+ exit(-1);
+ }
+ char** args = calloc(argc+2, sizeof(char*));
+ if(! args) {
+ fprintf(stderr, "Error in scheme-script: cannot calloc\n");
+ exit(-1);
+ }
+ args[0] = EXEFILE;
args[1] = "--r6rs-script";
- args[2] = argv[1];
int i;
for(i=1; i