[gnome-commander/gcmd-1-2-8] Added gnome_cmd_filter_fnmatch() function
- From: Piotr Eljasiak <epiotr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander/gcmd-1-2-8] Added gnome_cmd_filter_fnmatch() function
- Date: Wed, 29 Sep 2010 17:58:08 +0000 (UTC)
commit a62ac273b15a736b46a5fabe00169cdb2343d940
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Wed Sep 29 19:55:27 2010 +0200
Added gnome_cmd_filter_fnmatch() function
src/filter.cc | 2 --
src/filter.h | 10 ++++++++++
2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/filter.cc b/src/filter.cc
index afecd10..0fd0563 100644
--- a/src/filter.cc
+++ b/src/filter.cc
@@ -20,8 +20,6 @@
#include <config.h>
#include <sys/types.h>
-#include <regex.h>
-#include <fnmatch.h>
#include "gnome-cmd-includes.h"
#include "filter.h"
diff --git a/src/filter.h b/src/filter.h
index 23187b1..6d53efa 100644
--- a/src/filter.h
+++ b/src/filter.h
@@ -21,6 +21,7 @@
#ifndef __FILTER_H__
#define __FILTER_H__
+#include <fnmatch.h>
#include <regex.h>
@@ -43,4 +44,13 @@ struct Filter
gboolean match(const gchar *text);
};
+inline gboolean gnome_cmd_filter_fnmatch (const gchar *pattern, const gchar *string, gboolean case_sens)
+{
+#ifdef FNM_CASEFOLD
+ return pattern && string && fnmatch (pattern, string, case_sens ? FNM_NOESCAPE|FNM_CASEFOLD : FNM_NOESCAPE)==0;
+#else
+ return pattern && string && fnmatch (pattern, string, FNM_NOESCAPE) == 0;
+#endif
+}
+
#endif // __FILTER_H__
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]