Remove xbps_print_hexfp() from API and move it xbps-rindex, where it belongs.

This commit is contained in:
Juan RP 2013-11-08 09:12:29 +01:00
parent 2952c69c7a
commit 53ecaf9819
3 changed files with 17 additions and 27 deletions

View File

@ -53,6 +53,20 @@ usage(bool fail)
exit(fail ? EXIT_FAILURE : EXIT_SUCCESS);
}
static void
print_hexfp(unsigned const char *fp)
{
unsigned int i, c, len;
len = strlen((const char *)fp);
for (i = 0; i < len; i++) {
fprintf(stdout, "%02x", fp[i]);
c = i + 1;
if (c < len)
fprintf(stdout, ":");
}
}
static int
state_cb(struct xbps_state_cb_data *xscd, void *cbd _unused)
{
@ -63,7 +77,7 @@ state_cb(struct xbps_state_cb_data *xscd, void *cbd _unused)
case XBPS_STATE_REPO_KEY_IMPORT:
printf("%s\n", xscd->desc);
printf("Fingerprint: ");
xbps_print_hexfp(xscd->arg);
print_hexfp((unsigned const char *)xscd->arg);
printf("\n");
rv = noyes("Do you want to import this public key?");
break;
@ -117,7 +131,7 @@ repo_info_cb(struct xbps_repo *repo, void *arg _unused, bool *done _unused)
printf(" %u ", rpubkeysiz);
fp = xbps_pubkey2fp(repo->xhp, rpubkey);
assert(fp);
xbps_print_hexfp((const char *)fp);
print_hexfp(fp);
free(fp);
printf("\n");
}

View File

@ -46,7 +46,7 @@
*
* This header documents the full API for the XBPS Library.
*/
#define XBPS_API_VERSION "20131009"
#define XBPS_API_VERSION "20131108"
#ifndef XBPS_VERSION
#define XBPS_VERSION "UNSET"
@ -1675,13 +1675,6 @@ int xbps_cmpver(const char *pkg1, const char *pkg2);
*/
unsigned char *xbps_pubkey2fp(struct xbps_handle *xhp, xbps_data_t pubkey);
/**
* Prints to stdout the hex fingerprint of a public key.
*
* @param[in] fp String returned by xbps_pubkey2fp();
*/
void xbps_print_hexfp(const char *fp);
/*@}*/
#ifdef __cplusplus

View File

@ -297,20 +297,3 @@ xbps_humanize_number(char *buf, int64_t bytes)
return humanize_number(buf, 7, bytes, "B",
HN_AUTOSCALE, HN_DECIMAL|HN_NOSPACE);
}
void
xbps_print_hexfp(const char *fp)
{
unsigned char *fpstr;
unsigned int i, c, len;
fpstr = (unsigned char *)(void *)(unsigned long)(const void *)fp;
len = strlen(fp);
for (i = 0; i < len; i++) {
printf("%02x", fpstr[i]);
c = i + 1;
if (c < len)
putchar(':');
}
}