[GRASS-dev] [bug #4628] (grass) r.out.tiff: check for .tif.tif

Hamish hamish_nospam at yahoo.com
Mon Jun 19 20:18:31 EDT 2006


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.

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?


Hamish




More information about the grass-dev mailing list