[GRASS-dev] Re: [bug #5218] (grass) wingrass: creating new location from startup screen with projection values fails

Moritz Lennert mlennert at club.worldonline.be
Wed Oct 25 04:52:24 EDT 2006


Glynn Clements wrote:
> Moritz Lennert wrote:
> 
>> So, IIUC, this should work with cmd.exe which allows pdcurses code, but
>> it doesn't and fails with:
>>
>>> The procedure crashes after entering
> 
>>> the one-line description of the new location with an error
>>> message: "the syntax of the command is not correct. LOCATION (test)
>>> NOT created" (translated from French).
>> So, if this is not a pdcurses issue, what could be the problem ?
> 
> make_location() uses system() with Unix commands:
> 
>     sprintf (buf, "mkdir '%s'/'%s'", gisdbase, location_name);
>     if(system(buf)) return 0;
>     sprintf (buf, "mkdir '%s'/'%s'/'%s'", gisdbase, location_name, mapset);
>     if(system(buf)) return 0;
> 
> [snip]
> 
>     sprintf (buf, "echo '%s' >  '%s'/'%s'/'%s'/MYNAME", myname, gisdbase, location_name, mapset);
>     system(buf);
> 
> On a native Windows version, system() will use cmd.exe to execute
> commands, not /bin/sh.
> 
> Windows has native versions of mkdir and echo. The native mkdir won't
> like being passed Unix filenames, as it treats / as indicating
> options:
> 
> 	C:\>mkdir /foo
> 	The syntax of the command is incorrect.
> 
> Fortunately, this bug shoud be quite simple to fix: use the mkdir()
> function rather than using system() to run the mkdir command. Could
> someone try the attached patch?

I am more than willing to do more extensive testing and also to work on 
some of the system calls you mention, but I what do I need for native 
compilation ? Or cross-compilation on debian for windows (never compiled 
anything on windows in my life ;-) ) ?

I will be very busy in the next 10 days, but after that I should have 
substantially more time for GRASS.

Moritz




More information about the grass-dev mailing list