diff options
author | Csaba Henk <csaba@gluster.com> | 2010-09-15 08:11:15 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-09-16 23:07:27 -0700 |
commit | 63ec13f022ae99c1664fbdbc9e6623903ba843af (patch) | |
tree | fdde04563f5081e4322c0bf75541631293100fd8 /libglusterfs | |
parent | 47bc630dca589235d7c10e2748cebaa5e419d5d7 (diff) |
cli: add a simplistic option parser, convert "mode script" to "--mode=script"
Signed-off-by: Csaba Henk <csaba@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1570 (geosync related changes)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1570
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/common-utils.c | 13 | ||||
-rw-r--r-- | libglusterfs/src/common-utils.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index f3386fe2b..022fdf355 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -1548,3 +1548,16 @@ out: return ret; } + +char * +strtail (char *str, const char *pattern) +{ + int i = 0; + + for (i = 0; str[i] == pattern[i] && str[i]; i++); + + if (pattern[i] == '\0') + return str + i; + + return NULL; +} diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index 54f52a5a0..293e6b880 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -331,5 +331,6 @@ int log_base2 (unsigned long x); int gf_system (const char *command); int get_checksum_for_path (char *path, uint32_t *checksum); +char *strtail (char *str, const char *pattern); #endif /* _COMMON_UTILS_H */ |