[Fwd: Re: [GRASS-dev] r.colors: rules file list unsorted]

Hamish hamish_nospam at yahoo.com
Sun Jan 28 16:18:22 EST 2007


Wolf Bergenheim wrote:
> It uses scandir() to sort the directory entries alphabetically. I'm
> not 100% sure scandir can be found on all platforms in which case we
> need to do something, like qsort() the names list instead.


from the scandir(3) man page:

CONFORMING TO
       None of these functions is in  POSIX.   LSB  has  deprecated  the
       library call alphasort() and never contained scandir().

       The  functions  scandir()  and  alphasort() are from BSD 4.3, and
       have been available under Linux since libc4.  Libc4 and libc5 use
       the more precise prototype

       int alphasort(const struct dirent **a, const struct dirent **b);

       but glibc 2.0 returns to the imprecise BSD prototype.

       The  function  versionsort()  is a GNU extension, available since
       glibc 2.1.  Since glibc 2.1, alphasort() calls  strcoll(3);  ear-
       lier it used strcmp(3).



.. a POSIX compliant solution would be nice,

Hamish




More information about the grass-dev mailing list