Commit 262df042 authored by sof's avatar sof
Browse files

[project @ 2001-08-01 21:55:04 by sof]

Support LFNs
parent 0d84f3fa
/*
*
* $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".
......@@ -39,6 +39,7 @@
#include <stdio.h>
#include <process.h>
#include <malloc.h>
#include <stdlib.h>
#define BINARY_NAME "ghc.exe"
#define IACTIVE_OPTION "--interactive"
......@@ -49,19 +50,20 @@ int
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;
/* Locate the binary we want to start up */
dwRes =
SearchPath(NULL,
BINARY_NAME,
NULL,
dwSize,
binPath,
(char*)binPath,
&szEnd);
if (dwRes == 0) {
......@@ -69,12 +71,20 @@ main(int argc, char** argv)
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[0] = binPath;
new_argv[0] = binPathShort;
new_argv[1] = (char*)malloc(sizeof(char) * (strlen(IACTIVE_OPTION) + 1));
if (new_argv[1]) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment