version 1.1, 2012/03/08 23:40:21
|
version 1.2.6.1, 2012/07/31 11:56:16
|
Line 44 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF TH
|
Line 44 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF TH
|
SUCH DAMAGE. |
SUCH DAMAGE. |
*/ |
*/ |
#include "global.h" |
#include "global.h" |
#include "tools.h" |
|
|
|
|
|
|
/* |
|
* www_cmp() - Compare two string |
|
* |
|
* @ct = content text from www |
|
* @s = string |
|
* return: 0 are equal or !0 are different |
|
*/ |
int |
int |
www_cmp(const char *ct, const char *s) |
www_cmp(const char *ct, const char *s) |
{ |
{ |
Line 67 www_cmp(const char *ct, const char *s)
|
Line 73 www_cmp(const char *ct, const char *s)
|
return strncasecmp(ct, s, sc - ct); |
return strncasecmp(ct, s, sc - ct); |
} |
} |
|
|
|
/* |
|
* www_cmptype() - Compare context type |
|
* |
|
* @ct = content text from www |
|
* @type = content type |
|
* return: 0 are equal or !0 are different |
|
*/ |
int |
int |
www_cmptype(const char *ct, const char *type) |
www_cmptype(const char *ct, const char *type) |
{ |
{ |
Line 85 www_cmptype(const char *ct, const char *type)
|
Line 98 www_cmptype(const char *ct, const char *type)
|
return strncasecmp(ct, type, sl - ct); |
return strncasecmp(ct, type, sl - ct); |
} |
} |
|
|
|
/* |
|
* www_getpair() - Get AV pair from WWW query string |
|
* |
|
* @str = query string |
|
* @delim = delimiter |
|
* return: NULL error or AV pair, must be free() after use! |
|
*/ |
char * |
char * |
www_getpair(char ** __restrict str, const char *delim) |
www_getpair(char ** __restrict str, const char *delim) |
{ |
{ |
Line 100 www_getpair(char ** __restrict str, const char *delim)
|
Line 120 www_getpair(char ** __restrict str, const char *delim)
|
if (!s) { |
if (!s) { |
LOGERR; |
LOGERR; |
return NULL; |
return NULL; |
} else { | } else |
strncpy(s, *str, cx); | strlcpy(s, *str, cx + 1); |
s[cx] = 0; | |
} | |
|
|
*str = tr; |
*str = tr; |
if (*str) | if (**str) |
(*str)++; |
(*str)++; |
|
|
return s; |
return s; |
} |
} |
|
|
|
/* |
|
* www_x2c() - Hex from string to digit |
|
* |
|
* @str = string |
|
* return: digit |
|
*/ |
inline char |
inline char |
www_x2c(const char *str) |
www_x2c(const char *str) |
{ |
{ |
Line 126 www_x2c(const char *str)
|
Line 150 www_x2c(const char *str)
|
return digit; |
return digit; |
} |
} |
|
|
|
/* |
|
* www_unescape() - Unescape/decode WWW query string to host string |
|
* |
|
* @str = string |
|
* return: none |
|
*/ |
inline void |
inline void |
www_unescape(char * __restrict str) |
www_unescape(char * __restrict str) |
{ |
{ |