blob: 88b41c7409478d7daf53d131d2f468bd819a8d2d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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;
}
|