diff options
author | Vincent Sanders <vince@kyllikki.org> | 2016-09-14 22:14:56 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2016-09-14 22:14:56 +0100 |
commit | aee69a99c89429677f1275626d82b2b5514e1499 (patch) | |
tree | c86d78afc516a24eb3382954bdbe475c4bf3899b /test/nspsl.c | |
download | libnspsl-aee69a99c89429677f1275626d82b2b5514e1499.tar.gz libnspsl-aee69a99c89429677f1275626d82b2b5514e1499.tar.bz2 |
Initial working library
Diffstat (limited to 'test/nspsl.c')
-rw-r--r-- | test/nspsl.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/nspsl.c b/test/nspsl.c new file mode 100644 index 0000000..88b41c7 --- /dev/null +++ b/test/nspsl.c @@ -0,0 +1,44 @@ +/* + * Copyright 2016 Vincent Sanders <vince@netsurf-browser.org> + * + * This file is part of libnspsl + * + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + */ + +/** + * \file + * + * psl test program. first argument is checked against being a public suffix. + */ + +#include <stdio.h> +#include <stdint.h> +#include <stdlib.h> +#include <string.h> + +#include <nspsl.h> + +int main(int argc, char**argv) +{ + const char *output; + size_t output_len; + + + if (argc == 2) { + output = nspsl_getpublicsuffix(argv[1]); + } else { + fprintf(stderr, "Usage: %s data", argv[0]); + return 1; + } + + if (output != NULL) { + output_len = strlen(output); + printf("%.*s\n", (int)output_len, output); + } else { + printf("null\n"); + } + + return 0; +} |