]> git.ipfire.org Git - thirdparty/git.git/blob - t/helper/test-strcmp-offset.c
read-cache*.h: move declarations for read-cache.c functions from cache.h
[thirdparty/git.git] / t / helper / test-strcmp-offset.c
1 #include "test-tool.h"
2 #include "cache.h"
3 #include "read-cache-ll.h"
4
5 int cmd__strcmp_offset(int argc UNUSED, const char **argv)
6 {
7 int result;
8 size_t offset;
9
10 if (!argv[1] || !argv[2])
11 die("usage: %s <string1> <string2>", argv[0]);
12
13 result = strcmp_offset(argv[1], argv[2], &offset);
14
15 /*
16 * Because different CRTs behave differently, only rely on signs
17 * of the result values.
18 */
19 result = (result < 0 ? -1 :
20 result > 0 ? 1 :
21 0);
22 printf("%d %"PRIuMAX"\n", result, (uintmax_t)offset);
23 return 0;
24 }