From: Jonathan McDowell <noodles@earth.li>
Date: Tue, 25 Aug 2009 15:03:09 +0000 (+0100)
Subject: Correct formatting of some places we output a keyid
X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/commitdiff_plain/936be87217c58254edc92aa63178fa0461f67150?ds=inline

Correct formatting of some places we output a keyid

  Format keyids in various places to be 16 digits long, zero padded
  if necessary. Closes Debian bug #540196 (which has a patch from
  Philippe Teuwen, but that uses 8 digits instead of 16).
---

diff --git a/gpgwww.c b/gpgwww.c
index 24bf490..7d90a00 100644
--- a/gpgwww.c
+++ b/gpgwww.c
@@ -154,10 +154,10 @@ int main(int argc, char *argv[])
 	}
 
 	if (op != OP_GET) {
-		printf("<P>Looking for path from 0x%" PRIX64" to 0x%" PRIX64
-				".\n",
+		printf("<P>Looking for path from 0x%016" PRIX64" to 0x%016"
+				PRIX64 ".\n",
 				from, to);
-		printf("<A HREF=\"gpgwww?from=0x%08" PRIX64 "&to=0x%08" PRIX64
+		printf("<A HREF=\"gpgwww?from=0x%016" PRIX64 "&to=0x%016" PRIX64
 				"\">Find reverse path</A>\n",
 				to,
 				from);
@@ -173,7 +173,8 @@ int main(int argc, char *argv[])
 	catchsignals();
 	config.dbbackend->initdb(true);
 	inithash();
-	logthing(LOGTHING_NOTICE, "Looking for path from 0x%" PRIX64 " to 0x%"
+	logthing(LOGTHING_NOTICE, "Looking for path from 0x%016" PRIX64
+			" to 0x%016"
 			PRIX64,
 			from,
 			to);
diff --git a/keyindex.c b/keyindex.c
index d2094d5..0cc9edd 100644
--- a/keyindex.c
+++ b/keyindex.c
@@ -87,9 +87,9 @@ int list_uids(uint64_t keyid, struct openpgp_signedpacket_list *uids,
 		} else if (uids->packet->tag == 17) {
 			printf("                                ");
 			if (html) {
-				printf("<img src=\"lookup?op=photo&search=0x%"
-					PRIX64 "&idx=%d\" alt=\"[photo id]\">"
-					"\n",
+				printf("<img src=\"lookup?op=photo&search="
+					"0x%016" PRIX64 "&idx=%d\" alt=\""
+					"[photo id]\">\n",
 					keyid,
 					imgindx);
 				imgindx++;
diff --git a/sixdegrees.c b/sixdegrees.c
index 9d2d68d..b746327 100644
--- a/sixdegrees.c
+++ b/sixdegrees.c
@@ -86,12 +86,13 @@ void sixdegrees(uint64_t keyid)
 	config.dbbackend->cached_getkeysigs(keyid);
 
 	if ((keyinfo = findinhash(keyid)) == NULL) {
-		printf("Couldn't find key 0x%" PRIX64 ".\n", keyid);
+		printf("Couldn't find key 0x%016" PRIX64 ".\n", keyid);
 		return;
 	}
 
 	uid = config.dbbackend->keyid2uid(keyinfo->keyid);
-	printf("Six degrees for 0x%" PRIX64 " (%s):\n", keyinfo->keyid, uid);
+	printf("Six degrees for 0x%016" PRIX64 " (%s):\n", keyinfo->keyid,
+			uid);
 	free(uid);
 	uid = NULL;
 
diff --git a/stats.c b/stats.c
index e009de5..88d7a05 100644
--- a/stats.c
+++ b/stats.c
@@ -139,11 +139,11 @@ void dofindpath(uint64_t have, uint64_t want, bool html, int count)
 	(void) config.dbbackend->cached_getkeysigs(fullwant);
 
 	if ((keyinfoa = findinhash(fullhave)) == NULL) {
-		printf("Couldn't find key 0x%" PRIX64 ".\n", have);
+		printf("Couldn't find key 0x%016" PRIX64 ".\n", have);
 		return;
 	}
 	if ((keyinfob = findinhash(fullwant)) == NULL) {
-		printf("Couldn't find key 0x%" PRIX64 ".\n", want);
+		printf("Couldn't find key 0x%016" PRIX64 ".\n", want);
 		return;
 	}