summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorRajesh Amaravathi <rajesh@redhat.com>2012-01-04 13:06:29 +0530
committerVijay Bellur <vijay@gluster.com>2012-01-05 08:51:22 -0800
commit22282b4fb82b83621c15773c4c44ff3d28a82e3c (patch)
tree171d14928c4987755b18a5a15beef15645358e7c /libglusterfs
parentea275f8cfe8abf5877f67b21afb2c1e6e08f06b7 (diff)
lib/mount-broker: move utility functions to common-utils
functions skipwhite and nwstrtail have been moved from mount-broker to common-utils library for general use. Change-Id: I9cfefb28bbfcf5d0bd37e35865ff3f3b7923fc53 BUG: 765464 Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com> Reviewed-on: http://review.gluster.com/2560 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com> Reviewed-by: Csaba Henk <csaba@gluster.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/common-utils.c24
-rw-r--r--libglusterfs/src/common-utils.h2
2 files changed, 26 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 6a5e250..1d0fb82 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -1583,6 +1583,30 @@ strtail (char *str, const char *pattern)
return NULL;
}
+void
+skipwhite (char **s)
+{
+ while (isspace (**s))
+ (*s)++;
+}
+
+char *
+nwstrtail (char *str, char *pattern)
+{
+ for (;;) {
+ skipwhite (&str);
+ skipwhite (&pattern);
+
+ if (*str != *pattern || !*str)
+ break;
+
+ str++;
+ pattern++;
+ }
+
+ return *pattern ? NULL : str;
+}
+
/* RFC 1123 & 952 */
char
valid_host_name (char *address, int length)
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index a253e67..4cb3843 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -407,6 +407,8 @@ int log_base2 (unsigned long x);
int get_checksum_for_path (char *path, uint32_t *checksum);
char *strtail (char *str, const char *pattern);
+void skipwhite (char **s);
+char *nwstrtail (char *str, char *pattern);
char valid_host_name (char *address, int length);
char valid_ipv4_address (char *address, int length);