diff options
author | fluxgen <fluxgen> | 2002-11-26 20:04:15 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-11-26 20:04:15 (GMT) |
commit | a98bbe8e03233ce3388bf72b7ae19823dbc9fc09 (patch) | |
tree | e14d23e3f22ce03531a0be0ad4ce201742ed5e9a /src | |
parent | c6752ce211b140aa0817b1716db073dd05891cbf (diff) | |
download | fluxbox_paul-a98bbe8e03233ce3388bf72b7ae19823dbc9fc09.zip fluxbox_paul-a98bbe8e03233ce3388bf72b7ae19823dbc9fc09.tar.bz2 |
temp fix for strcasestr
Diffstat (limited to 'src')
-rw-r--r-- | src/FbTk/XmbFontImp.cc | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/FbTk/XmbFontImp.cc b/src/FbTk/XmbFontImp.cc index f0c323d..c9a87d0 100644 --- a/src/FbTk/XmbFontImp.cc +++ b/src/FbTk/XmbFontImp.cc | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: XmbFontImp.cc,v 1.1 2002/11/26 16:01:28 fluxgen Exp $ | 22 | // $Id: XmbFontImp.cc,v 1.2 2002/11/26 20:04:15 fluxgen Exp $ |
23 | 23 | ||
24 | #include "XmbFontImp.hh" | 24 | #include "XmbFontImp.hh" |
25 | 25 | ||
@@ -44,6 +44,23 @@ using namespace std; | |||
44 | 44 | ||
45 | namespace { | 45 | namespace { |
46 | 46 | ||
47 | #ifndef HAVE_STRCASESTR | ||
48 | // | ||
49 | // Tries to find a string in another and | ||
50 | // ignoring the case of the characters | ||
51 | // Returns 0 on success else pointer to str. | ||
52 | const char *strcasestr(const char *str, const char *ptn) { | ||
53 | const char *s2, *p2; | ||
54 | for( ; *str; str++) { | ||
55 | for(s2=str, p2=ptn; ; s2++,p2++) { | ||
56 | if (!*p2) return str; // check if we reached the end of ptn, if so, return str | ||
57 | if (toupper(*s2) != toupper(*p2)) break; // check if the chars match(ignoring case) | ||
58 | } | ||
59 | } | ||
60 | return 0; | ||
61 | } | ||
62 | #endif //HAVE_STRCASESTR | ||
63 | |||
47 | const char *getFontSize(const char *pattern, int *size) { | 64 | const char *getFontSize(const char *pattern, int *size) { |
48 | const char *p; | 65 | const char *p; |
49 | const char *p2=0; | 66 | const char *p2=0; |
@@ -80,7 +97,7 @@ const char *getFontElement(const char *pattern, char *buf, int bufsiz, ...) { | |||
80 | buf[bufsiz-1] = 0; | 97 | buf[bufsiz-1] = 0; |
81 | buf[bufsiz-2] = '*'; | 98 | buf[bufsiz-2] = '*'; |
82 | while((v = va_arg(va, char *)) != 0) { | 99 | while((v = va_arg(va, char *)) != 0) { |
83 | p = strcasestr(pattern, v); | 100 | p = ::strcasestr(pattern, v); |
84 | if (p) { | 101 | if (p) { |
85 | std::strncpy(buf, p+1, bufsiz-2); | 102 | std::strncpy(buf, p+1, bufsiz-2); |
86 | p2 = strchr(buf, '-'); | 103 | p2 = strchr(buf, '-'); |