aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ChangeLog11
-rwxr-xr-xconfigure21
-rw-r--r--fm.h4
-rw-r--r--indep.c10
-rw-r--r--indep.h7
5 files changed, 46 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index bf1107e..1692af4 100644
--- 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
index cf1b624..55cb939 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#!/bin/sh
-# $Id: configure,v 1.19 2001/11/26 08:23:26 ukai Exp $
+# $Id: configure,v 1.20 2001/11/26 09:01:08 ukai Exp $
# Configuration.
#
@@ -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
index 445452e..64d8e93 100644
--- a/fm.h
+++ b/fm.h
@@ -1,4 +1,4 @@
-/* $Id: fm.h,v 1.20 2001/11/24 02:01:26 ukai Exp $ */
+/* $Id: fm.h,v 1.21 2001/11/26 09:01:08 ukai Exp $ */
/*
* w3m: WWW wo Miru utility
*
@@ -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
index e08d7d0..d935b54 100644
--- a/indep.c
+++ b/indep.c
@@ -1,4 +1,4 @@
-/* $Id: indep.c,v 1.9 2001/11/24 02:01:26 ukai Exp $ */
+/* $Id: indep.c,v 1.10 2001/11/26 09:01:08 ukai Exp $ */
#include "fm.h"
#include <stdio.h>
#include <pwd.h>
@@ -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
index 710608b..4a5ac61 100644
--- a/indep.h
+++ b/indep.h
@@ -1,8 +1,9 @@
-/* $Id: indep.h,v 1.5 2001/11/21 16:29:46 ukai Exp $ */
+/* $Id: indep.h,v 1.6 2001/11/26 09:01:08 ukai Exp $ */
#ifndef INDEP_H
#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);