1 #define _POSIX_C_SOURCE 2
14 * -L least : print least
15 * -G greatest : print greatest
18 int main(int ac, char *av[]) {
22 int argn, opt, pass, failed = 0;
24 /* 0x1 = less than, 0x2 = equal, 0x4 = greater */
25 unsigned testmask = 0;
26 unsigned testcases = 0;
33 while ((opt = getopt(ac, av, "qgleLG")) != -1) {
35 case 'q': print = 0; break;
36 case 'l': testmask |= 0x1; break;
37 case 'e': testmask |= 0x2; break;
38 case 'g': testmask |= 0x4; break;
39 case 'L': print = 2; break;
40 case 'G': print = 3; break;
57 cmp = zpm_vercmp(a, b) + 1;
58 testcases |= (1<<cmp);
61 pass = (testmask & (1 << cmp));
67 cmp = zpm_vercmp(greatest, b);
72 cmp = zpm_vercmp(least, b);
79 case 0: /* no tests */
81 case 1: /* only less than */
83 case 2: /* only equal */
85 case 4: /* only greater than */
93 printf("%d\n", cmp == 2 ? -1 : cmp);
96 if (greatest) printf("%s\n", greatest);
99 if (least) printf("%s\n", least);
109 return failed ? 1 : 0;