[GRASS-SVN] r34405 - in grass/trunk: include lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Nov 20 11:40:00 EST 2008


Author: glynn
Date: 2008-11-20 11:40:00 -0500 (Thu, 20 Nov 2008)
New Revision: 34405

Modified:
   grass/trunk/include/gisdefs.h
   grass/trunk/lib/gis/ls.c
Log:
Add G_set_ls_exclude_filter()


Modified: grass/trunk/include/gisdefs.h
===================================================================
--- grass/trunk/include/gisdefs.h	2008-11-20 16:35:12 UTC (rev 34404)
+++ grass/trunk/include/gisdefs.h	2008-11-20 16:40:00 UTC (rev 34405)
@@ -707,6 +707,7 @@
 
 /* ls.c */
 void G_set_ls_filter(int (*)(const char *, void *), void *);
+void G_set_ls_exclude_filter(int (*)(const char *, void *), void *);
 char **G__ls(const char *, int *);
 void G_ls(const char *, FILE *);
 void G_ls_format(char **, int, int, FILE *);

Modified: grass/trunk/lib/gis/ls.c
===================================================================
--- grass/trunk/lib/gis/ls.c	2008-11-20 16:35:12 UTC (rev 34404)
+++ grass/trunk/lib/gis/ls.c	2008-11-20 16:40:00 UTC (rev 34405)
@@ -33,6 +33,9 @@
 static ls_filter_func *ls_filter;
 static void *ls_closure;
 
+static ls_filter_func *ls_ex_filter;
+static void *ls_ex_closure;
+
 static int cmp_names(const void *aa, const void *bb)
 {
     char *const *a = (char *const *)aa;
@@ -60,6 +63,12 @@
     ls_closure = closure;
 }
 
+void G_set_ls_exclude_filter(ls_filter_func *func, void *closure)
+{
+    ls_ex_filter = func;
+    ls_ex_closure = closure;
+}
+
 /**
  * \brief Stores a sorted directory listing in an array
  * 
@@ -91,6 +100,8 @@
 	    continue;
 	if (ls_filter && !(*ls_filter)(dp->d_name, ls_closure))
 	    continue;
+	if (ls_ex_filter && (*ls_ex_filter)(dp->d_name, ls_ex_closure))
+	    continue;
 	dir_listing = (char **)G_realloc(dir_listing, (1 + n) * sizeof(char *));
 	dir_listing[n] = G_store(dp->d_name);
 	n++;



More information about the grass-commit mailing list