diff options
author | fluxgen <fluxgen> | 2002-01-06 13:35:28 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-01-06 13:35:28 (GMT) |
commit | 2f82ecd85d70d022bedab2d0844198a14cb40f2d (patch) | |
tree | 7261b346cb843969546b593b1fb80f9cf569cc85 /src | |
parent | e215fc40c9216a6a320b55a78d94854289bc7a72 (diff) | |
download | fluxbox_pavel-2f82ecd85d70d022bedab2d0844198a14cb40f2d.zip fluxbox_pavel-2f82ecd85d70d022bedab2d0844198a14cb40f2d.tar.bz2 |
Added strcasestr
Diffstat (limited to 'src')
-rw-r--r-- | src/StringUtil.cc | 13 | ||||
-rw-r--r-- | src/StringUtil.hh | 1 |
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 | //--------------------------------- | ||
41 | const 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 @@ | |||
24 | struct StringUtil | 24 | struct 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 | ||