1 #define _POSIX_C_SOURCE 2
8 int main(int ac, char **av) {
22 while ((opt = getopt(ac, av, "nvrE")) != -1) {
24 case 'n': pdefault = 0; pname = 1; break;
25 case 'v': pdefault = 0; pver = 1; break;
26 case 'r': pdefault = 0; prel = 1; break;
27 case 'E': eval = 1; break;
29 fprintf(stderr, "zpm parse [-nvrE] ...\n");
35 pname = pname || pdefault;
36 pver = pver || pdefault;
37 prel = prel || pdefault;
39 /* TODO need to quote single quotes for eval'able output */
40 for (i=optind; i<ac; i++) {
42 found = zpm_parse_package(av[i], name, ver, &rel);
43 if (found >= 1 && pname) {
45 printf("name='%s'\n", name);
51 if (found >= 2 && pver) {
53 printf("version='%s'\n", ver);
55 printf("%s%s", printed ? " " : "", ver);
59 if (found >= 3 && prel) {
61 printf("release='%d'\n", rel);
63 printf("%s%d", printed ? " " : "", rel);