[w3m-dev 02555]

From: Fumitoshi UKAI <ukai@debian.or.jp>
This commit is contained in:
Fumitoshi UKAI
2001-11-26 09:01:08 +00:00
parent bdf0fff6d6
commit b136c763a1
5 changed files with 46 additions and 7 deletions

View File

@@ -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]

21
configure vendored
View File

@@ -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

4
fm.h
View File

@@ -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>

10
indep.c
View File

@@ -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)

View File

@@ -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);