diff -ru yapet-0.4.bak/config.h.in yapet-0.4/config.h.in --- yapet-0.4.bak/config.h.in 2009-07-11 21:36:43.000000000 +0200 +++ yapet-0.4/config.h.in 2009-07-19 12:35:07.716663451 +0200 @@ -60,6 +60,9 @@ /* Set to 1 if you have openssl/crypto.h */ #undef HAVE_CRYPTO_H +/* Define to 1 if you have the header file. */ +#undef HAVE_CTYPE_H + /* Set to 1 if you have curses.h */ #undef HAVE_CURSES_H @@ -327,12 +330,18 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H +/* Define to 1 if you have the `strlen' function. */ +#undef HAVE_STRLEN + /* Define to 1 if you have the `strncasecmp' function. */ #undef HAVE_STRNCASECMP /* Define to 1 if you have the `strncmp' function. */ #undef HAVE_STRNCMP +/* Define to 1 if you have the `strncpy' function. */ +#undef HAVE_STRNCPY + /* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR @@ -366,6 +375,9 @@ /* Define to 1 if you have the `termname' function. */ #undef HAVE_TERMNAME +/* Define to 1 if you have the `tolower' function. */ +#undef HAVE_TOLOWER + /* Define to 1 if you have the `tsearch' function. */ #undef HAVE_TSEARCH diff -ru yapet-0.4.bak/configure yapet-0.4/configure --- yapet-0.4.bak/configure 2009-07-11 21:34:37.000000000 +0200 +++ yapet-0.4/configure 2009-07-19 12:33:13.644663518 +0200 @@ -5652,7 +5652,8 @@ -for ac_header in stdio.h fcntl.h strings.h string.h unistd.h limits.h sys/param.h sys/resource.h errno.h getopt.h signal.h locale.h pwd.h termios.h + +for ac_header in ctype.h errno.h fcntl.h getopt.h limits.h locale.h pwd.h signal.h stdio.h string.h strings.h sys/param.h sys/resource.h termios.h unistd.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then @@ -6388,7 +6389,7 @@ -for ac_header in list exception stdexcept string iostream algorithm iterator memory functional fstream sstream vector +for ac_header in algorithm exception fstream functional iostream iterator list memory sstream stdexcept string vector do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then @@ -7536,7 +7537,10 @@ -for ac_func in memset strerror strcmp strncmp strncasecmp strcasestr strstr getcwd pathconf setrlimit getopt getopt_long rename sigaction asctime localtime fflush fprintf fstat getuid fchmod fchown access getenv getpwuid tcgetattr tcsetattr + + + +for ac_func in access asctime fchmod fchown fflush fprintf fstat getcwd getenv getopt getopt_long getpwuid getuid localtime memset pathconf rename setrlimit sigaction strcasestr strcmp strerror strlen strncasecmp strncmp strncpy strstr tcgetattr tcsetattr tolower do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 diff -ru yapet-0.4.bak/configure.ac yapet-0.4/configure.ac --- yapet-0.4.bak/configure.ac 2009-07-11 21:26:00.000000000 +0200 +++ yapet-0.4/configure.ac 2009-07-19 12:31:28.044663476 +0200 @@ -83,7 +83,7 @@ # Headers AC_MSG_NOTICE([Checking C headers]) -AC_CHECK_HEADERS([stdio.h fcntl.h strings.h string.h unistd.h limits.h sys/param.h sys/resource.h errno.h getopt.h signal.h locale.h pwd.h termios.h]) +AC_CHECK_HEADERS([ctype.h errno.h fcntl.h getopt.h limits.h locale.h pwd.h signal.h stdio.h string.h strings.h sys/param.h sys/resource.h termios.h unistd.h]) AC_CHECK_HEADER([ncurses.h], [AC_DEFINE([HAVE_NCURSES_H],[1],[Set to 1 if you have ncurses.h]) my_usencurses=yes], @@ -95,7 +95,7 @@ AC_CHECK_HEADER([openssl/evp.h], [], AC_MSG_ERROR([OpenSSL evp header not found])) AC_MSG_NOTICE([Checking C++ headers]) -AC_CHECK_HEADERS([list exception stdexcept string iostream algorithm iterator memory functional fstream sstream vector], +AC_CHECK_HEADERS([algorithm exception fstream functional iostream iterator list memory sstream stdexcept string vector], [], [AC_MSG_ERROR([your system is missing a required C++ header file])]) @@ -111,7 +111,7 @@ # library functions AC_MSG_NOTICE([Checking functions]) AC_FUNC_ALLOCA -AC_CHECK_FUNCS([memset strerror strcmp strncmp strncasecmp strcasestr strstr getcwd pathconf setrlimit getopt getopt_long rename sigaction asctime localtime fflush fprintf fstat getuid fchmod fchown access getenv getpwuid tcgetattr tcsetattr]) +AC_CHECK_FUNCS([access asctime fchmod fchown fflush fprintf fstat getcwd getenv getopt getopt_long getpwuid getuid localtime memset pathconf rename setrlimit sigaction strcasestr strcmp strerror strlen strncasecmp strncmp strncpy strstr tcgetattr tcsetattr tolower]) AC_MSG_NOTICE([Checking (n)curses functions]) AC_CHECK_FUNCS([wresize mvwchgat termname]) diff -ru yapet-0.4.bak/ui/listwidget.h yapet-0.4/ui/listwidget.h --- yapet-0.4.bak/ui/listwidget.h 2009-07-05 13:39:02.000000000 +0200 +++ yapet-0.4/ui/listwidget.h 2009-07-19 12:37:53.100724284 +0200 @@ -38,6 +38,10 @@ #endif // HAVE_NCURSES_H #include "curswa.h" // Leave this here. It depends on the above includes. +#ifdef HAVE_CTYPE_H +# include +#endif + #ifdef HAVE_FUNCTIONAL # include #endif @@ -111,7 +115,30 @@ #ifdef HAVE_STRCASESTR ptr = strcasestr(item.c_str(), searchterm); #elif HAVE_STRSTR +# ifdef HAVE_TOLOWER + // Prepare the haystack + size_t haystack_len = strlen(item.c_str())+1; + char* haystack = new char[haystack_len]; + strncpy(haystack, item.c_str(), haystack_len); + for (size_t i=0; i < haystack_len; haystack[i] = (char)tolower(haystack[i]), i++); + + // Prepare needle + size_t needle_len = strlen(searchterm)+1; + char* needle = new char[needle_len]; + strncpy(needle, searchterm, needle_len); + for (size_t i=0; i < needle_len; needle[i] = (char)tolower(needle[i]), i++); + + // Now do the search + ptr = strstr(haystack, needle); + + // Destroy that properly + memset((void*)haystack, 0, haystack_len); + memset((void*)needle, 0, needle_len); + delete []haystack; + delete []needle; +# else ptr = strstr(item.c_str(), searchterm); +# endif // HAVE_TOLOWER #else # error "Sorry, neither strcasestr() nor strstr() found" #endif diff -ru yapet-0.4.bak/yapet/searchdialog.cc yapet-0.4/yapet/searchdialog.cc --- yapet-0.4.bak/yapet/searchdialog.cc 2009-07-05 15:23:32.000000000 +0200 +++ yapet-0.4/yapet/searchdialog.cc 2009-07-19 12:18:16.436683727 +0200 @@ -140,7 +140,11 @@ #ifdef HAVE_STRCASESTR retval = mymvwaddstr(window, 1, 1, _("Please enter the search term")); #else +# ifdef HAVE_TOLOWER + retval = mymvwaddstr(window, 1, 1, _("Please enter the search term")); +# else retval = mymvwaddstr(window, 1, 1, _("Please enter the search term (case-sensitive)")); +# endif // HAVE_TOLOWER #endif if (retval == ERR) throw YAPETUI::UIException(_("Error setting label"));