Paul Kelly wrote: > >> In Firefox and Lynx browsers the ".execute" part of > >> "db.execute" is missing above the module description. It > >> also not there in "man db.execute" output. > > > [...] > > G_parser() does: > > > > G_basename(tmp_name, "exe"); > > Oops - that was an oversight on my part. > > > G_basename() is described thus: > > > > * \fn char * G_basename (char *filename, const char *desired_ext) > > * > > * \brief Truncates filename to the base part (before the last '.') > > * if it matches the extension, otherwise leaves it unchanged. > > > > But it actually only checks if the specified extension is a prefix of > > the actual extension rather than a complete match. > > The reason for that was so that e.g. "tif" can match .tif and .tiff and > other usage cases like that. The original usage for G_basename() was > checking the output filename for r.out.tiff so it could decide if it > should add an extension or not. > > > Suggested fix (untested): > > > > char * G_basename(char *filename, const char *desired_ext) > > { > > /* Find the last . in the filename */ > > char *dot = strrchr(filename, '.'); > > > > if (dot && G_strcasecmp(dot + 1, desired_ext) == 0) > > *dot = '\0'; > > > > return filename; > > } > > That would break the way it is used in r.out.tiff in some circumstances. > I'm thinking it might be easier to conditionalise its use in G_parser() > and G_set_program_name() on __MINGW32__ as its only purpose there is to > strip out the .exe executable extension on Windows? > > Maybe there should be two functions though. Or maybe stripping out the > .exe is quite simple and it doesn't need to use G_basename()? > > If noone else has fixed this yet I'll try and get to it fairly soon.
I suggest fixing G_basename() as above; the current behaviour is counter-intuitive and undesirable in most cases. r.out.tiff should check for .tif and .tiff separately. This isn't just a matter of being able to use G_basename() for other purposes. r.out.tiff shouldn't treat anything other than .tif or .tiff (modulo case) as a TIFF extension; cf. "area.around.Tifton_GA". -- Glynn Clements <[EMAIL PROTECTED]> _______________________________________________ grass-dev mailing list grass-dev@grass.itc.it http://grass.itc.it/mailman/listinfo/grass-dev