[GRASS-dev] Re: [GRASS-SVN] r33171 - in grass/trunk: lib/gis raster/r.colors

Glynn Clements glynn at gclements.plus.com
Fri Sep 12 20:36:23 EDT 2008


Markus Neteler wrote:

> Related wish: could the list be printed in alphabetical order?
> While the colors.desc file is ordered, the help text is no more:

The rules are almost ordered; the only exception is that the "special"
rules (those which are coded rather than read from etc/colors/*, i.e. 
random, grey.eq, grey.log and rules) are listed last.

If you want to re-sort the list after those are added:

	static int cmp_names(const void *aa, const void *bb)
	{
	    char *const *a = (char *const *)aa;
	    char *const *b = (char *const *)bb;
	
	    return strcmp(*a, *b);
	}

	static void scan_rules(void)
	{
	...
	    qsort(rules, nrules, sizeof(char *), cmp_names);
	}

Personally, I would be inclined to leave the special rules at the end.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list