]>
Commit | Line | Data |
---|---|---|
ae299be0 DR |
1 | #include "cache.h" |
2 | ||
3 | int main(int argc, char **argv) | |
4 | { | |
f42302b4 | 5 | if (argc == 3 && !strcmp(argv[1], "normalize_path_copy")) { |
b8469ad0 | 6 | char *buf = xmalloc(PATH_MAX + 1); |
f42302b4 JS |
7 | int rv = normalize_path_copy(buf, argv[2]); |
8 | if (rv) | |
9 | buf = "++failed++"; | |
ae299be0 | 10 | puts(buf); |
2cd85c40 | 11 | return 0; |
ae299be0 DR |
12 | } |
13 | ||
d553e737 DR |
14 | if (argc >= 2 && !strcmp(argv[1], "make_absolute_path")) { |
15 | while (argc > 2) { | |
16 | puts(make_absolute_path(argv[2])); | |
17 | argc--; | |
18 | argv++; | |
19 | } | |
2cd85c40 | 20 | return 0; |
d553e737 DR |
21 | } |
22 | ||
0454dd93 DR |
23 | if (argc == 4 && !strcmp(argv[1], "longest_ancestor_length")) { |
24 | int len = longest_ancestor_length(argv[2], argv[3]); | |
25 | printf("%d\n", len); | |
2cd85c40 | 26 | return 0; |
0454dd93 DR |
27 | } |
28 | ||
4fcc86b0 JS |
29 | if (argc == 4 && !strcmp(argv[1], "strip_path_suffix")) { |
30 | char *prefix = strip_path_suffix(argv[2], argv[3]); | |
31 | printf("%s\n", prefix ? prefix : "(null)"); | |
32 | return 0; | |
33 | } | |
34 | ||
2cd85c40 JS |
35 | fprintf(stderr, "%s: unknown function name: %s\n", argv[0], |
36 | argv[1] ? argv[1] : "(there was none)"); | |
37 | return 1; | |
ae299be0 | 38 | } |