mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Implemented stristr
SVN revision: 881
This commit is contained in:
parent
7471e4fcf9
commit
1266ab67ef
38
src/elogd.c
38
src/elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.330 2004/06/04 14:51:40 midas
|
||||||
|
Implemented stristr
|
||||||
|
|
||||||
Revision 1.329 2004/06/04 14:03:15 midas
|
Revision 1.329 2004/06/04 14:03:15 midas
|
||||||
Fixed stack overflow under Windows on resubmit of entry
|
Fixed stack overflow under Windows on resubmit of entry
|
||||||
|
|
||||||
@ -828,6 +831,35 @@ BOOL strieq(const char *str1, const char *str2)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *stristr(const char *str, const char *pattern)
|
||||||
|
{
|
||||||
|
char c1, c2, *ps;
|
||||||
|
|
||||||
|
if (str == NULL || pattern == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
while (*str) {
|
||||||
|
ps = (char *)str;
|
||||||
|
c1 = *str;
|
||||||
|
c2 = *pattern;
|
||||||
|
if (my_toupper(c1) == my_toupper(c2)) {
|
||||||
|
while (*pattern) {
|
||||||
|
c1 = *ps++;
|
||||||
|
c2 = *pattern++;
|
||||||
|
|
||||||
|
if (my_toupper(c1) != my_toupper(c2))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!*pattern)
|
||||||
|
return (char *)str;
|
||||||
|
}
|
||||||
|
str++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*---- strlcpy and strlcat to avoid buffer overflow ----------------*/
|
/*---- strlcpy and strlcat to avoid buffer overflow ----------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -11503,10 +11535,10 @@ char *param_in_str(char *str, char *param)
|
|||||||
|
|
||||||
p = str;
|
p = str;
|
||||||
do {
|
do {
|
||||||
if (strstr(p, param) == NULL)
|
if (stristr(p, param) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
p = strstr(p, param);
|
p = stristr(p, param);
|
||||||
|
|
||||||
/* if parameter is value of another parameter, skip it */
|
/* if parameter is value of another parameter, skip it */
|
||||||
if (p > str + 1 && *(p - 1) == '=')
|
if (p > str + 1 && *(p - 1) == '=')
|
||||||
@ -12377,6 +12409,8 @@ void show_elog_list(LOGBOOK * lbs, INT past_n, INT last_n, INT page_n, char *inf
|
|||||||
p--;
|
p--;
|
||||||
strcpy(p, pt);
|
strcpy(p, pt);
|
||||||
}
|
}
|
||||||
|
if (strchr(str, '&') && !strchr(str, '?'))
|
||||||
|
*strchr(str, '&') = '?';
|
||||||
redirect(lbs, str);
|
redirect(lbs, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user