AC_CHECK_FUNCS(strdup strndup atof lseek)
AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp)])
AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp)])
+AC_CHECK_FUNCS(strcasestr,,[AC_CHECK_FUNCS(stristr)])
dnl Check for setlocal and langinfo
AC_CHECK_FUNCS(setlocale)
{ NULL, SUB_TYPE_UNKNOWN, "Unknown", NULL }
};
-static char * local_stristr( char *psz_big, char *psz_little)
-{
- char *p_pos = psz_big;
-
- if (!psz_big || !psz_little || !*psz_little) return psz_big;
-
- while (*p_pos)
- {
- if (toupper(*p_pos) == toupper(*psz_little))
- {
- char * psz_cur1 = p_pos + 1;
- char * psz_cur2 = psz_little + 1;
- while (*psz_cur1 && *psz_cur2 && toupper(*psz_cur1) == toupper(*psz_cur2))
- {
- psz_cur1++;
- psz_cur2++;
- }
- if (!*psz_cur2) return p_pos;
- }
- p_pos++;
- }
- return NULL;
-}
-
/*****************************************************************************
* sub_open: Open a subtitle file and add subtitle ES
*****************************************************************************/
break;
}
- if( local_stristr( s, "<SAMI>" ) )
+ if( strcasestr( s, "<SAMI>" ) )
{
i_sub_type = SUB_TYPE_SAMI;
break;
}
break;
}
- else if( local_stristr( s, "This is a Sub Station Alpha v4 script" ) )
+ else if( strcasestr( s, "This is a Sub Station Alpha v4 script" ) )
{
i_sub_type = SUB_TYPE_SSA2_4; /* I hope this will work */
break;
i_sub_type = SUB_TYPE_SSA2_4; /* could be wrong */
break;
}
- else if( local_stristr( s, "[INFORMATION]" ) )
+ else if( strcasestr( s, "[INFORMATION]" ) )
{
i_sub_type = SUB_TYPE_SUBVIEWER; /* I hope this will work */
break;
i_sub_type = SUB_TYPE_VPLAYER;
break;
}
- else if( local_stristr( s, "# VobSub index file" ) )
+ else if( strcasestr( s, "# VobSub index file" ) )
{
i_sub_type = SUB_TYPE_VOBSUB;
break;
{
if( psz_start )
{
- if( local_stristr( psz_start, psz_str ) )
+ if( strcasestr( psz_start, psz_str ) )
{
- char *s = local_stristr( psz_start, psz_str );
+ char *s = strcasestr( psz_start, psz_str );
s += strlen( psz_str );
{
return NULL;
}
- if( local_stristr( p, psz_str ) )
+ if( strcasestr( p, psz_str ) )
{
- char *s = local_stristr( p, psz_str );
+ char *s = strcasestr( p, psz_str );
s += strlen( psz_str );
{
ADDC( '\n' );
}
- else if( local_stristr( p, "Start=" ) )
+ else if( strcasestr( p, "Start=" ) )
{
text_previous_line( txt );
break;
* libc.c: Extra libc function for some systems.
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: libc.c,v 1.16 2004/02/09 16:12:25 sigmunau Exp $
+ * $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Samuel Hocevar <sam@zoy.org>
}
#endif
+/******************************************************************************
+ * strcasestr: find a substring (little) in another substring (big)
+ * Case sensitive. Return NULL if not found, return big if little == null
+ *****************************************************************************/
+#if !defined( HAVE_STRCASESTR ) && !defined( HAVE_STRISTR )
+static char * vlc_strncasestr( const char *psz_big, const char *psz_little )
+{
+ char *p_pox = psz_big;
+
+ if( !psz_big || !psz_little || !*psz_little ) return psz_big;
+
+ while( *p_pos )
+ {
+ if( toupper( *p_pos ) == toupper( *psz_little ) )
+ {
+ char * psz_cur1 = p_pos + 1;
+ char * psz_cur2 = psz_little + 1;
+ while( *psz_cur1 && *psz_cur2 && toupper( *psz_cur1 ) == toupper( *psz_cur2 ) )
+ {
+ psz_cur1++;
+ psz_cur2++;
+ }
+ if( !*psz_cur2 ) return p_pos;
+ }
+ p_pos++;
+ }
+ return NULL;
+}
+#endif
+
/*****************************************************************************
* vasprintf:
*****************************************************************************/