From 53ecaf981983658b962bdb4d625be0ec5e87a1fd Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 8 Nov 2013 09:12:29 +0100 Subject: [PATCH] Remove xbps_print_hexfp() from API and move it xbps-rindex, where it belongs. --- bin/xbps-rkeys/main.c | 18 ++++++++++++++++-- include/xbps.h.in | 9 +-------- lib/util.c | 17 ----------------- 3 files changed, 17 insertions(+), 27 deletions(-) diff --git a/bin/xbps-rkeys/main.c b/bin/xbps-rkeys/main.c index ff410059..a39f960b 100644 --- a/bin/xbps-rkeys/main.c +++ b/bin/xbps-rkeys/main.c @@ -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"); } diff --git a/include/xbps.h.in b/include/xbps.h.in index e313c533..a1306165 100644 --- a/include/xbps.h.in +++ b/include/xbps.h.in @@ -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 diff --git a/lib/util.c b/lib/util.c index 3daa3409..37cae809 100644 --- a/lib/util.c +++ b/lib/util.c @@ -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(':'); - } -}