[GRASS-dev] [bug #4628] (grass) r.out.tiff: check for .tif.tif
Brad Douglas
rez at touchofmadness.com
Mon Jun 19 21:02:59 EDT 2006
On Tue, 2006-06-20 at 12:18 +1200, Hamish wrote:
> H:
> > > anyone have a simple C replacement for `basename $file .tif`?
> P:
> > Sounds like it would be useful as a library function. I wrote the
> > following which seems to work, but could do with more testing:
> ..
> > char * G_basename(char *filename, char *desired_ext)
> ..
> > if( strncasecmp(ext, desired_ext, strlen(desired_ext)) == 0 )
>
> Is strncasecmp() portable? man page says "only" BSD 4.4 compliant.
Yes, it's BSD and not to our definition of portable. Please use
G_strcasecmp().
> Is it better to use G_tolcase() or G_str_to_lower() first? [I just
> noticed those were duplicates. We should consolidate. G_str_to_lower()
> is only 2 months old so the obvious choice for removal, but it does
> have a better name.]
>
> lib/gis/mapcase.c
> lib/gis/strings.c
>
> oh, I see in lib/gis/strings.c we have a G_strcasecmp().
:-)
> We still should merge G_tolcase() and G_str_to_lower() though.
>
> I see lib/gis/mapcase.c defines tolower() and toupper(). As those are
> both standard ANSI C fns, they are redundant and should be removed?
Yeah, it appears that G_to[u|l]case() are redundant. swig uses
G_tolcase(), but I don't see why it couldn't be replaced with
G_str_to_lower().
--
Brad Douglas <rez touchofmadness com> KB8UYR
Address: 37.493,-121.924 / WGS84 National Map Corps #TNMC-3785
More information about the grass-dev
mailing list