- fixed awfully bad bug in allocation of new argv vector, it
did:
malloc(sizeof(char) * (argc + 1 + 1));
where it should have done:
malloc(sizeof(char*) * (argc + 1 + 1));
[ This one is the cause of one or two 5.02 bug reports
that are now starting to trickle in. As a stopgap
measure (and since I'm to blame for this one, really),
I've put up a replacement ghci.exe wrapper at
http://www.galconn.com/~sof/ghci.zip
]
- added some (currently disabled) debug print code.
- * $Id: ghci.c,v 1.3 2001/08/02 01:01:46 sof Exp $
+ * $Id: ghci.c,v 1.4 2001/10/10 17:25:15 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".
- new_argv = (char**)malloc(sizeof(char) * (argc + 1 + 1));
+ new_argv = (char**)malloc(sizeof(char*) * (argc + 1 + 1));
if (new_argv == NULL) {
errmsg("failed to start up ghc.exe");
return 1;
if (new_argv == NULL) {
errmsg("failed to start up ghc.exe");
return 1;
}
for ( i=1; i < argc; i++ ) {
}
for ( i=1; i < argc; i++ ) {
- new_argv[i+1] = (char*)malloc(sizeof(char) * (strlen(argv[i] + 1)));
+ new_argv[i+1] = (char*)malloc(sizeof(char) * (strlen(argv[i]) + 1));
if (new_argv[i+1] == NULL) {
errmsg("failed to start up ghc.exe");
return 1;
if (new_argv[i+1] == NULL) {
errmsg("failed to start up ghc.exe");
return 1;
==> Just use spawnv().
*/
==> Just use spawnv().
*/
+#if 0
+ fprintf(stderr, "Invoking ghc: ");
+ i=0;
+ while (new_argv[i] != NULL) {
+ fprintf(stderr, "%s ", new_argv[i++]);
+ }
+ fprintf(stderr, "\n"); fflush(stderr);
+#endif
return _spawnv(_P_WAIT, binPath, new_argv);
}
return _spawnv(_P_WAIT, binPath, new_argv);
}