blob: 44e4a6d143e24cbd05b5d94404a5f5d4e732c880 [file] [log] [blame]
Nguyễn Thái Ngọc Duy1a5f3d72018-03-24 08:44:59 +01001#include "test-tool.h"
Jeff Hostetlera6db3fb2017-04-14 19:12:28 +00002#include "cache.h"
3
Nguyễn Thái Ngọc Duy1a5f3d72018-03-24 08:44:59 +01004int cmd__strcmp_offset(int argc, const char **argv)
Jeff Hostetlera6db3fb2017-04-14 19:12:28 +00005{
6 int result;
7 size_t offset;
8
9 if (!argv[1] || !argv[2])
10 die("usage: %s <string1> <string2>", argv[0]);
11
12 result = strcmp_offset(argv[1], argv[2], &offset);
13
14 /*
Ville Skyttä64127572017-06-25 13:20:41 +030015 * Because different CRTs behave differently, only rely on signs
Jeff Hostetlera6db3fb2017-04-14 19:12:28 +000016 * of the result values.
17 */
18 result = (result < 0 ? -1 :
19 result > 0 ? 1 :
20 0);
21 printf("%d %"PRIuMAX"\n", result, (uintmax_t)offset);
22 return 0;
23}