1 #define _POSIX_C_SOURCE 2
14 fprintf(stderr, "zpm-findpkg [-I] [-s <status> ...] [-S <status>] [package]\n");
17 int main(int ac, char **av){
26 dbfile = getenv("ZPMDB");
28 dbfile = "/var/lib/zpm/local.db";
31 while ((opt = getopt(ac, av, "f:scq")) != -1) {
33 case 'f': dbfile = optarg; break;
34 case 's': set = 1; break;
35 case 'c': check = 1; break;
36 case 'q': quiet = 1; break;
46 fprintf(stderr, "must specify db\n");
50 char *pkgid = av[argn];
51 char hash[ZPM_HASH_STRLEN+1];
53 if (zpm_open(&pkg, dbfile)) {
55 found = zpm_package_hash(&pkg, pkgid, hash);
56 char *ehash = zpm_db_string(&pkg, "select hash from packages_pkgid where pkgid = %Q", pkgid);
57 if (ehash && found && !strcmp(ehash, hash)) {
63 found = zpm_package_sethash(&pkg, pkgid, hash);
65 found = zpm_package_hash(&pkg, pkgid, hash);
69 if (found && !quiet) {