X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=zpm-script.c;h=a91f2ac3195974c030a0fc5b28c9645e319feaf6;hb=c02e8d831122a804f675a2f106b2e23af235be58;hp=ceca239530873d7036c7549db8afa1cb0d6cd7dc;hpb=30aa9bfe1e9a0e682f7c942b8e68054551f14857;p=zpackage diff --git a/zpm-script.c b/zpm-script.c index ceca239..a91f2ac 100644 --- a/zpm-script.c +++ b/zpm-script.c @@ -119,6 +119,12 @@ int run(char *program, char **args, char *output, int *status) { #define SOFT 1 #define HARD 2 +static int list_scripts(void *ud, const char *pkg, const char *stage, + const char *hash) { + printf("%s %s %.8s\n", pkg, stage, hash); + return 0; +} + int main(int ac, char **av){ struct zpm zpm; int rv; @@ -133,7 +139,7 @@ int main(int ac, char **av){ char *pkgid; char *rootdir = 0; - char *db = "/var/lib/zpm/zpm.db"; + char *db = "/var/lib/zpm/local.db"; char *script = "/var/tmp/zpm-script"; char *output = "/var/tmp/zpm-script.out"; char *phase = 0; @@ -248,7 +254,9 @@ int main(int ac, char **av){ fail = HARD; } } else if (mode == LIST) { - if (!zpm_script_hash(&zpm, pkgid, phase, hash)) { + if (!phase) { + zpm_foreach_script(&zpm, pkgid, phase, 0, list_scripts); + } else if (!zpm_script_hash(&zpm, pkgid, phase, hash)) { fail = SOFT; } else if (scriptishash) { printf("%s\n", hash);