aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/StringUtil.cc13
-rw-r--r--src/StringUtil.hh1
2 files changed, 14 insertions, 0 deletions
diff --git a/src/StringUtil.cc b/src/StringUtil.cc
index dabc02e..6d4a582 100644
--- a/src/StringUtil.cc
+++ b/src/StringUtil.cc
@@ -35,6 +35,19 @@ char *StringUtil::strdup(const char *s) {
35 return n; 35 return n;
36} 36}
37 37
38//------- strcasestr --------------
39// TODO: comment this
40//---------------------------------
41const char * StringUtil::strcasestr(const char *str, const char *ptn) {
42 const char *s2, *p2;
43 for( ; *str; str++) {
44 for(s2=str,p2=ptn; ; s2++,p2++) {
45 if (!*p2) return str;
46 if (toupper(*s2) != toupper(*p2)) break;
47 }
48 }
49 return 0;
50}
38 51
39//------------- expandFilename ---------------------- 52//------------- expandFilename ----------------------
40// if ~ then expand it to home of user 53// if ~ then expand it to home of user
diff --git a/src/StringUtil.hh b/src/StringUtil.hh
index e48b4dd..d9fda35 100644
--- a/src/StringUtil.hh
+++ b/src/StringUtil.hh
@@ -24,6 +24,7 @@
24struct StringUtil 24struct StringUtil
25{ 25{
26 static char *strdup(const char *); 26 static char *strdup(const char *);
27 static const char *strcasestr(const char *str, const char *ptn);
27 static char *expandFilename(const char *filename); 28 static char *expandFilename(const char *filename);
28}; 29};
29 30