-const char actions_rcs[] = "$Id: actions.c,v 1.81 2012/03/09 18:06:13 fabiankeil Exp $";
+const char actions_rcs[] = "$Id: actions.c,v 1.82 2012/06/08 15:09:06 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/actions.c,v $
return 1; /* never get here */
}
- num_fields = ssplit(version_string, ".", fields, SZ(fields), 1, 1);
+ num_fields = ssplit(version_string, ".", fields, SZ(fields));
if (num_fields < 1 || atoi(fields[0]) == 0)
{
-const char cgi_rcs[] = "$Id: cgi.c,v 1.151 2012/06/08 15:07:53 fabiankeil Exp $";
+const char cgi_rcs[] = "$Id: cgi.c,v 1.152 2012/06/08 15:08:33 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgi.c,v $
*p = '\0';
}
- pairs = ssplit(argstring, "&", vector, max_segments, 1, 1);
+ pairs = ssplit(argstring, "&", vector, max_segments);
assert(pairs != -1);
if (pairs == -1)
{
-const char filters_rcs[] = "$Id: filters.c,v 1.170 2012/03/09 17:55:50 fabiankeil Exp $";
+const char filters_rcs[] = "$Id: filters.c,v 1.171 2012/03/18 13:47:33 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/filters.c,v $
return NULL;
}
- segments = ssplit(subject, "?&", url_segments, max_segments, 1, 1);
+ segments = ssplit(subject, "?&", url_segments, max_segments);
while (segments-- > 0)
{
return NULL;
}
- vec_count = ssplit(forward_settings, " \t", vec, SZ(vec), 1, 1);
+ vec_count = ssplit(forward_settings, " \t", vec, SZ(vec));
if ((vec_count == 2) && !strcasecmp(vec[0], "forward"))
{
fwd->type = SOCKS_NONE;
-const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.127 2012/05/24 14:57:49 fabiankeil Exp $";
+const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.128 2012/05/24 14:58:16 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
#ifdef FEATURE_ACL
case hash_deny_access:
strlcpy(tmp, arg, sizeof(tmp));
- vec_count = ssplit(tmp, " \t", vec, SZ(vec), 1, 1);
+ vec_count = ssplit(tmp, " \t", vec, SZ(vec));
if ((vec_count != 1) && (vec_count != 2))
{
* *************************************************************************/
case hash_forward:
strlcpy(tmp, arg, sizeof(tmp));
- vec_count = ssplit(tmp, " \t", vec, SZ(vec), 1, 1);
+ vec_count = ssplit(tmp, " \t", vec, SZ(vec));
if (vec_count != 2)
{
* *************************************************************************/
case hash_forward_socks4:
strlcpy(tmp, arg, sizeof(tmp));
- vec_count = ssplit(tmp, " \t", vec, SZ(vec), 1, 1);
+ vec_count = ssplit(tmp, " \t", vec, SZ(vec));
if (vec_count != 3)
{
case hash_forward_socks4a:
case hash_forward_socks5:
strlcpy(tmp, arg, sizeof(tmp));
- vec_count = ssplit(tmp, " \t", vec, SZ(vec), 1, 1);
+ vec_count = ssplit(tmp, " \t", vec, SZ(vec));
if (vec_count != 3)
{
#ifdef FEATURE_ACL
case hash_permit_access:
strlcpy(tmp, arg, sizeof(tmp));
- vec_count = ssplit(tmp, " \t", vec, SZ(vec), 1, 1);
+ vec_count = ssplit(tmp, " \t", vec, SZ(vec));
if ((vec_count != 1) && (vec_count != 2))
{
-const char ssplit_rcs[] = "$Id: ssplit.c,v 1.12 2011/09/04 11:10:56 fabiankeil Exp $";
+const char ssplit_rcs[] = "$Id: ssplit.c,v 1.13 2012/03/09 16:23:50 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/ssplit.c,v $
* 2 : delim = array of delimiters (if NULL, uses " \t").
* 3 : vec[] = results vector (aka. array) [out]
* 4 : vec_len = number of usable slots in the vector (aka. array size)
- * 5 : dont_save_empty_fields = zero if consecutive delimiters
- * give a null output field(s), nonzero if they are just
- * to be considered as single delimeter
- * 6 : ignore_leading = nonzero to ignore leading field
- * separators.
*
* Returns : -1 => Error: vec_len is too small to hold all the
* data, or str == NULL.
* On error, vec and str may still have been overwritten.
*
*********************************************************************/
-int ssplit(char *str, const char *delim, char *vec[], size_t vec_len,
- int dont_save_empty_fields, int ignore_leading)
+int ssplit(char *str, const char *delim, char *vec[], size_t vec_len)
{
unsigned char is_delim[256];
unsigned char char_type;
/* Parse string */
- if (ignore_leading)
+ /* Skip leading separators. XXX: Why do they matter? */
+ while (is_delim[(unsigned)(unsigned char)*str] == 1)
{
- /* skip leading separators */
- while (is_delim[(unsigned)(unsigned char)*str] == 1)
- {
- str++;
- }
+ str++;
}
- /* first pointer is the beginning of string */
- /* Check if we want to save this field */
- if ((!dont_save_empty_fields)
- || (is_delim[(unsigned)(unsigned char)*str] == 0))
- {
+ /* The first pointer is the beginning of string */
+ if (is_delim[(unsigned)(unsigned char)*str] == 0)
+ {
/*
- * We want empty fields, or the first character in this
- * field is not a delimiter or the end of string.
- * So save it.
+ * The first character in this field is not a
+ * delimiter or the end of string, so save it.
*/
if (vec_count >= vec_len)
{
*str++ = '\0';
/* Check if we want to save this field */
- if ((!dont_save_empty_fields)
- || (is_delim[(unsigned)(unsigned char)*str] == 0))
- {
+ if (is_delim[(unsigned)(unsigned char)*str] == 0)
+ {
/*
- * We want empty fields, or the first character in this
- * field is not a delimiter or the end of string.
- * So save it.
+ * The first character in this field is not a
+ * delimiter or the end of string. So save it.
*/
if (vec_count >= vec_len)
{
#ifndef SSPLIT_H_INCLUDED
#define SSPLIT_H_INCLUDED
-#define SSPLIT_H_VERSION "$Id: ssplit.h,v 1.9 2011/05/22 10:20:05 fabiankeil Exp $"
+#define SSPLIT_H_VERSION "$Id: ssplit.h,v 1.10 2011/09/04 11:10:56 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/ssplit.h,v $
extern "C" {
#endif
-extern int ssplit(char *str, const char *delim, char *vec[], size_t vec_len,
- int dont_save_empty_fields, int ignore_leading);
+extern int ssplit(char *str, const char *delim, char *vec[], size_t vec_len);
/* Revision control strings from this header and associated .c file */
extern const char ssplit_rcs[];
-const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.69 2012/03/09 16:24:36 fabiankeil Exp $";
+const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.70 2012/03/09 17:55:50 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/urlmatch.c,v $
}
/* split the domain name into components */
- http->dcount = ssplit(http->dbuffer, ".", vec, SZ(vec), 1, 1);
+ http->dcount = ssplit(http->dbuffer, ".", vec, SZ(vec));
if (http->dcount <= 0)
{
return JB_ERR_MEMORY;
}
- n = ssplit(buf, " \r\n", v, SZ(v), 1, 1);
+ n = ssplit(buf, " \r\n", v, SZ(v));
if (n != 3)
{
freez(buf);
/*
* Split the domain name into components
*/
- url->dcount = ssplit(url->dbuffer, ".", v, SZ(v), 1, 1);
+ url->dcount = ssplit(url->dbuffer, ".", v, SZ(v));
if (url->dcount < 0)
{