Skip to content

Commit

Permalink
Add --use-latest-psl to tools/psl, now default
Browse files Browse the repository at this point in the history
Fixes #76
  • Loading branch information
rockdaboot committed Dec 15, 2016
1 parent 3c33201 commit d4ea513
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
7 changes: 5 additions & 2 deletions tools/psl.1
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@ show library version information
\fB\-\-print\-info\fR
print info about library builtin data
.SH PUBLIC SUFFIX DATA
By default, `psl' will use built-in Public Suffix data.
By default, `psl' will use the latest available Public Suffix data.
.br
You can also direct it to use a different file:
.TP
\fB\-\-use\-latest\-data\fR
use the latest available PSL data [default]
.TP
\fB\-\-use\-builtin\-data\fR
use the builtin PSL data [default]
use the builtin PSL data
.TP
\fB\-\-load\-psl\-file\fR <filename>
load PSL data from file
Expand Down
12 changes: 11 additions & 1 deletion tools/psl.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ static void usage(int err, FILE* f)
fprintf(f, "\n");
fprintf(f, "Options:\n");
fprintf(f, " --version show library version information\n");
fprintf(f, " --use-builtin-data use the builtin PSL data [default]\n");
fprintf(f, " --use-latest-data use the latest PSL data available [default]\n");
fprintf(f, " --use-builtin-data use the builtin PSL data\n");
fprintf(f, " --load-psl-file <filename> load PSL data from file\n");
fprintf(f, " --is-public-suffix check if domains are public suffixes [default]\n");
fprintf(f, " --is-cookie-domain-acceptable <cookie-domain>\n");
Expand Down Expand Up @@ -92,6 +93,15 @@ int main(int argc, const char *const *argv)
mode = 4;
cookie_domain = *(++arg);
}
else if (!strcmp(*arg, "--use-latest-data")) {
psl_free(psl);
if (psl_file) {
fprintf(stderr, "Dropped data from %s\n", psl_file);
psl_file = NULL;
}
if (!(psl = (psl_ctx_t *) psl_latest(NULL)))
printf("No PSL data available\n");
}
else if (!strcmp(*arg, "--use-builtin-data")) {
psl_free(psl);
if (psl_file) {
Expand Down

0 comments on commit d4ea513

Please sign in to comment.