Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120835135
stristr.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
stristr.c
View Options
/* +++Date last modified: 05-Jul-1997 */
/*
** Designation: StriStr
**
** Call syntax: char *stristr(char *String, char *Pattern)
**
** Description: This function is an ANSI version of strstr() with
** case insensitivity.
**
** Return item: char *pointer if Pattern is found in String, else
** pointer to 0
**
** Rev History: 07/04/95 Bob Stout ANSI-fy
** 02/03/94 Fred Cole Original
**
** Hereby donated to public domain.
**
** Modified for use with libcyrus by Ken Murchison 06/01/00.
*/
#include
<string.h>
#include
<ctype.h>
#include
"config.h"
#ifndef _AIX
typedef
unsigned
int
uint
;
#endif
#if defined(__cplusplus) && __cplusplus
extern
"C"
{
#endif
EXPORTED
char
*
stristr
(
const
char
*
String
,
const
char
*
Pattern
)
{
char
*
pptr
,
*
sptr
,
*
start
;
uint
slen
,
plen
;
for
(
start
=
(
char
*
)
String
,
pptr
=
(
char
*
)
Pattern
,
slen
=
strlen
(
String
),
plen
=
strlen
(
Pattern
);
/* while string length not shorter than pattern length */
slen
>=
plen
;
start
++
,
slen
--
)
{
/* find start of pattern in string */
while
(
toupper
(
*
start
)
!=
toupper
(
*
Pattern
))
{
start
++
;
slen
--
;
/* if pattern longer than string */
if
(
slen
<
plen
)
return
(
NULL
);
}
sptr
=
start
;
pptr
=
(
char
*
)
Pattern
;
while
(
toupper
(
*
sptr
)
==
toupper
(
*
pptr
))
{
sptr
++
;
pptr
++
;
/* if end of pattern then pattern was found */
if
(
'\0'
==
*
pptr
)
return
(
start
);
}
}
return
(
NULL
);
}
#if defined(__cplusplus) && __cplusplus
}
#endif
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Fri, Apr 24, 1:14 PM (5 d, 7 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18887476
Default Alt Text
stristr.c (1 KB)
Attached To
Mode
R111 cyrus-imapd
Attached
Detach File
Event Timeline