pactester.exe is not as useful as it could be when fed with a file of
urls.
Patch below fixes a memory allocation bug (OK, I'm a pedant, it'll
only show for very large url files), adds comment lines starting with
"#" to the urls file, and prints out the comments, urls, and results
when run in url file mode.
Enjoy,
Phil
D:\DISKS\pacparser\devel\pacparser-1.0.5>c:\cygwin\bin\diff -Naur
pactester.c pa
ctester.c.new
--- pactester.c 2008-05-10 09:35:10.000000000 -0100
+++
pactester.c.new 2008-05-20 18:45:58.203125000 -0100
@@ -162,10 +162,15 @@
return 1;
}
while (fgets(line, sizeof(line), fp)) {
- char *url = strdup(line);
+ char *url = &line[0];
// remove spaces from the beginning.
while (*url == ' ' || *url == '\t')
url++;
+ // skip comment lines
+ if (*url == '#') {
+ printf("%s", url);
+ continue;
+ }
char *urlend = url;
while (*urlend != '\r' && *urlend != '\n' && *urlend != '\0' &&
*urlend != ' ' && *urlend != '\t')
@@ -176,7 +181,7 @@
continue;
proxy = NULL;
proxy = pacparser_find_proxy(url, host);
- if(proxy) printf("%s\n", proxy);
+ if(proxy) printf("%s : %s\n", url, proxy);
}
}
pacparser_cleanup();