Jackeagle | a3ae16b | 2018-12-04 11:30:49 -0500 | [diff] [blame^] | 1 | From 602f7828e34cbc4363a337f3babba30a3496e2e4 Mon Sep 17 00:00:00 2001 |
Jon West | 013ef58 | 2018-08-21 20:45:26 -0400 | [diff] [blame] | 2 | From: Pierre-Hugues Husson <phh@phh.me> |
| 3 | Date: Tue, 12 Jun 2018 22:55:32 +0200 |
Jackeagle | a3ae16b | 2018-12-04 11:30:49 -0500 | [diff] [blame^] | 4 | Subject: [PATCH 09/24] property-matching RROs: allow to prefix the value with |
Jon West | 013ef58 | 2018-08-21 20:45:26 -0400 | [diff] [blame] | 5 | + to do glob match instead of exact match |
| 6 | |
| 7 | --- |
| 8 | cmds/idmap/scan.cpp | 5 +++++ |
| 9 | 1 file changed, 5 insertions(+) |
| 10 | |
| 11 | diff --git a/cmds/idmap/scan.cpp b/cmds/idmap/scan.cpp |
Jackeagle | d3ba228 | 2018-11-17 20:49:22 -0700 | [diff] [blame] | 12 | index d69dd79555a..2be6d23ac78 100644 |
Jon West | 013ef58 | 2018-08-21 20:45:26 -0400 | [diff] [blame] | 13 | --- a/cmds/idmap/scan.cpp |
| 14 | +++ b/cmds/idmap/scan.cpp |
| 15 | @@ -1,5 +1,6 @@ |
| 16 | #include <dirent.h> |
| 17 | #include <inttypes.h> |
| 18 | +#include <fnmatch.h> |
| 19 | #include <sys/file.h> |
| 20 | #include <sys/stat.h> |
| 21 | |
| 22 | @@ -92,6 +93,10 @@ namespace { |
| 23 | property_get(prop, propBuf, NULL); |
| 24 | val = strndup16to8(value.string(), value.size()); |
| 25 | |
| 26 | + if(val[0]=='+') { |
| 27 | + return fnmatch(val+1, propBuf, 0) != 0; |
| 28 | + } |
| 29 | + |
| 30 | return (strcmp(propBuf, val) == 0); |
| 31 | } |
| 32 | |
| 33 | -- |
Jackeagle | d3ba228 | 2018-11-17 20:49:22 -0700 | [diff] [blame] | 34 | 2.17.1 |
Jon West | 013ef58 | 2018-08-21 20:45:26 -0400 | [diff] [blame] | 35 | |