libxbps: ABI/API break due to hash function changes

This commit is contained in:
Duncan Overbruck
2020-02-10 01:54:52 +01:00
parent aa4d726dca
commit 0d90534236
18 changed files with 141 additions and 118 deletions

View File

@@ -285,19 +285,20 @@ main(int argc, char **argv)
printf("%s\n", XBPS_SYSDEFCONF_PATH);
} else if (strcmp(argv[0], "digest") == 0) {
char sha256[XBPS_SHA256_SIZE];
/* Prints SHA256 hashes for specified files */
if (argc < 2)
usage();
for (int i = 1; i < argc; i++) {
filename = xbps_file_hash(argv[i]);
if (filename == NULL) {
if (!xbps_file_sha256(sha256, sizeof sha256, argv[i])) {
fprintf(stderr,
"E: couldn't get hash for %s (%s)\n",
argv[i], strerror(errno));
exit(EXIT_FAILURE);
}
printf("%s\n", filename);
printf("%s\n", sha256);
}
} else if (strcmp(argv[0], "fetch") == 0) {
/* Fetch a file from specified URL */