summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2016-11-11 10:21:10 -0800
committerAndreas Schneider <asn@cryptomilk.org>2016-11-16 12:41:09 +0100
commitb7a4210e283fdadb46fa0d1142958d5e0f7fd2fa (patch)
tree49e24d44fbd9cd5b200c80dd6f5c0919976700a6
parent08d1ac0e36339e97e4464f6a6724464b0a568347 (diff)
downloadsamba-b7a4210e283fdadb46fa0d1142958d5e0f7fd2fa.tar.gz
s3: lib - Fix formatting of unix_wild_match() sub-function to README.Coding standards.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12419 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
-rw-r--r--source3/lib/util.c61
1 files changed, 41 insertions, 20 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index bab399824bf..1af05cd0df8 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -1804,28 +1804,35 @@ static bool unix_do_match(const char *regexp, const char *str)
case '*':
/*
- * Look for a character matching
+ * Look for a character matching
* the one after the '*'.
*/
p++;
- if(!*p)
+ if(!*p) {
return true; /* Automatic match */
+ }
while(*str) {
- while(*str && (*p != *str))
+ while(*str && (*p != *str)) {
str++;
+ }
/*
- * Patch from weidel@multichart.de. In the case of the regexp
- * '*XX*' we want to ensure there are at least 2 'X' characters
- * in the string after the '*' for a match to be made.
+ * Patch from weidel@multichart.de.
+ * In the case of the regexp
+ * '*XX*' we want to ensure there are
+ * at least 2 'X' characters in the
+ * string after the '*' for a match to
+ * be made.
*/
{
int matchcount=0;
/*
- * Eat all the characters that match, but count how many there were.
+ * Eat all the characters that
+ * match, but count how many
+ * there were.
*/
while(*str && (*p == *str)) {
@@ -1834,54 +1841,68 @@ static bool unix_do_match(const char *regexp, const char *str)
}
/*
- * Now check that if the regexp had n identical characters that
- * matchcount had at least that many matches.
+ * Now check that if the regexp
+ * had n identical characters
+ * that matchcount had at least
+ * that many matches.
*/
- while ( *(p+1) && (*(p+1) == *p)) {
+ while (*(p+1) && (*(p+1)==*p)) {
p++;
matchcount--;
}
- if ( matchcount <= 0 )
+ if ( matchcount <= 0 ) {
return false;
+ }
}
- str--; /* We've eaten the match char after the '*' */
+ /*
+ * We've eaten the match char
+ * after the '*'
+ */
+ str--;
- if(unix_do_match(p, str))
+ if(unix_do_match(p, str)) {
return true;
+ }
- if(!*str)
+ if(!*str) {
return false;
- else
+ } else {
str++;
+ }
}
return false;
default:
- if(*str != *p)
+ if(*str != *p) {
return false;
+ }
str++;
p++;
break;
}
}
- if(!*p && !*str)
+ if(!*p && !*str) {
return true;
+ }
- if (!*p && str[0] == '.' && str[1] == 0)
+ if (!*p && str[0] == '.' && str[1] == 0) {
return true;
+ }
if (!*str && *p == '?') {
- while (*p == '?')
+ while (*p == '?') {
p++;
+ }
return(!*p);
}
- if(!*str && (*p == '*' && p[1] == '\0'))
+ if(!*str && (*p == '*' && p[1] == '\0')) {
return true;
+ }
return false;
}