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