[GRASS-SVN] r44135 - grass/branches/releasebranch_6_4/raster/r.colors

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Nov 1 03:33:57 EDT 2010


Author: martinl
Date: 2010-11-01 00:33:57 -0700 (Mon, 01 Nov 2010)
New Revision: 44135

Modified:
   grass/branches/releasebranch_6_4/raster/r.colors/main.c
Log:
r.colors: sort table names


Modified: grass/branches/releasebranch_6_4/raster/r.colors/main.c
===================================================================
--- grass/branches/releasebranch_6_4/raster/r.colors/main.c	2010-11-01 07:30:41 UTC (rev 44134)
+++ grass/branches/releasebranch_6_4/raster/r.colors/main.c	2010-11-01 07:33:57 UTC (rev 44135)
@@ -32,6 +32,14 @@
 static char **rules;
 static int nrules;
 
+static int cmp(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)
 {
     char path[GPATH_MAX];
@@ -46,6 +54,8 @@
     rules[nrules++] = G_store("grey.eq");
     rules[nrules++] = G_store("grey.log");
     rules[nrules++] = G_store("rules");
+
+    qsort(rules, nrules, sizeof(char *), cmp);
 }
 
 static char *rules_list(void)



More information about the grass-commit mailing list