34 if(!txt)
return(dest);
45 if(a == NULL || b == NULL)
48 while(*a == *b && *a !=
'\0' && *b !=
'\0'){ a++; b++; }
50 if(*a == *b)
return 0;
57 if(a == NULL || b == NULL)
60 return strcasecmp(a, b);
65 if(a == NULL || b == NULL)
68 return strncmp(a, b, i);
73 if(a == NULL || b == NULL)
76 return strncasecmp(a, b, i);
95 char *
j_attr(
const char** atts,
const char *attr)
99 while(atts[i] !=
'\0')
101 if(
j_strcmp(atts[i],attr) == 0)
return (
char*)atts[i+1];
112 for(count = 0; count < n; count++)
113 if(s[count] == (
char) c)
114 return &((
char *)s)[count];
139 s->
len += strlen(goodstr);
149 if(str == NULL || strlen(str) == 0)
157 if(raw == NULL || len <= 0)
176 arg = va_arg(ap,
char *);
191 if(s == NULL || s->
len == 0 || s->
first == NULL)
225 arg = va_arg(ap,
char *);
243 if (buf == NULL)
return(NULL);
245 if (strchr(buf,
'&') == NULL)
return(buf);
248 temp =
pmalloc(p,strlen(buf)+1);
250 temp = malloc(strlen(buf)+1);
252 if (temp == NULL)
return(NULL);
254 for(i=0;i<strlen(buf);i++)
258 if (strncmp(&buf[i],
"&",5)==0)
262 }
else if (strncmp(&buf[i],
""",6)==0) {
265 }
else if (strncmp(&buf[i],
"'",6)==0) {
268 }
else if (strncmp(&buf[i],
"<",4)==0) {
271 }
else if (strncmp(&buf[i],
">",4)==0) {
287 int i,j,newlen = len;
290 if (buf == NULL || len < 0)
return NULL;
317 temp = malloc(newlen+1);
320 memcpy(temp,buf,len);
330 memcpy(&temp[j],
"&",5);
334 memcpy(&temp[j],
"'",6);
338 memcpy(&temp[j],
""",6);
342 memcpy(&temp[j],
"<",4);
346 memcpy(&temp[j],
">",4);
359 unsigned char hashval[20];
367 # include <openssl/sha.h>
368 SHA1((
unsigned char *)str, strlen(str), hashval);
370 sha1_hash((
unsigned char *)str, strlen(str), hashval);
const char * spools(pool_t p,...)
convenience :)
char * j_strnchr(const char *s, int c, int n)
like strchr, but only searches n chars
void * pmalloc(pool_t p, int size)
char * j_strdup(const char *str)
int j_strcasecmp(const char *a, const char *b)
void shahash_r(const char *str, char hashbuf[41])
convenience (originally by Thomas Muldowney)
int j_atoi(const char *a, int def)
void shahash_raw(const char *str, unsigned char hashval[20])
char * strunescape(pool_t p, char *buf)
int j_strcmp(const char *a, const char *b)
void spool_add(spool s, const char *str)
const char * spool_print(spool s)
void hex_from_raw(const unsigned char *in, int inlen, char *out)
turn raw into hex - out must be (inlen*2)+1
int j_strncmp(const char *a, const char *b, int i)
struct spool_node * first
void spooler(spool s,...)
void sha1_hash(const unsigned char *dataIn, int len, unsigned char hashout[20])
char * pstrdup(pool_t p, const char *src)
XXX efficient: move this to const char * and then loop throug the existing heaps to see if src is wit...
char * j_attr(const char **atts, const char *attr)
int j_strlen(const char *a)
int j_strncasecmp(const char *a, const char *b, int i)
static void _spool_add(spool s, const char *goodstr)
void spool_escape(spool s, const char *raw, int len)
pool - base node for a pool.
spool spool_new(pool_t p)
char * j_strcat(char *dest, const char *txt)
char * strescape(pool_t p, const char *buf, int len)