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 for (i=optind; i<ac; i++) {
41 found = zpm_parse_package(av[i], name, ver, &rel);
42 /* single quotes aren't allowed, so a simple single quote
43 * is sufficient for eval */
44 if (found >= 1 && pname) {
46 printf("name='%s'\n", name);
52 if (found >= 2 && pver) {
54 printf("version='%s'\n", ver);
56 printf("%s%s", printed ? " " : "", ver);
60 if (found >= 3 && prel) {
62 printf("release='%d'\n", rel);
64 printf("%s%d", printed ? " " : "", rel);