projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0d84f3f
)
[project @ 2001-08-01 21:55:04 by sof]
author
sof
<unknown>
Wed, 1 Aug 2001 21:55:04 +0000
(21:55 +0000)
committer
sof
<unknown>
Wed, 1 Aug 2001 21:55:04 +0000
(21:55 +0000)
Support LFNs
ghc/driver/ghci/ghci.c
patch
|
blob
|
history
diff --git
a/ghc/driver/ghci/ghci.c
b/ghc/driver/ghci/ghci.c
index
bd75ac3
..
a9f79de
100644
(file)
--- a/
ghc/driver/ghci/ghci.c
+++ b/
ghc/driver/ghci/ghci.c
@@
-1,6
+1,6
@@
/*
*
/*
*
- * $Id: ghci.c,v 1.1 2001/07/30 10:40:36 rrt Exp $
+ * $Id: ghci.c,v 1.2 2001/08/01 21:55:04 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".
@@
-39,6
+39,7
@@
#include <stdio.h>
#include <process.h>
#include <malloc.h>
#include <stdio.h>
#include <process.h>
#include <malloc.h>
+#include <stdlib.h>
#define BINARY_NAME "ghc.exe"
#define IACTIVE_OPTION "--interactive"
#define BINARY_NAME "ghc.exe"
#define IACTIVE_OPTION "--interactive"
@@
-49,19
+50,20
@@
int
main(int argc, char** argv)
{
TCHAR binPath[FILENAME_MAX+1];
main(int argc, char** argv)
{
TCHAR binPath[FILENAME_MAX+1];
+ TCHAR binPathShort[MAX_PATH+1];
DWORD dwSize = FILENAME_MAX;
DWORD dwRes;
TCHAR* szEnd;
char** new_argv;
int i;
DWORD dwSize = FILENAME_MAX;
DWORD dwRes;
TCHAR* szEnd;
char** new_argv;
int i;
-
+
/* Locate the binary we want to start up */
dwRes =
SearchPath(NULL,
BINARY_NAME,
NULL,
dwSize,
/* Locate the binary we want to start up */
dwRes =
SearchPath(NULL,
BINARY_NAME,
NULL,
dwSize,
- binPath,
+ (char*)binPath,
&szEnd);
if (dwRes == 0) {
&szEnd);
if (dwRes == 0) {
@@
-69,12
+71,20
@@
main(int argc, char** argv)
return 1;
}
return 1;
}
+ dwSize = MAX_PATH;
+ /* Turn the path into short form - LFN form causes problems
+ when passed in argv[0]. */
+ if ( !(GetShortPathName(binPath, binPathShort, dwSize)) ) {
+ errmsg("Unable to locate ghc.exe");
+ return 1;
+ }
+
new_argv = (char**)malloc(sizeof(char) * (argc + 1 + 1));
if (new_argv == NULL) {
errmsg("failed to start up ghc.exe");
return 1;
}
new_argv = (char**)malloc(sizeof(char) * (argc + 1 + 1));
if (new_argv == NULL) {
errmsg("failed to start up ghc.exe");
return 1;
}
- new_argv[0] = binPath;
+ new_argv[0] = binPathShort;
new_argv[1] = (char*)malloc(sizeof(char) * (strlen(IACTIVE_OPTION) + 1));
if (new_argv[1]) {
new_argv[1] = (char*)malloc(sizeof(char) * (strlen(IACTIVE_OPTION) + 1));
if (new_argv[1]) {