[GRASS-dev] Re: testing native winGRASS
Moritz Lennert
mlennert at club.worldonline.be
Fri Mar 16 18:07:32 EDT 2007
On Wed, March 14, 2007 18:47, Glynn Clements wrote:
>
> Moritz Lennert wrote:
>
>> Paul Kelly wrote:
>> > but at the minute my mind has gone blank as to the portable way to
>> > replace that. I general audit of calls to system() would have caught
>> > that if we're able to get round to doing it I suppose.
>>
>> This might be priority to my testing via the GDF GRASS Tutorial, so I'll
>> try to do that first.
>>
>> Should all system calls be replaced by G_system ? Should any system /
>> G_sytem calls be avoided ? Or should we check which system() calls use
>> functions which might not exist in Windows ?
>
> Avoid system() and G_system() equally. G_system() is almost identical
> to system(), except that it appears to work around a signal handling
> bug in some ancient system() implementations. Ditto for G_popen().
I've done a first "audit" of system() and G_system() calls. The result is
attached.
One line for the call, the next for the line(s) defining the command that
is being called.
I left out most calls to GRASS modules, except for those where I felt that
there might be pathname issue. At this stage, I also left out all the
display/ and the image rectification modules which have been replaced by
georectify.
I don't have enough knowledge to decide what to do about each of them, but
I'm willing to work on this provided someone can guide me.
Moritz
P.S. Maybe we should put this list (or a revised version) in the wiki to
make it more permanent ?
-------------- next part --------------
general/g.mapset/main.c:135: ret = system ( buf ) ;
G_asprintf ( &buf, "%s %s/.gislock %s", lock_prog, mapset_new_path, gis_lock );
general/g.mapset/main.c:165: system( buf );
G_asprintf ( &buf, "/bin/sh -c \"%s/etc/clean_temp > /dev/null\"", G_gisbase() );
general/g.mapsets/main_cmd.c:91&126: system (command);
sprintf (command, "ls -C %s/%s 1>&2", G_gisdbase(), G_location());
general/g.mapsets/set_path.c:65: if (system (command) == 0)
strcpy (command, "g.mapsets -p mapset=") & other strcat calls
general/g.setproj/get_stp.c:198&315: G_system(buff);
sprintf(buff,"%s \"%s\" 1>&2", pager, G_convert_dirseps_to_host(Tmp_file1));
lib/g3d/g3dwindowio.c:226: if (access (path, 0) != 0) system (command);
strcpy (path = command, "mkdir ");
lib/gis/get_datum_name.c:83: G_system(buff);
sprintf(buff,"%s \"%s\" 1>&2",pager, G_convert_dirseps_to_host(Tmp_file));
lib/gis/get_ell_name.c:60: G_system(buff);
sprintf(buff,"%s \"%s\" 1>&2", pager, G_convert_dirseps_to_host(Tmp_file));
lib/gis/get_projname.c:74: G_system(buff);
sprintf(buff,"%s \"%s\" 1>&2", pager, G_convert_dirseps_to_host(Tmp_file));
lib/gis/gisbase.c:34: system (command);
sprintf (command, "%s/etc/sroff", G_gisbase( ) );
lib/gis/gishelp.c:55: system(buffer) ;
sprintf(buffer, "%%GRASS_PAGER%% %s", file) ; /*ifdef __MINGW32__*/
sprintf(buffer, "$GRASS_PAGER %s", file) ;/*else*/
lib/imagery/ls_groups.c:70&129: G_system(buf);
sprintf (buf, "$GRASS_PAGER %s", tempfile);
lib/init/mke_loc.c:179: system(buf);
sprintf (buf, "echo %s > \"%s/%s/%s/MYNAME\"", myname, gisdbase, location_name, mapset); & G_convert_dirseps_to_host(buf);
lib/proj/datum.c:300: G_system(buff);
sprintf(buff,"%s \"%s\" 1>&2", pager, G_convert_dirseps_to_host(Tmp_file));
lib/vask/V_clear.c:63: system("clear");
raster/r.average/main.c:94: if ((stat = system(command)))
sprintf (command, "%s -anC input=%s,%s fs=space > \"%s\"", STATS, basemap->answer, covermap->answer, tempfile1); & #define STATS "r.stats"
raster/r.average/main.c:154: stat = system(command);
sprintf (command, "%s input=%s output=%s < \"%s\"", RECODE, basemap->answer, outputmap->answer, tempfile2); & #define RECODE "r.recode"
raster/r.coin/inter.c:32: G_system("clear");
raster/r.coin/inter.c:51: G_system("clear");
raster/r.coin/inter.c:87: G_system(command);
sprintf(command,"$GRASS_PAGER %s",dumpname);
raster/r.coin/inter.c:108: G_system(command);
sprintf(command,"cp %s %s/%s",dumpname,G_home(),outname);
raster/r.coin/inter.c:130: G_system(command);
sprintf(command,"lpr %s",dumpname);
raster/r.kappa/stats.c:47: if (system(buf)) {
strcpy (buf, "r.stats -cin"); & many strcat() calles
lots in r.le/*, but all seem to be calls to GRASS modules, plus a series of G_system("clear") calls
raster/r.out.mpeg/main.c:82: if (256 == G_system("ppmtompeg 2> /dev/null"))
raster/r.out.mpeg/main.c:84: else if (256 == G_system("mpeg_encode 2> /dev/null"))
raster/r.out.mpeg/main.c:319: if (0 != G_system(cmd))
sprintf(cmd, "%s %s", encoder, mpfilename);
raster/r.out.mpeg/main.c:351: G_system(cmd);
sprintf(cmd, "cd %s; \\ls %s >> %s 2> /dev/null", path, wildarg, tfile);
raster/r.out.mpeg/main.c:377: G_system(cmd);
sprintf(cmd, "\\rm %s", tfile);
raster/r.out.mpeg/write.c:351&356: G_system(cmd);
sprintf(cmd, "\\rm %s", file);
raster/r.report/stats.c:48: if(system(buf))
strcpy (buf, "r.stats -acr"); & more calls to strcat
raster/r.statistics/o_average.c:30: if (stat = system(command))
sprintf (command, "%s -an input='%s,%s' fs=space > %s", STATS, basemap, covermap, tempfile1); & #define STATS "r.stats"
raster/r.statistics/o_average.c:70: stat = system(command);
sprintf (command, "%s input='%s' output='%s' < %s", RECLASS, basemap, outputmap, tempfile2); & #define RECLASS "r.reclass"
raster/r.statistics/o_sum.c:31: if (stat = system(command))
sprintf (command, "%s -cn input='%s,%s' fs=space > %s", STATS, basemap, covermap, tempfile1); & #define STATS "r.stats"
raster/r.statistics/o_sum.c:72: stat = system(command);
sprintf (command, "%s input='%s' output='%s' < %s", RECLASS, basemap, outputmap, tempfile2); & #define RECLASS "r.reclass"
raster/r.support/front/run.c:19: if ((stat = G_system(buf)))
G_snprintf(buf, sizeof(buf), "%s/etc/support/%s '%s'", G_gisbase(), pgm, rast);
raster/r.support/front/run.c:37: if ((stat = G_system(buf)))
G_snprintf(buf, sizeof(buf), "%s", pgm);
raster/r.support/modhead/check_un.c:63: G_system(command);
G_snprintf(command, sizeof(command), "$GRASS_PAGER %s", tempfile);
raster/r.topmodel/misc.c:10: if(G_system(cmd)){
where command can be one of a series of GRASS modules
raster/r.transect/main.c:135: exit (system(command));
sprintf (command, "r.profile %s input='%s' output='-' null='%s' profile=", coord_str, parms.map->answer, parms.null_str->answer); & more strcat() calls
raster/r.watershed/front/main.c:318: ret = system(command);
sprintf (command, "%s/etc/water/", G_gisbase()) ; & (strcat(command,"r.watershed.seg") || strcat(command,"r.watershed.ram") & more strcat() calls
raster/r.watershed/shed/main.c:36: if (G_system (input.com_line_ram)) {
raster/r.watershed/shed/main.c:40: if (G_system (input.com_line_seg)) {
raster/r.watershed/shed/main.c:47: } else if (G_system (input.com_line_seg)) {
vector/v.transform/creat_trans.c:66: G_system("clear") ;
visualization/nviz/src/do_zoom.c:169: if (system(cmd) != 0) {
strcpy(cmd, "pnmcat -lr "); & more strcat() calls
visualization/nviz/src/do_zoom.c:184: if (system(cmd2) != 0) {
strcpy(cmd2, "pnmcat -tb "); & more strcat() calls
visualization/xganim/main.c:512: system(cmd);
sprintf(cmd, "cd %s; \\ls %s >> %s 2> /dev/null", path, wildarg, tfile);
More information about the grass-dev
mailing list