X-Git-Url: http://the.earth.li/gitweb/?a=blobdiff_plain;ds=sidebyside;f=stats.c;h=59b42a574d4315634684d60bb525795d9d8663d1;hb=23538b7a1fe44e6e04e15d58b6fe809a6ad2ca31;hp=2e810bb0ebc86a0d6417048d678b740324b3ea57;hpb=0c120d1895d25b59abe338862189be1b87447569;p=onak.git
diff --git a/stats.c b/stats.c
index 2e810bb..59b42a5 100644
--- a/stats.c
+++ b/stats.c
@@ -13,18 +13,18 @@
* more details.
*
* You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * this program. If not, see .
*/
#include
#include
#include
+#include
#include "cleanup.h"
-#include "getcgi.h"
#include "hash.h"
#include "keydb.h"
+#include "keyindex.h"
#include "ll.h"
#include "stats.h"
@@ -137,25 +137,22 @@ void dofindpath(struct onak_dbctx *dbctx,
uint64_t have, uint64_t want, bool html, int count)
{
struct stats_key *keyinfoa, *keyinfob, *curkey;
- uint64_t fullhave, fullwant;
int rec;
int pathnum;
char *uid;
-
- fullhave = dbctx->getfullkeyid(dbctx, have);
- fullwant = dbctx->getfullkeyid(dbctx, want);
+ char buf[1024];
/*
* Make sure the keys we have and want are in the cache.
*/
- (void) dbctx->cached_getkeysigs(dbctx, fullhave);
- (void) dbctx->cached_getkeysigs(dbctx, fullwant);
+ (void) dbctx->cached_getkeysigs(dbctx, have);
+ (void) dbctx->cached_getkeysigs(dbctx, want);
- if ((keyinfoa = findinhash(fullhave)) == NULL) {
+ if ((keyinfoa = findinhash(have)) == NULL) {
printf("Couldn't find key 0x%016" PRIX64 ".\n", have);
return;
}
- if ((keyinfob = findinhash(fullwant)) == NULL) {
+ if ((keyinfob = findinhash(want)) == NULL) {
printf("Couldn't find key 0x%016" PRIX64 ".\n", want);
return;
}
@@ -177,8 +174,8 @@ void dofindpath(struct onak_dbctx *dbctx,
html ? "
" : "");
if (keyinfoa->colour == 0) {
if (pathnum == 0) {
- printf("Can't find a link from 0x%08" PRIX64
- " to 0x%08" PRIX64 "%s\n",
+ printf("Can't find a link from 0x%016" PRIX64
+ " to 0x%016" PRIX64 "%s\n",
have,
want,
html ? "
" : "");
@@ -188,10 +185,10 @@ void dofindpath(struct onak_dbctx *dbctx,
}
pathnum = count;
} else {
- printf("%d steps from 0x%08" PRIX64 " to 0x%08" PRIX64
- "%s\n",
- keyinfoa->colour, have & 0xFFFFFFFF,
- want & 0xFFFFFFFF,
+ printf("%d steps from 0x%016" PRIX64 " to 0x%016"
+ PRIX64 "%s\n",
+ keyinfoa->colour, have,
+ want,
html ? "
" : "");
curkey = keyinfoa;
while (curkey != NULL && curkey->keyid != 0) {
@@ -199,34 +196,35 @@ void dofindpath(struct onak_dbctx *dbctx,
curkey->keyid);
if (html && uid == NULL) {
printf("0x%08" PRIX64
- " (["
+ "0x%016" PRIX64 "\">0x%016"
+ PRIX64 " (["
"User id not found])%s
\n",
- curkey->keyid & 0xFFFFFFFF,
- curkey->keyid & 0xFFFFFFFF,
- (curkey->keyid == fullwant) ?
+ curkey->keyid,
+ curkey->keyid,
+ (curkey->keyid == want) ?
"" : " signs");
} else if (html && uid != NULL) {
printf("0x%08"
+ "0x%016" PRIX64 "\">0x%016"
PRIX64 ""
" (%s)%s"
"
\n",
- curkey->keyid & 0xFFFFFFFF,
- curkey->keyid & 0xFFFFFFFF,
- curkey->keyid & 0xFFFFFFFF,
- txt2html(uid),
- (curkey->keyid == fullwant) ?
+ curkey->keyid,
+ curkey->keyid,
+ curkey->keyid,
+ html_escape(uid, strlen(uid),
+ buf, sizeof(buf)),
+ (curkey->keyid == want) ?
"" : " signs");
} else {
- printf("0x%08" PRIX64 " (%s)%s\n",
- curkey->keyid & 0xFFFFFFFF,
+ printf("0x%016" PRIX64 " (%s)%s\n",
+ curkey->keyid,
(uid == NULL) ?
"[User id not found]" :
uid,
- (curkey->keyid == fullwant) ?
+ (curkey->keyid == want) ?
"" : " signs");
}
if (uid != NULL) {
@@ -245,8 +243,8 @@ void dofindpath(struct onak_dbctx *dbctx,
}
curkey = keyinfoa;
while (curkey != NULL && curkey->keyid != 0) {
- printf("0x%08" PRIX64 " ",
- curkey->keyid & 0xFFFFFFFF);
+ printf("0x%016" PRIX64 " ",
+ curkey->keyid);
curkey = findinhash(curkey->parent);
}
putchar('\n');