Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
61bded1d
Commit
61bded1d
authored
20 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
added Curl_strcasestr() for case insensitive strstr() searching
parent
4b393737
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/strequal.c
+25
-6
25 additions, 6 deletions
lib/strequal.c
lib/strequal.h
+8
-5
8 additions, 5 deletions
lib/strequal.h
with
33 additions
and
11 deletions
lib/strequal.c
+
25
−
6
View file @
61bded1d
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
...
...
@@ -10,7 +10,7 @@
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
...
...
@@ -78,6 +78,25 @@ int curl_strnequal(const char *first, const char *second, size_t max)
#endif
}
/*
* Curl_strcasestr() finds the first occurrence of the substring needle in the
* string haystack. The terminating `\0' characters are not compared. The
* matching is done CASE INSENSITIVE, which thus is the difference between
* this and strstr().
*/
char
*
Curl_strcasestr
(
const
char
*
haystack
,
const
char
*
needle
)
{
size_t
nlen
=
strlen
(
needle
);
size_t
hlen
=
strlen
(
haystack
);
while
(
hlen
--
>=
nlen
)
{
if
(
curl_strnequal
(
haystack
,
needle
,
nlen
))
return
(
char
*
)
haystack
;
haystack
++
;
}
return
NULL
;
}
#ifndef HAVE_STRLCAT
/*
* The strlcat() function appends the NUL-terminated string src to the end
...
...
@@ -90,7 +109,7 @@ int curl_strnequal(const char *first, const char *second, size_t max)
* src. While this may seem somewhat confusing it was done to make trunca-
* tion detection simple.
*
*
*
*/
size_t
Curl_strlcat
(
char
*
dst
,
const
char
*
src
,
size_t
siz
)
{
...
...
This diff is collapsed.
Click to expand it.
lib/strequal.h
+
8
−
5
View file @
61bded1d
#ifndef __STREQUAL_H
#define __STREQUAL_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
...
...
@@ -12,7 +12,7 @@
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
...
...
@@ -36,6 +36,9 @@ int curl_strnequal(const char *first, const char *second, size_t max);
argument is zero-byte terminated */
#define checkprefix(a,b) strnequal(a,b,strlen(a))
/* case insensitive strstr() */
char
*
Curl_strcasestr
(
const
char
*
haystack
,
const
char
*
needle
);
#ifndef HAVE_STRLCAT
#define strlcat(x,y,z) Curl_strlcat(x,y,z)
size_t
Curl_strlcat
(
char
*
dst
,
const
char
*
src
,
size_t
siz
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment