w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit 9a0350485ca910a93e05773b83be6795d7ffe789
parent 8c6e55bc7455841924b1963d68a6e64569adedf3
Author: ukai <ukai>
Date:   Mon, 26 Nov 2001 09:01:08 +0000

[w3m-dev 02555]
From: Fumitoshi UKAI <ukai@debian.or.jp>

Diffstat:
MChangeLog | 11+++++++++++
Mconfigure | 19+++++++++++++++++++
Mfm.h | 2++
Mindep.c | 8++++++--
Mindep.h | 5++++-
5 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,14 @@ +2001-11-26 Fumitoshi UKAI <ukai@debian.or.jp> + + * [w3m-dev 02555] + * configure: check strcasestr + * fm.h (_GNU_SOURCE): requires for strcasestr() + * indep.c (strcasestr): #ifdef HAVE_STRCASESTR + * indep.c (strcasestr): check whether s2 is NULL + * indep.h: add #include "config.h" + * indep.h: #ifdef HAVE_STRCASESTR + * indep.h: strcasestr() takes const char * + 2001-11-26 Yoshinobu Sakane <sakane@d4.bsd.nes.nec.co.jp> * [w3m-dev 02553] diff --git a/configure b/configure @@ -1098,6 +1098,24 @@ else def_have_strcasecmp="#undef HAVE_STRCASECMP" fi +####### strcasestr +cat > _zmachdep.c << EOF +#include <string.h> +main() +{ + int i; + i = strcasestr("abc","def"); +} +EOF +if $cc $cflags -o _zmachdep _zmachdep.c > /dev/null 2>&1 +then + echo "You have strcasestr()." + def_have_strcasestr="#define HAVE_STRCASESTR" +else + echo "You don't have strcasestr()." + def_have_strcasestr="#undef HAVE_STRCASESTR" +fi + ####### strchr cat > _zmachdep.c << EOF #include <string.h> @@ -1945,6 +1963,7 @@ $def_use_binstream $def_term_if $def_dir_if $def_have_strcasecmp +$def_have_strcasestr $def_have_strchr $def_have_strerror $def_have_syserrlist diff --git a/fm.h b/fm.h @@ -10,6 +10,8 @@ #ifndef FM_H #define FM_H +#define _GNU_SOURCE /* strcasestr() */ + #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/indep.c b/indep.c @@ -169,21 +169,25 @@ expandPath(char *name) return extpath->ptr; } +#ifndef HAVE_STRCASESTR /* string search using the simplest algorithm */ char * -strcasestr(char *s1, char *s2) +strcasestr(const char *s1, const char *s2) { int len1, len2; + if (s2 == NULL) + return (char *)s1; len1 = strlen(s1); len2 = strlen(s2); while (*s1 && len1 >= len2) { if (strncasecmp(s1, s2, len2) == 0) - return s1; + return (char *)s1; s1++; len1--; } return 0; } +#endif static int strcasematch(char *s1, char *s2) diff --git a/indep.h b/indep.h @@ -3,6 +3,7 @@ #define INDEP_H #include "gc.h" #include "Str.h" +#include "config.h" #ifndef TRUE #define TRUE 1 @@ -23,7 +24,9 @@ extern int strCmp(const void *s1, const void *s2); extern char *currentdir(void); extern char *cleanupName(char *name); extern char *expandPath(char *name); -extern char *strcasestr(char *s1, char *s2); +#ifndef HAVE_STRCASESTR +extern char *strcasestr(const char *s1, const char *s2); +#endif extern int strcasemstr(char *str, char *srch[], char **ret_ptr); extern char *remove_space(char *str); extern int non_null(char *s);