-const char actions_rcs[] = "$Id: actions.c,v 1.77 2012/02/29 19:31:12 fabiankeil Exp $";
+const char actions_rcs[] = "$Id: actions.c,v 1.78 2012/02/29 19:33:07 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/actions.c,v $
/* Check for standard action name */
const struct action_name * action = action_names;
- while ( (action->name != NULL) && (0 != strcmpic(action->name, option)) )
+ while ((action->name != NULL) && (0 != strcmpic(action->name, option)))
{
action++;
}
struct list * remove_p = cur_action->multi_remove[action->index];
struct list * add_p = cur_action->multi_add[action->index];
- if ( (value == NULL) || (*value == '\0')
- || ((*value == '*') && (value[1] == '\0')) )
+ if ((value == NULL) || (*value == '\0')
+ || ((*value == '*') && (value[1] == '\0')))
{
/*
* no option, or option == "*".
{
/* Valid option - remove only 1 option */
- if ( !cur_action->multi_remove_all[action->index] )
+ if (!cur_action->multi_remove_all[action->index])
{
/* there isn't a catch-all in the remove list already */
err = enlist_unique(remove_p, value, 0);
/* try user aliases. */
const struct action_alias * alias = alias_list;
- while ( (alias != NULL) && (0 != strcmpic(alias->name, option)) )
+ while ((alias != NULL) && (0 != strcmpic(alias->name, option)))
{
alias = alias->next;
}
"While loading actions file '%s': invalid line (%lu): %s",
csp->config->actions_file[fileid], linenum, buf);
}
- else if ( atoi(fields[0]) > VERSION_MAJOR
+ else if ( atoi(fields[0]) > VERSION_MAJOR
|| (num_fields > 1 && atoi(fields[1]) > VERSION_MINOR)
|| (num_fields > 2 && atoi(fields[2]) > VERSION_POINT))
{
fclose(fp);
log_error(LOG_LEVEL_FATAL,
"Actions file '%s', line %lu requires newer Privoxy version: %s",
- csp->config->actions_file[fileid], linenum, buf );
+ csp->config->actions_file[fileid], linenum, buf);
return 1; /* never get here */
}
free(version_string);
-const char amiga_rcs[] = "$Id: amiga.c,v 1.13 2009/05/16 13:27:20 fabiankeil Exp $";
+const char amiga_rcs[] = "$Id: amiga.c,v 1.14 2011/09/04 11:10:56 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/amiga.c,v $
}
}
-#define ADD2LIST(a,b,c) asm(".stabs \"_" #b "\"," #c ",0,0,_" #a )
+#define ADD2LIST(a,b,c) asm(".stabs \"_" #b "\"," #c ",0,0,_" #a)
#define ADD2EXIT(a,pri) ADD2LIST(a,__EXIT_LIST__,22); \
asm(".stabs \"___EXIT_LIST__\",20,0,0," #pri "+128")
ADD2EXIT(__memCleanUp,-50);
-const char cgi_rcs[] = "$Id: cgi.c,v 1.146 2011/12/31 14:47:44 fabiankeil Exp $";
+const char cgi_rcs[] = "$Id: cgi.c,v 1.147 2011/12/31 14:54:28 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgi.c,v $
/* Note: "example.com" and "example.com." are equivalent hostnames. */
/* Either the host matches CGI_SITE_1_HOST ..*/
- if ( ( (0 == strcmpic(host, CGI_SITE_1_HOST))
+ if ( ( (0 == strcmpic(host, CGI_SITE_1_HOST))
|| (0 == strcmpic(host, CGI_SITE_1_HOST ".")))
- && (path[0] == '/') )
+ && (path[0] == '/'))
{
/* ..then the path will all be for us. Remove leading '/' */
path++;
}
/* Or it's the host part CGI_SITE_2_HOST, and the path CGI_SITE_2_PATH */
- else if ( ( (0 == strcmpic(host, CGI_SITE_2_HOST ))
- || (0 == strcmpic(host, CGI_SITE_2_HOST ".")) )
- && (0 == strncmpic(path, CGI_SITE_2_PATH, strlen(CGI_SITE_2_PATH))) )
+ else if (( (0 == strcmpic(host, CGI_SITE_2_HOST))
+ || (0 == strcmpic(host, CGI_SITE_2_HOST ".")))
+ && (0 == strncmpic(path, CGI_SITE_2_PATH, strlen(CGI_SITE_2_PATH))))
{
/* take everything following CGI_SITE_2_PATH */
path += strlen(CGI_SITE_2_PATH);
s = param;
while ((ch = *s++) != '\0')
{
- if ( ((unsigned char)ch < (unsigned char)' ')
- || (ch == '}') )
+ if (((unsigned char)ch < (unsigned char)' ')
+ || (ch == '}'))
{
/* Probable hack attempt, or user accidentally used '}'. */
return JB_ERR_CGI_PARAMS;
/* Validate template name. Paranoia. */
for (p = templatename; *p != 0; p++)
{
- if ( ((*p < 'a') || (*p > 'z'))
+ if (((*p < 'a') || (*p > 'z'))
&& ((*p < 'A') || (*p > 'Z'))
&& ((*p < '0') || (*p > '9'))
&& (*p != '-')
-const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.71 2011/11/18 16:47:08 fabiankeil Exp $";
+const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.72 2011/12/31 14:47:44 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgiedit.c,v $
cur_line = cur_line->next;
}
- if ( (cur_line == NULL)
+ if ((cur_line == NULL)
|| (line_number != patternid)
|| (patternid < 1U)
|| (cur_line->type != FILE_LINE_URL))
cur_line = cur_line->next;
}
- if ( (cur_line == NULL)
+ if ((cur_line == NULL)
|| (line_number != patternid)
|| (patternid < 1U)
|| (cur_line->type != FILE_LINE_URL))
line += 2;
/* Look for optional whitespace */
- while ( (*line == ' ') || (*line == '\t') )
+ while ((*line == ' ') || (*line == '\t'))
{
line++;
}
line += len;
/* Look for optional whitespace */
- while ( (*line == ' ') || (*line == '\t') )
+ while ((*line == ' ') || (*line == '\t'))
{
line++;
}
/* Skip leading blanks. Should only happen if file is
* empty (which is valid, but pointless).
*/
- while ( (cur_line != NULL)
- && (cur_line->unprocessed[0] == '\0') )
+ while ((cur_line != NULL)
+ && (cur_line->unprocessed[0] == '\0'))
{
/* Blank line */
cur_line->type = FILE_LINE_BLANK;
cur_line = cur_line->next;
}
- if ( (cur_line != NULL)
- && (cur_line->unprocessed[0] != '{') )
+ if ((cur_line != NULL)
+ && (cur_line->unprocessed[0] != '{'))
{
/* File doesn't start with a header */
file->parse_error = cur_line;
return JB_ERR_PARSE;
}
- if ( (cur_line != NULL) && (0 ==
- match_actions_file_header_line(cur_line->unprocessed, "settings") ) )
+ if ((cur_line != NULL) && (0 ==
+ match_actions_file_header_line(cur_line->unprocessed, "settings")) )
{
cur_line->type = FILE_LINE_SETTINGS_HEADER;
}
}
- if ( (cur_line != NULL) && (0 ==
- match_actions_file_header_line(cur_line->unprocessed, "description") ) )
+ if ((cur_line != NULL) && (0 ==
+ match_actions_file_header_line(cur_line->unprocessed, "description")) )
{
cur_line->type = FILE_LINE_DESCRIPTION_HEADER;
}
}
- if ( (cur_line != NULL) && (0 ==
- match_actions_file_header_line(cur_line->unprocessed, "alias") ) )
+ if ((cur_line != NULL) && (0 ==
+ match_actions_file_header_line(cur_line->unprocessed, "alias")) )
{
cur_line->type = FILE_LINE_ALIAS_HEADER;
return JB_ERR_PARSE;
}
- while ( (*text == ' ') || (*text == '\t') )
+ while ((*text == ' ') || (*text == '\t'))
{
text++;
len--;
}
- while ( (len > (size_t)0)
- && ( (text[len - 1] == ' ')
- || (text[len - 1] == '\t') ) )
+ while ((len > (size_t)0)
+ && ((text[len - 1] == ' ')
+ || (text[len - 1] == '\t')) )
{
len--;
}
s = param;
while ((ch = *s++) != '\0')
{
- if ( ((ch < 'A') || (ch > 'Z'))
+ if (((ch < 'A') || (ch > 'Z'))
&& ((ch < 'a') || (ch > 'z'))
&& ((ch < '0') || (ch > '9'))
&& (ch != '-')
- && (ch != '_') )
+ && (ch != '_'))
{
/* Probable hack attempt. */
return JB_ERR_CGI_PARAMS;
* cur_line->next = /
* cur_line->next->next = {...actions...} or EOF
*/
- if ( (cur_line != NULL)
+ if ((cur_line != NULL)
&& (cur_line->type == FILE_LINE_ACTION)
&& (cur_line->next != NULL)
&& (cur_line->next->type == FILE_LINE_URL)
&& (0 == strcmp(cur_line->next->unprocessed, "/"))
- && ( (cur_line->next->next == NULL)
+ && ((cur_line->next->next == NULL)
|| (cur_line->next->next->type != FILE_LINE_URL)
- ) )
+ ) )
{
/*
* Generate string with buttons to set actions for "/" to
if (!err) err = map(section_exports, "actions", 1,
actions_to_html(csp, cur_line->data.action), 0);
- if ( (!err)
+ if ((!err)
&& (cur_line->next != NULL)
&& (cur_line->next->type == FILE_LINE_URL))
{
snprintf(buf, sizeof(buf), "%d", line_number);
if (!err) err = map(section_exports, "s-next", 1, buf, 1);
- if ( (cur_line != NULL)
+ if ((cur_line != NULL)
&& (cur_line->type == FILE_LINE_ACTION))
{
/* Not last section */
cur_line = cur_line->next;
}
- if ( (cur_line == NULL)
+ if ((cur_line == NULL)
|| (line_number != sectionid)
|| (sectionid < 1)
|| (cur_line->type != FILE_LINE_ACTION))
cur_line = cur_line->next;
}
- if ( (cur_line == NULL)
+ if ((cur_line == NULL)
|| (line_number != sectionid)
|| (sectionid < 1)
|| (cur_line->type != FILE_LINE_ACTION))
line_number++;
}
- if ( (cur_line == NULL)
+ if ((cur_line == NULL)
|| (cur_line->type != FILE_LINE_URL))
{
/* Invalid "patternid" parameter */
line_number++;
}
- if ( (cur_line == NULL)
+ if ((cur_line == NULL)
|| (cur_line->type != FILE_LINE_ACTION))
{
/* Invalid "sectionid" parameter */
line_number++;
}
- if ( (cur_line == NULL)
+ if ((cur_line == NULL)
|| (prev_line == NULL)
|| (cur_line->type != FILE_LINE_URL))
{
line_number++;
}
- if ( (cur_line == NULL)
- || (cur_line->type != FILE_LINE_ACTION) )
+ if ((cur_line == NULL)
+ || (cur_line->type != FILE_LINE_ACTION))
{
/* Invalid "sectionid" parameter */
edit_free_file(file);
return JB_ERR_CGI_PARAMS;
}
- if ( (cur_line->next != NULL)
- && (cur_line->next->type == FILE_LINE_URL) )
+ if ((cur_line->next != NULL)
+ && (cur_line->next->type == FILE_LINE_URL))
{
/* Section not empty. */
edit_free_file(file);
/* There's something in the file, find the line before the first
* action.
*/
- while ( (cur_line->next != NULL)
- && (cur_line->next->type != FILE_LINE_ACTION) )
+ while ((cur_line->next != NULL)
+ && (cur_line->next->type != FILE_LINE_ACTION))
{
cur_line = cur_line->next;
line_number++;
line_number++;
}
- if ( (cur_line == NULL)
+ if ((cur_line == NULL)
|| (cur_line->type != FILE_LINE_ACTION))
{
/* Invalid "sectionid" parameter */
}
/* Skip through the section to find the last line in it. */
- while ( (cur_line->next != NULL)
- && (cur_line->next->type != FILE_LINE_ACTION) )
+ while ((cur_line->next != NULL)
+ && (cur_line->next->type != FILE_LINE_ACTION))
{
cur_line = cur_line->next;
line_number++;
line_number++;
}
- if ( (cur_line == NULL)
- || (cur_line->type != FILE_LINE_ACTION) )
+ if ((cur_line == NULL)
+ || (cur_line->type != FILE_LINE_ACTION))
{
/* Invalid "section1" parameter */
edit_free_file(file);
line_number++;
}
- if ( (cur_line == NULL)
- || (cur_line->type != FILE_LINE_ACTION) )
+ if ((cur_line == NULL)
+ || (cur_line->type != FILE_LINE_ACTION))
{
/* Invalid "section2" parameter */
edit_free_file(file);
-const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.111 2011/09/04 11:10:56 fabiankeil Exp $";
+const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.112 2011/12/31 14:47:44 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgisimple.c,v $
(global_toggle_state == 1) &&
#endif /* def FEATURE_TOGGLE */
map_block_killer(exports, "privoxy-is-toggled-off")
- )
+ )
{
free_map(exports);
return JB_ERR_MEMORY;
return JB_ERR_MEMORY;
}
- if ( map(exports, "file-description", 1, file_description, 1)
- || map(exports, "filepath", 1, html_encode(filename), 0) )
+ if (map(exports, "file-description", 1, file_description, 1)
+ || map(exports, "filepath", 1, html_encode(filename), 0))
{
free_map(exports);
return JB_ERR_MEMORY;
-const char encode_rcs[] = "$Id: encode.c,v 1.23 2011/11/06 11:44:56 fabiankeil Exp $";
+const char encode_rcs[] = "$Id: encode.c,v 1.24 2011/11/06 11:51:57 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/encode.c,v $
{
char c;
char * p = buf;
- while ( (c = *s++) != '\0')
+ while ((c = *s++) != '\0')
{
const char * replace_with = html_code_map[(unsigned char) c];
if(replace_with != NULL)
{
char c;
char * p = buf;
- while( (c = *s++) != '\0')
+ while((c = *s++) != '\0')
{
const char *replace_with = url_code_map[(unsigned char) c];
if (*replace_with != '\0')
-const char errlog_rcs[] = "$Id: errlog.c,v 1.111 2011/06/25 12:39:18 fabiankeil Exp $";
+const char errlog_rcs[] = "$Id: errlog.c,v 1.112 2011/09/04 11:10:56 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/errlog.c,v $
#ifndef _WIN32
|| (logfp == NULL)
#endif
- )
+ )
{
if (loglevel == LOG_LEVEL_FATAL)
{
tempbuf[1] = '\0';
break;
case 'd':
- ival = va_arg( ap, int );
+ ival = va_arg(ap, int);
snprintf(tempbuf, sizeof(tempbuf), "%d", ival);
break;
case 'u':
- uval = va_arg( ap, unsigned );
+ uval = va_arg(ap, unsigned);
snprintf(tempbuf, sizeof(tempbuf), "%u", uval);
break;
case 'l':
ch = *src++;
if (ch == 'd')
{
- lval = va_arg( ap, long );
+ lval = va_arg(ap, long);
snprintf(tempbuf, sizeof(tempbuf), "%ld", lval);
}
else if (ch == 'u')
{
- ulval = va_arg( ap, unsigned long );
+ ulval = va_arg(ap, unsigned long);
snprintf(tempbuf, sizeof(tempbuf), "%lu", ulval);
}
else if ((ch == 'l') && (*src == 'u'))
if ((length >= log_buffer_size)
|| (outbuf[log_buffer_size-1] != '\0')
|| (outbuf[log_buffer_size] != '\0')
- )
+ )
{
/* Repeat as assertions */
assert(length < log_buffer_size);
-const char filters_rcs[] = "$Id: filters.c,v 1.166 2012/03/04 11:50:32 fabiankeil Exp $";
+const char filters_rcs[] = "$Id: filters.c,v 1.167 2012/03/04 11:51:25 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/filters.c,v $
#else
(csp->ip_addr_long & acl->src->mask) == acl->src->addr
#endif
- )
+ )
{
if (dst == NULL)
{
((dst->addr & acl->dst->mask) == acl->dst->addr)
&& ((dst->port == acl->dst->port) || (acl->dst->port == 0))
#endif
- )
+ )
{
if (acl->action == ACL_PERMIT)
{
#else
(masklength > 32)
#endif
- )
+ )
{
freez(acl_spec);
return(-1);
}
if ((new_url != NULL)
- && ( (new_url != subject)
+ && ( (new_url != subject)
|| (0 == strncmpic(subject, "http://", 7))
|| (0 == strncmpic(subject, "https://", 8))
- ))
+ ))
{
/*
* Return new URL if we found a redirect
string_append(&new_entry, csp->http->hostport);
path = csp->http->path;
- if ( (path[0] == '/')
+ if ((path[0] == '/')
&& (path[1] == '~')
&& ((path_end = strchr(path + 2, '/')) != NULL))
{
size = (size_t)(csp->iob->eod - csp->iob->cur);
- if ( (NULL == (in = (struct binbuffer *)zalloc(sizeof *in )))
- || (NULL == (out = (struct binbuffer *)zalloc(sizeof *out))) )
+ if ( (NULL == (in = (struct binbuffer *)zalloc(sizeof *in)))
+ || (NULL == (out = (struct binbuffer *)zalloc(sizeof *out))))
{
log_error(LOG_LEVEL_DEANIMATE, "failed! (no mem)");
return NULL;
-const char gateway_rcs[] = "$Id: gateway.c,v 1.83 2011/12/24 15:28:45 fabiankeil Exp $";
+const char gateway_rcs[] = "$Id: gateway.c,v 1.84 2012/02/29 19:35:11 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/gateway.c,v $
return FALSE;
}
- if (( (NULL != connection->gateway_host)
+ if (( (NULL != connection->gateway_host)
&& (NULL != fwd->gateway_host)
&& strcmpic(connection->gateway_host, fwd->gateway_host))
&& (connection->gateway_host != fwd->gateway_host))
return FALSE;
}
- if (( (NULL != connection->forward_host)
+ if (( (NULL != connection->forward_host)
&& (NULL != fwd->forward_host)
&& strcmpic(connection->forward_host, fwd->forward_host))
&& (connection->forward_host != fwd->forward_host))
c->vn = 4;
c->cd = 1;
- c->dstport[0] = (unsigned char)((target_port >> 8 ) & 0xff);
- c->dstport[1] = (unsigned char)((target_port ) & 0xff);
- c->dstip[0] = (unsigned char)((web_server_addr >> 24 ) & 0xff);
- c->dstip[1] = (unsigned char)((web_server_addr >> 16 ) & 0xff);
- c->dstip[2] = (unsigned char)((web_server_addr >> 8 ) & 0xff);
- c->dstip[3] = (unsigned char)((web_server_addr ) & 0xff);
+ c->dstport[0] = (unsigned char)((target_port >> 8 ) & 0xff);
+ c->dstport[1] = (unsigned char)((target_port ) & 0xff);
+ c->dstip[0] = (unsigned char)((web_server_addr >> 24) & 0xff);
+ c->dstip[1] = (unsigned char)((web_server_addr >> 16) & 0xff);
+ c->dstip[2] = (unsigned char)((web_server_addr >> 8) & 0xff);
+ c->dstip[3] = (unsigned char)((web_server_addr ) & 0xff);
/* pass the request to the socks server */
sfd = connect_to(fwd->gateway_host, fwd->gateway_port, csp);
strncpy(cbuf + client_pos, target_host, sizeof(cbuf) - client_pos);
client_pos += (hostlen & 0xffu);
cbuf[client_pos++] = (char)((target_port >> 8) & 0xff);
- cbuf[client_pos++] = (char)((target_port ) & 0xff);
+ cbuf[client_pos++] = (char)((target_port ) & 0xff);
if (write_socket(sfd, cbuf, client_pos))
{
-const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.111 2011/12/10 17:26:30 fabiankeil Exp $";
+const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.112 2011/12/31 14:43:20 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jbsockets.c,v $
(char *) &inaddr.sin_addr,
(char *) hostp->h_addr,
sizeof(inaddr.sin_addr)
- );
+ );
}
return(inaddr.sin_addr.s_addr);
-const char jcc_rcs[] = "$Id: jcc.c,v 1.374 2011/11/06 11:58:51 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.375 2011/12/10 17:26:11 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
* Downgrade http version from 1.1 to 1.0
* if +downgrade action applies.
*/
- if ( (csp->action->flags & ACTION_DOWNGRADE)
+ if ((csp->action->flags & ACTION_DOWNGRADE)
&& (!strcmpic(http->ver, "HTTP/1.1")))
{
freez(http->ver);
const char *pName = argv[argc_pos] + 9;
if (*pName == ':')
pName++;
- exit( (install_service(pName)) ? 0 : 1 );
+ exit((install_service(pName)) ? 0 : 1);
}
else if (strncmp(argv[argc_pos], "--uninstall", 11) == 0)
{
pName++;
exit((uninstall_service(pName)) ? 0 : 1);
}
- else if (strcmp(argv[argc_pos], "--service" ) == 0)
+ else if (strcmp(argv[argc_pos], "--service") == 0)
{
bRunAsService = TRUE;
w32_set_service_cwd();
#if defined(unix)
- else if (strcmp(argv[argc_pos], "--no-daemon" ) == 0)
+ else if (strcmp(argv[argc_pos], "--no-daemon") == 0)
{
set_debug_level(LOG_LEVEL_FATAL | LOG_LEVEL_ERROR | LOG_LEVEL_INFO);
daemon_mode = 0;
}
- else if (strcmp(argv[argc_pos], "--pidfile" ) == 0)
+ else if (strcmp(argv[argc_pos], "--pidfile") == 0)
{
if (++argc_pos == argc) usage(argv[0]);
pidfile = strdup(argv[argc_pos]);
}
- else if (strcmp(argv[argc_pos], "--user" ) == 0)
+ else if (strcmp(argv[argc_pos], "--user") == 0)
{
char *user_arg;
char *group_name;
freez(user_arg);
}
- else if (strcmp(argv[argc_pos], "--pre-chroot-nslookup" ) == 0)
+ else if (strcmp(argv[argc_pos], "--pre-chroot-nslookup") == 0)
{
if (++argc_pos == argc) usage(argv[0]);
pre_chroot_nslookup_to_load_resolver = strdup(argv[argc_pos]);
}
- else if (strcmp(argv[argc_pos], "--chroot" ) == 0)
+ else if (strcmp(argv[argc_pos], "--chroot") == 0)
{
do_chroot = 1;
}
show_version(Argv[0]);
#if defined(unix)
- if ( *configfile != '/' )
+ if (*configfile != '/')
{
char cwd[BUFFER_SIZE];
char *abs_file;
if (NULL == getcwd(cwd, sizeof(cwd)))
{
perror("failed to get current working directory");
- exit( 1 );
+ exit(1);
}
/* XXX: why + 5? */
NULL == (abs_file = malloc(abs_file_size)))
{
perror("malloc failed");
- exit( 1 );
+ exit(1);
}
strlcpy(abs_file, basedir, abs_file_size);
- strlcat(abs_file, "/", abs_file_size );
+ strlcat(abs_file, "/", abs_file_size);
strlcat(abs_file, configfile, abs_file_size);
configfile = abs_file;
}
int fd;
pid_t pid = fork();
- if ( pid < 0 ) /* error */
+ if (pid < 0) /* error */
{
perror("fork");
- exit( 3 );
+ exit(3);
}
- else if ( pid != 0 ) /* parent */
+ else if (pid != 0) /* parent */
{
int status;
pid_t wpid;
* must check for errors
* child died due to missing files aso
*/
- sleep( 1 );
- wpid = waitpid( pid, &status, WNOHANG );
- if ( wpid != 0 )
+ sleep(1);
+ wpid = waitpid(pid, &status, WNOHANG);
+ if (wpid != 0)
{
- exit( 1 );
+ exit(1);
}
- exit( 0 );
+ exit(0);
}
/* child */
int child_status;
#if !defined(_WIN32) && !defined(__CYGWIN__)
- wait( &child_status );
+ wait(&child_status);
/*
* Evaluate child's return code: If the child has
-const char list_rcs[] = "$Id: list.c,v 1.26 2011/12/31 14:47:44 fabiankeil Exp $";
+const char list_rcs[] = "$Id: list.c,v 1.27 2012/03/04 11:41:32 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/list.c,v $
{
for (cur_entry = the_list->first; cur_entry != NULL; cur_entry = cur_entry->next)
{
- if ( (cur_entry->str != NULL)
+ if ((cur_entry->str != NULL)
&& (0 == strncmp(str, cur_entry->str, num_significant_chars)))
{
/* Already there */
/* Test whole string */
for (cur_entry = the_list->first; cur_entry != NULL; cur_entry = cur_entry->next)
{
- if ( (cur_entry->str != NULL) && (0 == strcmp(str, cur_entry->str)))
+ if ((cur_entry->str != NULL) && (0 == strcmp(str, cur_entry->str)))
{
/* Already there */
return JB_ERR_OK;
assert(the_map);
- if ( (NULL == value)
+ if ((NULL == value)
|| (NULL == name)
- || (NULL == (new_entry = zalloc(sizeof(*new_entry)))) )
+ || (NULL == (new_entry = zalloc(sizeof(*new_entry)))))
{
if ((name != NULL) && (!name_needs_copying))
{
-const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.123 2012/03/04 11:49:24 fabiankeil Exp $";
+const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.124 2012/03/04 11:51:25 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
* *************************************************************************/
case hash_confdir :
freez(config->confdir);
- config->confdir = make_path( NULL, arg);
+ config->confdir = make_path(NULL, arg);
break;
/* *************************************************************************
break;
/* *************************************************************************/
- } /* end switch( hash_string(cmd) ) */
+ } /* end switch(hash_string(cmd)) */
/* Save the argument for the show-status page. */
savearg(cmd, arg, config);
freez(buf);
- } /* end while ( read_config_line(...) ) */
+ } /* end while (read_config_line(...)) */
fclose(configfp);
}
#endif /* def FEATURE_TRUST */
- if ( NULL == config->haddr[0] )
+ if (NULL == config->haddr[0])
{
- config->haddr[0] = strdup( HADDR_DEFAULT );
+ config->haddr[0] = strdup(HADDR_DEFAULT);
if (NULL == config->haddr[0])
{
log_error(LOG_LEVEL_FATAL, "Out of memory while copying default listening address");
return;
}
- if ( (NULL != argument) && ('\0' != *argument) )
+ if ((NULL != argument) && ('\0' != *argument))
{
s = html_encode(argument);
if (NULL == s)
-const char loaders_rcs[] = "$Id: loaders.c,v 1.86 2011/09/04 11:10:56 fabiankeil Exp $";
+const char loaders_rcs[] = "$Id: loaders.c,v 1.87 2011/11/06 11:53:15 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loaders.c,v $
unsigned int active_threads = 0;
/* clear all of the file's active flags */
- for ( fl = files->next; NULL != fl; fl = fl->next )
+ for (fl = files->next; NULL != fl; fl = fl->next)
{
fl->active = 0;
}
while (fl != NULL)
{
- if ( ( 0 == fl->active ) && ( NULL != fl->unloader ) )
+ if (( 0 == fl->active) && ( NULL != fl->unloader ) )
{
nfl->next = fl->next;
/* Main loop. Loop while we need more data & it's not EOF. */
- while ( (contflag || is_empty)
+ while ((contflag || is_empty)
&& (JB_ERR_OK == (rval = simple_read_line(fp, &linebuf, newline))))
{
if (line_number)
/*
* Schedule the now-obsolete old data for unloading
*/
- if ( NULL != current_re_filterfile[fileid] )
+ if (NULL != current_re_filterfile[fileid])
{
current_re_filterfile[fileid]->unloader = unload_re_filterfile;
}
current_re_filterfile[fileid] = fs;
csp->rlist[fileid] = fs;
- return( 0 );
+ return(0);
load_re_filterfile_error:
log_error(LOG_LEVEL_FATAL, "can't load re_filterfile '%s': %E",
-const char miscutil_rcs[] = "$Id: miscutil.c,v 1.72 2012/03/04 11:51:25 fabiankeil Exp $";
+const char miscutil_rcs[] = "$Id: miscutil.c,v 1.73 2012/03/04 11:52:45 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/miscutil.c,v $
* Returns : The string's hash
*
*********************************************************************/
-unsigned int hash_string( const char* s )
+unsigned int hash_string(const char* s)
{
unsigned int h = 0;
- for ( ; *s; ++s )
+ for (; *s; ++s)
{
h = 5 * h + (unsigned int)*s;
}
while (*s1 && *s2)
{
- if ( ( *s1 != *s2 ) && ( privoxy_tolower(*s1) != privoxy_tolower(*s2) ) )
+ if (( *s1 != *s2) && ( privoxy_tolower(*s1) != privoxy_tolower(*s2) ) )
{
break;
}
while (*s1 && *s2)
{
- if ( ( *s1 != *s2 ) && ( privoxy_tolower(*s1) != privoxy_tolower(*s2) ) )
+ if (( *s1 != *s2) && ( privoxy_tolower(*s1) != privoxy_tolower(*s2) ) )
{
break;
}
#else /* ifndef _WIN32 || __OS2__ */
|| (*file == '/') /* Absolute path (U*ix) */
#endif /* ifndef _WIN32 || __OS2__ */
- )
+ )
{
return strdup(file);
}
size_t path_size = strlen(dir) + strlen(file) + 2; /* +2 for trailing (back)slash and \0 */
#if defined(unix)
- if ( *dir != '/' && basedir && *basedir )
+ if (*dir != '/' && basedir && *basedir)
{
/*
* Relative path, so start with the base directory.
*/
path_size += strlen(basedir) + 1; /* +1 for the slash */
path = malloc(path_size);
- if (!path ) log_error(LOG_LEVEL_FATAL, "malloc failed!");
+ if (!path) log_error(LOG_LEVEL_FATAL, "malloc failed!");
strlcpy(path, basedir, path_size);
strlcat(path, "/", path_size);
strlcat(path, dir, path_size);
#endif /* defined unix */
{
path = malloc(path_size);
- if (!path ) log_error(LOG_LEVEL_FATAL, "malloc failed!");
+ if (!path) log_error(LOG_LEVEL_FATAL, "malloc failed!");
strlcpy(path, dir, path_size);
}
tmp[str_arg_l++] = space_for_positive ? ' ' : '+';
#endif
} else if (alternate_form) {
- if (arg_sign != 0 && (fmt_spec == 'x' || fmt_spec == 'X') )
+ if (arg_sign != 0 && (fmt_spec == 'x' || fmt_spec == 'X'))
{ tmp[str_arg_l++] = '0'; tmp[str_arg_l++] = fmt_spec; }
/* alternate form should have no effect for p conversion, but ... */
#ifdef HPUX_COMPATIBLE
/* Actually it uses 0x prefix even for a zero value. */
&& arg_sign != 0
#endif
- ) { tmp[str_arg_l++] = '0'; tmp[str_arg_l++] = 'x'; }
+ ) { tmp[str_arg_l++] = '0'; tmp[str_arg_l++] = 'x'; }
#endif
}
zero_padding_insertion_ind = str_arg_l;
* converting a zero value with a precision of zero is a null string.
* Actually HP returns all zeroes, and Linux returns "(nil)". */
#endif
- ) {
+ ) {
/* converted to null string */
/* When zero value is formatted with an explicit precision 0,
the resulting formatted string is empty (d, i, u, o, x, X, p). */
if (zero_padding_insertion_ind+1 < str_arg_l &&
tmp[zero_padding_insertion_ind] == '0' &&
(tmp[zero_padding_insertion_ind+1] == 'x' ||
- tmp[zero_padding_insertion_ind+1] == 'X') ) {
+ tmp[zero_padding_insertion_ind+1] == 'X')) {
zero_padding_insertion_ind += 2;
}
}
&& !(zero_padding_insertion_ind < str_arg_l
&& tmp[zero_padding_insertion_ind] == '0')
#endif
- ) { /* assure leading zero for alternate-form octal numbers */
+ ) { /* assure leading zero for alternate-form octal numbers */
if (!precision_specified || precision < num_of_digits+1) {
/* precision is increased to force the first character to be zero,
except if a zero value is formatted with an explicit precision
-const char parsers_rcs[] = "$Id: parsers.c,v 1.242 2012/03/04 11:51:25 fabiankeil Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.243 2012/03/04 11:53:26 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/parsers.c,v $
for (job = joblist; NULL != job; job = job->next)
{
matches = pcrs_execute(job, *header, size, &newheader, &size);
- if ( 0 < matches )
+ if (0 < matches)
{
current_hits += matches;
log_error(LOG_LEVEL_HEADER, "Transforming \"%s\" to \"%s\"", *header, newheader);
freez(*header);
*header = newheader;
}
- else if ( 0 == matches )
+ else if (0 == matches)
{
/* Filter doesn't change header */
freez(newheader);
#ifdef FEATURE_CONNECTION_KEEP_ALIVE
&& !(csp->flags & CSP_FLAG_SERVER_SOCKET_TAINTED)
#endif
- )
+ )
{
#ifdef FEATURE_CONNECTION_KEEP_ALIVE
if ((csp->config->feature_flags & RUNTIME_FEATURE_CONNECTION_KEEP_ALIVE))
newval = csp->action->string[ACTION_STRING_LAST_MODIFIED];
- if (0 == strcmpic(newval, "block") )
+ if (0 == strcmpic(newval, "block"))
{
/*
* Blocking Last-Modified header. Useless but why not.
newval = csp->action->string[ACTION_STRING_LANGUAGE];
- if ((newval == NULL) || (0 == strcmpic(newval, "block")) )
+ if ((newval == NULL) || (0 == strcmpic(newval, "block")))
{
/*
* Blocking Accept-Language header
/*
* Are we blocking the e-mail address?
*/
- if ((newval == NULL) || (0 == strcmpic(newval, "block")) )
+ if ((newval == NULL) || (0 == strcmpic(newval, "block")))
{
log_error(LOG_LEVEL_HEADER, "crunched From!");
return JB_ERR_OK;
const char *newval;
char * endptr;
- if ( 0 == strcmpic(*header, "If-Modified-Since: Wed, 08 Jun 1955 12:00:00 GMT"))
+ if (0 == strcmpic(*header, "If-Modified-Since: Wed, 08 Jun 1955 12:00:00 GMT"))
{
/*
* The client got an error message because of a temporary problem,
*********************************************************************/
jb_err client_x_filter(struct client_state *csp, char **header)
{
- if ( 0 == strcmpic(*header, "X-Filter: No"))
+ if (0 == strcmpic(*header, "X-Filter: No"))
{
if (!(csp->config->feature_flags & RUNTIME_FEATURE_HTTP_TOGGLE))
{
return JB_ERR_OK;
}
- if ( !csp->http->hostport || !*(csp->http->hostport))
+ if (!csp->http->hostport || !*(csp->http->hostport))
{
/* XXX: When does this happen and why is it OK? */
log_error(LOG_LEVEL_INFO, "Weirdness in client_host_adder detected and ignored.");
/*
* remove 'user:pass@' from 'proto://user:pass@host'
*/
- if ( (p = strchr( csp->http->hostport, '@')) != NULL )
+ if ((p = strchr( csp->http->hostport, '@')) != NULL)
{
p++;
}
#ifdef FEATURE_CONNECTION_KEEP_ALIVE
&& !(csp->flags & CSP_FLAG_SERVER_SOCKET_TAINTED)
#endif
- )
+ )
{
log_error(LOG_LEVEL_HEADER, "A HTTP/1.1 response "
"without Connection header implies keep-alive.");
-const char pcrs_rcs[] = "$Id: pcrs.c,v 1.37 2011/04/19 13:00:47 fabiankeil Exp $";
+const char pcrs_rcs[] = "$Id: pcrs.c,v 1.38 2011/09/04 11:10:56 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/pcrs.c,v $
*********************************************************************/
void pcrs_free_joblist(pcrs_job *joblist)
{
- while ( NULL != (joblist = pcrs_free_job(joblist)) ) {};
+ while (NULL != (joblist = pcrs_free_job(joblist))) {};
return;
result_offset,
subject + matches[i].submatch_offset[job->substitute->backref[k]],
matches[i].submatch_length[job->substitute->backref[k]]
- );
+ );
result_offset += matches[i].submatch_length[job->substitute->backref[k]];
}
}
-const char ssplit_rcs[] = "$Id: ssplit.c,v 1.11 2011/05/22 10:20:05 fabiankeil Exp $";
+const char ssplit_rcs[] = "$Id: ssplit.c,v 1.12 2011/09/04 11:10:56 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/ssplit.c,v $
/* 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) )
+ if ((!dont_save_empty_fields)
+ || (is_delim[(unsigned)(unsigned char)*str] == 0))
{
/*
* We want empty fields, or the first character in this
*str++ = '\0';
/* Check if we want to save this field */
- if ( (!dont_save_empty_fields)
- || (is_delim[(unsigned)(unsigned char)*str] == 0) )
+ if ((!dont_save_empty_fields)
+ || (is_delim[(unsigned)(unsigned char)*str] == 0))
{
/*
* We want empty fields, or the first character in this
-const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.66 2011/12/31 14:53:18 fabiankeil Exp $";
+const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.67 2012/03/04 11:51:49 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/urlmatch.c,v $
*/
if (*http->url == '*')
{
- if ( NULL == (http->path = strdup("*"))
- || NULL == (http->hostport = strdup("")) )
+ if (NULL == (http->path = strdup("*"))
+ || NULL == (http->hostport = strdup("")))
{
return JB_ERR_MEMORY;
}
freez(buf);
- if ( (http->path == NULL)
+ if ((http->path == NULL)
|| (http->hostport == NULL))
{
return JB_ERR_MEMORY;
freez(buf);
- if ( (http->cmd == NULL)
+ if ((http->cmd == NULL)
|| (http->gpc == NULL)
- || (http->ver == NULL) )
+ || (http->ver == NULL))
{
return JB_ERR_MEMORY;
}
/*
* Char match, or char range match?
*/
- if ( (*pat == *txt)
+ if ((*pat == *txt)
|| (*pat == '?')
- || ((*pat == ']') && (charmap[*txt / 8] & (1 << (*txt % 8)))) )
+ || ((*pat == ']') && (charmap[*txt / 8] & (1 << (*txt % 8)))))
{
/*
* Success: Go ahead
-const char w32log_rcs[] = "$Id: w32log.c,v 1.39 2011/05/27 11:34:16 fabiankeil Exp $";
+const char w32log_rcs[] = "$Id: w32log.c,v 1.40 2011/09/04 11:10:56 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/w32log.c,v $
hwnd = CreateWindow(szWndName, szWndName,
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, NULL, NULL, hInstance, NULL );
+ CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
return hwnd;
-const char w32taskbar_rcs[] = "$Id: w32taskbar.c,v 1.11 2009/05/16 13:27:20 fabiankeil Exp $";
+const char w32taskbar_rcs[] = "$Id: w32taskbar.c,v 1.12 2011/09/04 11:10:56 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/w32taskbar.c,v $
g_hwndTrayX = CreateWindow(szWndName, szWndName,
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, NULL, NULL, hInstance, NULL );
+ CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
ShowWindow(g_hwndTrayX, SW_HIDE);
UpdateWindow(g_hwndTrayX);
nid.uCallbackMessage = 0;
nid.hIcon = hicon;
- return( Shell_NotifyIcon(NIM_MODIFY, &nid) );
+ return(Shell_NotifyIcon(NIM_MODIFY, &nid));
}
strcpy(nid.szTip, pszToolTip);
}
- return( Shell_NotifyIcon(NIM_ADD, &nid) );
+ return(Shell_NotifyIcon(NIM_ADD, &nid));
}
nid.hWnd = hwnd;
nid.uID = uID;
- return( Shell_NotifyIcon(NIM_DELETE, &nid) );
+ return(Shell_NotifyIcon(NIM_DELETE, &nid));
}
GetCursorPos(&pt);
SetForegroundWindow(g_hwndLogFrame);
TrackPopupMenu(hmenu, TPM_LEFTALIGN | TPM_TOPALIGN, pt.x, pt.y, 0, g_hwndLogFrame, NULL);
- PostMessage(g_hwndLogFrame, WM_NULL, 0, 0 ) ;
+ PostMessage(g_hwndLogFrame, WM_NULL, 0, 0) ;
}
else if (uMouseMsg == WM_LBUTTONDBLCLK)
{
-const char win32_rcs[] = "$Id: win32.c,v 1.17 2010/01/11 11:41:07 fabiankeil Exp $";
+const char win32_rcs[] = "$Id: win32.c,v 1.18 2011/09/04 11:10:56 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/win32.c,v $
/* Visual C++ Heap debugging */
/* Get current flag*/
- int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
+ int tmpFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
/* Turn on leak-checking bit */
tmpFlag |= _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF;
tmpFlag &= ~(_CRTDBG_CHECK_CRT_DF | _CRTDBG_DELAY_FREE_MEM_DF);
/* Set flag to the new value */
- _CrtSetDbgFlag( tmpFlag );
+ _CrtSetDbgFlag(tmpFlag);
#endif
#endif /* defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG) */
#endif
#ifdef __MINGW32__
- res = real_main( __argc, __argv );
+ res = real_main(__argc, __argv);
#else
- res = main( __argc, __argv );
+ res = main(__argc, __argv);
#endif
return res;