Moved strcasestr to StringUtil

This commit is contained in:
fluxgen 2002-01-06 13:36:34 +00:00
parent 2f82ecd85d
commit 4d27bb40ca

View file

@ -57,6 +57,7 @@
#include "i18n.hh" #include "i18n.hh"
#include "Basemenu.hh" #include "Basemenu.hh"
#include "fluxbox.hh" #include "fluxbox.hh"
#include "StringUtil.hh"
#include <X11/Xresource.h> #include <X11/Xresource.h>
#include <stdio.h> #include <stdio.h>
@ -67,21 +68,6 @@
# define FONT_ELEMENT_SIZE 50 # define FONT_ELEMENT_SIZE 50
#endif // FONT_ELEMENT_SIZE #endif // FONT_ELEMENT_SIZE
#ifndef HAVE_STRCASESTR
const char * strcasestr(const char *str, const char *ptn) {
const char *s2, *p2;
for( ; *str; str++) {
for(s2=str,p2=ptn; ; s2++,p2++) {
if (!*p2) return str;
if (toupper(*s2) != toupper(*p2)) break;
}
}
return NULL;
}
#endif
Theme::Theme(Display *display, Window rootwindow, Colormap colormap, int screennum, BImageControl *ic, const char *filename) { Theme::Theme(Display *display, Window rootwindow, Colormap colormap, int screennum, BImageControl *ic, const char *filename) {
m_screennum = screennum; m_screennum = screennum;
@ -1161,7 +1147,7 @@ const char *Theme::getFontElement(const char *pattern, char *buf, int bufsiz, ..
buf[bufsiz-1] = 0; buf[bufsiz-1] = 0;
buf[bufsiz-2] = '*'; buf[bufsiz-2] = '*';
while((v = va_arg(va, char *)) != NULL) { while((v = va_arg(va, char *)) != NULL) {
p = strcasestr(pattern, v); p = StringUtil::strcasestr(pattern, v);
if (p) { if (p) {
strncpy(buf, p+1, bufsiz-2); strncpy(buf, p+1, bufsiz-2);
p2 = strchr(buf, '-'); p2 = strchr(buf, '-');