projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2003-06-02 16:24:07 by sof]
[ghc-hetmet.git]
/
ghc
/
driver
/
ghci
/
ghci.c
diff --git
a/ghc/driver/ghci/ghci.c
b/ghc/driver/ghci/ghci.c
index
d04af16
..
8c6926c
100644
(file)
--- a/
ghc/driver/ghci/ghci.c
+++ b/
ghc/driver/ghci/ghci.c
@@
-1,6
+1,6
@@
/*
*
/*
*
- * $Id: ghci.c,v 1.5 2002/01/07 16:32:54 sof Exp $
+ * $Id: ghci.c,v 1.6 2003/06/02 16:24:07 sof Exp $
*
* ghci wrapper - invokes ghc.exe with the added command-line
* option "--interactive".
*
* ghci wrapper - invokes ghc.exe with the added command-line
* option "--interactive".
@@
-95,12
+95,17
@@
main(int argc, char** argv)
}
for ( i=1; i < argc; i++ ) {
}
for ( i=1; i < argc; i++ ) {
- new_argv[i+1] = (char*)malloc(sizeof(char) * (strlen(argv[i]) + 1));
+ int len = strlen(argv[i]);
+ /* to avoid quoting issues, surround each option in double quotes */
+ new_argv[i+1] = (char*)malloc(sizeof(char) * (len + 3));
if (new_argv[i+1] == NULL) {
errmsg("failed to start up ghc.exe");
return 1;
} else {
if (new_argv[i+1] == NULL) {
errmsg("failed to start up ghc.exe");
return 1;
} else {
- strcpy(new_argv[i+1], argv[i]);
+ new_argv[i+1][0] = '"';
+ strcpy(1 + new_argv[i+1], argv[i]);
+ new_argv[i+1][len+1] = '"';
+ new_argv[i+1][len+2] = '\0';
}
}
new_argv[i+1] = NULL;
}
}
new_argv[i+1] = NULL;