1 #include "git-compat-util.h"
4 int cmd_main(int argc, const char **argv)
6 const char usage[] = "test-urlmatch-normalization [-p | -l] <url1> | <url1> <url2>";
8 int opt_p = 0, opt_l = 0;
11 * For one url, succeed if url_normalize succeeds on it, fail otherwise.
12 * For two urls, succeed only if url_normalize succeeds on both and
13 * the results compare equal with strcmp. If -p is given (one url only)
14 * and url_normalize succeeds, print the result followed by "\n". If
15 * -l is given (one url only) and url_normalize succeeds, print the
16 * returned length in decimal followed by "\n".
19 if (argc > 1 && !strcmp(argv[1], "-p")) {
23 } else if (argc > 1 && !strcmp(argv[1], "-l")) {
29 if (argc < 2 || argc > 3)
34 url1 = url_normalize(argv[1], &info);
40 printf("%u\n", (unsigned)info.url_len);
47 url1 = url_normalize(argv[1], NULL);
48 url2 = url_normalize(argv[2], NULL);
49 return (url1 && url2 && !strcmp(url1, url2)) ? 0 : 1;