chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] windows shell problem


From: Tobia Conforto
Subject: Re: [Chicken-users] windows shell problem
Date: Tue, 6 Jan 2009 00:00:31 +0100

felix winkelmann wrote:
f I pass this string (verbatim, just like it is printed here) to system(3):

"c:\home\chicken-trunk\bin\csi" -bnq -e "(require-library setup-api)"
-e "(import setup-api)" "c:\...some...path...\defstruct.setup"


Have you tried adding an .exe extension to csi?

Like: "c:\home\chicken-trunk\bin\csi.exe"

I know it sounds stupid...

Lars Nilsson wrote:
Perhaps you could try the short-name paths in Windows, like c:\home \chicke~1\bin\csi, without the quotes around it.

If that works, perhaps use GetShortPathName() to automatically find out what the "short" path is for a "full" path.

Hey, this might be part of a solution. But what about spaces in pathnames (where the filename part is <7 characters)?

That's not going to be a problem: filenames (or directory names) shorter than 8 chars but containing a space are still considered long names and are given a DOS-compatible short name. So even a short "a b" becomes ab~1.

You could try and translate the first filename (the csi executable) to a short name and use single quotes on the rest of the line, assuming the C library csi is linked to understands single quotes:

c:\home\chicke~1\bin\csi -bnq -e '(require-library setup-api)' -e '(import setup-api)' 'c:\...some...path...\defstruct.setup'


Anyways, I think you should dump system(3) and just use CreateProcess:

char *exe = "c:\\home\\chicken-trunk\\bin\\csi.exe";
char *cmdline = "csi -bnq -e \"(require-library setup-api)\" -e \"(import setup-api)\" \"c:\\...some...path...\\defstruct.setup\"";

STARTUPINFO si;
PROCESS_INFORMATION pi;
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);

if (! CreateProcess(exe, cmdline, 0,0,0,0,0,0, &si, &pi)) {
        printf("Error %d executing:\n%s\n%s\n", GetLastError(), exe, cmdline);
        exit(1);
}


-Tobia




reply via email to

[Prev in Thread] Current Thread [Next in Thread]