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

Hamish hamish_nospam at yahoo.com
Wed Oct 25 00:02:29 EDT 2006

Glynn Clements wrote:
> 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?
> Unfortunately, GRASS has a lot of this sort of stuff - using system()
> to run commands rather than using functions; probably because the
> author knew about the command but didn't know about the function. I've
> even seen system("rm ...") used to delete files.
> Finding (and fixing) all of the Unix-specific system() calls will be a
> large part of getting a native Windows version of GRASS to work.

here are some more:

lib/vask/V_init.c:    system("clear");  /* this is a kludge - xterm has problems
lib/fonts/for_grass/try.c:                      system ("cd fonts; ls *.hmp | sed 's/.hmp//' | fmt");
lib/fonts/for_grass/fontmap.c:  system ("cd ../fonts; ls *.hmp | sed 's/.hmp//' | fmt");
raster/r.out.mpeg/main.c:           sprintf(cmd, "cd %s; \\ls %s >> %s 2> /dev/null", 
visualization/xganim/main.c:        sprintf(cmd, "cd %s; \\ls %s >> %s 2> /dev/null", path, wildarg, tfile);
general/g.mapsets/main_cmd.c:           sprintf (command, "ls -C %s/%s 1>&2", G_gisdbase(), G_location());
general/g.mapsets/main_cmd.c:           sprintf (command, "ls -C %s/%s 1>&2", G_gisdbase(), G_location());
imagery/i.ortho.photo/photo.target/ask_target.c:    sprintf (buf, "ls -C %s\n", G_gisdbase());
imagery/i.ortho.photo/photo.target/ask_target.c:    sprintf (buf, "ls %s/%s", G_gisdbase(), G_location());
lib/init/set_data.c:    sprintf(buf, "ls -C '%s'", gisdbase) ;
lib/init/set_data.c:    sprintf (buf, "ls '%s'", location);


------- from previous post ----------

grass63$ grep -rI mkdir * | grep sprintf

gem/reg_entries.c:              sprintf ( str, "mkdir --verbose %s/etc/dm/gem-entries ; cp -vf ../entries-gisman %s/etc/dm/gem-entries/%s ; \
gem/reg_entries.c:              sprintf ( str, "mkdir %s/etc/dm/gem-entries &> %s ; cp -f ../entries-gisman %s/etc/dm/gem-entries/%s &> %s ; \
gem/reg_entries.c:              sprintf ( str, "mkdir --verbose -p %s/etc/gm/Xtns ; cp -fv ../entries-gisman2 %s/etc/gm/Xtns/%s.gem ; ", 
gem/reg_entries.c:              sprintf ( str, "mkdir -p %s/etc/gm/Xtns ; cp -f ../entries-gisman2 %s/etc/gm/Xtns/%s.gem ; ", 
lib/init/mke_loc.c:    sprintf (buf, "mkdir '%s'/'%s'", gisdbase, location_name);
lib/init/mke_loc.c:    sprintf (buf, "mkdir '%s'/'%s'/'%s'", gisdbase, location_name, mapset);
lib/init/mke_mapset.c:  sprintf(buffer,"mkdir '%s'/'%s'",location, mapset) ;

$ grep -rI mkdir * | grep system 

raster/r.le/r.le.setup/main.c:     G_system("mkdir r.le.para");
raster/r.le/r.le.patch/main.c:     G_system("mkdir r.le.out");
raster/r.le/r.le.pixel/main.c:     G_system("mkdir r.le.out");

More information about the grass-dev mailing list