X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=zpm-parse.c;fp=zpm-parse.c;h=0000000000000000000000000000000000000000;hb=5dd3c3e64a9574112dda77a5afc167f5daa53fd8;hp=896dba91d9aeee4f347a838da7a72abbd851bdfa;hpb=bd21f0a1265b43ad5f05353a39db31c16826f05c;p=zpackage diff --git a/zpm-parse.c b/zpm-parse.c deleted file mode 100644 index 896dba9..0000000 --- a/zpm-parse.c +++ /dev/null @@ -1,76 +0,0 @@ -#define _POSIX_C_SOURCE 2 -#include -#include -#include - -#include "zpm.h" - -int main(int ac, char **av) { - int rel; - char name[256]; - char ver[256]; - int i; - int found; - int pname = 0; - int pver = 0; - int prel = 0; - int printed = 0; - int opt; - int pdefault = 1; - int eval = 0; - - while ((opt = getopt(ac, av, "nvrE")) != -1) { - switch (opt) { - case 'n': pdefault = 0; pname = 1; break; - case 'v': pdefault = 0; pver = 1; break; - case 'r': pdefault = 0; prel = 1; break; - case 'E': eval = 1; break; - default: - fprintf(stderr, "zpm parse [-nvrE] ...\n"); - exit(EXIT_FAILURE); - break; - } - } - - pname = pname || pdefault; - pver = pver || pdefault; - prel = prel || pdefault; - - for (i=optind; i= 1 && pname) { - if (eval) { - printf("name='%s'\n", name); - } else { - printf("%s", name); - printed++; - } - } - if (found >= 2 && pver) { - if (eval) { - printf("version='%s'\n", ver); - } else { - printf("%s%s", printed ? " " : "", ver); - printed++; - } - } - if (found >= 3 && prel) { - if (eval) { - printf("release='%d'\n", rel); - } else { - printf("%s%d", printed ? " " : "", rel); - printed++; - } - } - if (printed) { - putchar('\n'); - } - if (!found) { - exit(EXIT_FAILURE); - } - } - return 0; -}