Prof A Olowofoyeku (The African Chief) wrote:
pipec.c?
Ditto here. I am not sure whether "#define fix_argv(argvec) (argvec)" will be needed for MSYS as it is for Cygwin.
Well, actually it (i.e., the function in the `#else' part) is needed *except* under Cygwin, so it's #defined as a no-op for Cygwin. What the function does, according to the comment: : /* This is a kludge to get around the Microsoft C spawn functions' propensity : to remove the outermost set of double quotes from all arguments. */ I.e., if you spawn a process with an argument of "foo" (including the quotes), the process will only see foo without quotes.
Is there a way to test whether it will be needed?
Compile this to `foo[.exe]': program Foo; var i: Integer; begin for i := 1 to ParamCount do WriteLn (ParamStr (i)) end. Then run this (might have to write 'foo.exe' in the `PExecute' call): program Bar; uses GPC, Pipe; var Arguments: array [0 .. 2] of CString = ('foo', 'bar', '"bar"'); Status: Integer = 0; ErrMsg: TString = ''; begin PWait (PExecute ('foo', PCStrings (@Arguments), ErrMsg, PExecute_One), Status, 0); WriteLn (Status, ' ', ErrMsg) end. The output should be: bar "bar" 0 Frank -- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/, 7977168E GPC To-Do list, latest features, fixed bugs: http://www.gnu-pascal.de/todo.html GPC download signing key: 51FF C1F0 1A77 C6C2 4482 4DDC 117A 9773 7F88 1707