| 58 | } |
| 59 | |
| 60 | void |
| 61 | testit(const char *input, int hostsize, const char *output, const char *test) |
| 62 | { |
| 63 | char *testhost; |
| 64 | const char *expected = (output == NULL) ? input : output; |
| 65 | |
| 66 | testhost = strdup(input); |
| 67 | trimdomain(testhost, hostsize < 0 ? (int)strlen(testhost) : hostsize); |
| 68 | tests++; |
| 69 | if (strcmp(testhost, expected) != 0) { |
| 70 | printf("not ok %d - %s\n", tests, test); |
| 71 | printf("# %s -> %s (expected %s)\n", input, testhost, expected); |
| 72 | } else |
| 73 | printf("ok %d - %s\n", tests, test); |
| 74 | free(testhost); |
| 75 | return; |
| 76 | } |
| 77 | |
| 78 | int |
| 79 | main(void) |