[project @ 2002-12-05 23:49:43 by mthomas]
[ghc-hetmet.git] / ghc / driver / ghci / ghci.c
index a9f79de..d04af16 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- * $Id: ghci.c,v 1.2 2001/08/01 21:55:04 sof Exp $
+ * $Id: ghci.c,v 1.5 2002/01/07 16:32:54 sof Exp $
  *
  * ghci wrapper - invokes ghc.exe with the added command-line
  *                option "--interactive".
@@ -25,8 +25,8 @@
  *   * Compile it up (assuming the .ico file is in the same dir
  *     as the .rc file):
  *
- *         MSVC:    rc /I. ghci.rc /o ghci.res
- *         mingw:   windres -o ghci.res -o ghci.rc -O coff
+ *         MSVC:    rc /i. /fo ghci.res ghci.rc 
+ *         mingw:   windres -o ghci.res -i ghci.rc -O coff
  *
  *   * Add the resulting .res file to the link line of the wrapper:
  *
@@ -79,7 +79,7 @@ main(int argc, char** argv)
     return 1;
   }
   
-  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;
@@ -95,7 +95,7 @@ main(int argc, char** argv)
   }
 
   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;
@@ -116,5 +116,13 @@ main(int argc, char** argv)
      
      ==> 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);
 }