diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/rpki-client/output-json.c | 68 | ||||
-rw-r--r-- | usr.sbin/rpki-client/output.c | 37 |
2 files changed, 46 insertions, 59 deletions
diff --git a/usr.sbin/rpki-client/output-json.c b/usr.sbin/rpki-client/output-json.c index eb39ef2c60b..36bd01792a6 100644 --- a/usr.sbin/rpki-client/output-json.c +++ b/usr.sbin/rpki-client/output-json.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output-json.c,v 1.7 2020/04/28 13:41:35 deraadt Exp $ */ +/* $OpenBSD: output-json.c,v 1.8 2020/04/28 15:04:05 deraadt Exp $ */ /* * Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org> * @@ -35,44 +35,34 @@ outputheader_json(FILE *out, struct stats *st) gethostname(hn, sizeof hn); - if (fprintf(out, "{\n\t\"metadata\": {\n") < 0) - return -1; - if (fprintf(out, "\t\t\"buildmachine\": \"%s\",\n", hn) < 0) - return -1; - if (fprintf(out, "\t\t\"buildtime\": \"%s\",\n", tbuf) < 0) - return -1; - - if (fprintf(out, "\t\t\"roas\": %zu,\n", st->roas) < 0) - return -1; - if (fprintf(out, "\t\t\"failedroas\": %zu,\n", st->roas_fail) < 0) - return -1; - if (fprintf(out, "\t\t\"invalidroas\": %zu,\n", st->roas_invalid) < 0) - return -1; - if (fprintf(out, "\t\t\"tals\": %zu,\n", st->tals) < 0) - return -1; - if (fprintf(out, "\t\t\"talfiles\": \"%s\",\n", st->talnames) < 0) - return -1; - if (fprintf(out, "\t\t\"certificates\": %zu,\n", st->certs) < 0) - return -1; - if (fprintf(out, "\t\t\"failcertificates\": %zu,\n", st->certs_fail) < 0) - return -1; - if (fprintf(out, "\t\t\"invalidcertificates\": %zu,\n", st->certs_invalid) < 0) - return -1; - if (fprintf(out, "\t\t\"manifests\": %zu,\n", st->mfts) < 0) - return -1; - if (fprintf(out, "\t\t\"failedmanifests\": %zu,\n", st->mfts_fail) < 0) - return -1; - if (fprintf(out, "\t\t\"stalemanifests\": %zu,\n", st->mfts_stale) < 0) - return -1; - if (fprintf(out, "\t\t\"crls\": %zu,\n", st->crls) < 0) - return -1; - if (fprintf(out, "\t\t\"repositories\": %zu,\n", st->repos) < 0) - return -1; - if (fprintf(out, "\t\t\"vrps\": %zu,\n", st->vrps) < 0) - return -1; - if (fprintf(out, "\t\t\"uniquevrps\": %zu\n", st->uniqs) < 0) - return -1; - if (fprintf(out, "\t},\n\n") < 0) + if (fprintf(out, + "{\n\t\"metadata\": {\n" + "\t\t\"buildmachine\": \"%s\",\n" + "\t\t\"buildtime\": \"%s\",\n" + "\t\t\"roas\": %zu,\n" + "\t\t\"failedroas\": %zu,\n" + "\t\t\"invalidroas\": %zu,\n" + "\t\t\"tals\": %zu,\n" + "\t\t\"talfiles\": \"%s\",\n" + "\t\t\"certificates\": %zu,\n" + "\t\t\"failcertificates\": %zu,\n" + "\t\t\"invalidcertificates\": %zu,\n" + "\t\t\"manifests\": %zu,\n" + "\t\t\"failedmanifests\": %zu,\n" + "\t\t\"stalemanifests\": %zu,\n" + "\t\t\"crls\": %zu,\n" + "\t\t\"repositories\": %zu,\n" + "\t\t\"vrps\": %zu,\n" + "\t\t\"uniquevrps\": %zu\n" + "\t},\n\n", + hn, tbuf, + st->roas, st->roas_fail, st->roas_invalid, + st->tals, st->talnames, + st->certs, st->certs_fail, st->certs_invalid, + st->mfts, st->mfts_fail, st->mfts_stale, + st->crls, + st->repos, + st->vrps, st->uniqs) < 0) return -1; return 0; } diff --git a/usr.sbin/rpki-client/output.c b/usr.sbin/rpki-client/output.c index 41c21af552e..92db14a560e 100644 --- a/usr.sbin/rpki-client/output.c +++ b/usr.sbin/rpki-client/output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output.c,v 1.11 2020/04/28 13:41:35 deraadt Exp $ */ +/* $OpenBSD: output.c,v 1.12 2020/04/28 15:04:05 deraadt Exp $ */ /* * Copyright (c) 2019 Theo de Raadt <deraadt@openbsd.org> * @@ -183,26 +183,23 @@ outputheader(FILE *out, struct stats *st) gethostname(hn, sizeof hn); - if (fprintf(out, "# Generated on host %s at %s\n", hn, tbuf) < 0) - return -1; if (fprintf(out, - "# Route Origin Authorizations: %zu (%zu failed parse, %zu invalid)\n", - st->roas, st->roas_fail, st->roas_invalid) < 0) - return -1; - if (fprintf(out, "# Certificates: %zu (%zu failed parse, %zu invalid)\n", - st->certs, st->certs_fail, st->certs_invalid) < 0) - return -1; - if (fprintf(out, "# Trust Anchor Locators: %zu (%s)\n", - st->tals, st->talnames) < 0) - return -1; - if (fprintf(out, "# Manifests: %zu (%zu failed parse, %zu stale)\n", - st->mfts, st->mfts_fail, st->mfts_stale) < 0) - return -1; - if (fprintf(out, "# Certificate revocation lists: %zu\n", st->crls) < 0) - return -1; - if (fprintf(out, "# Repositories: %zu\n", st->repos) < 0) - return -1; - if (fprintf(out, "# VRP Entries: %zu (%zu unique)\n", st->vrps, st->uniqs) < 0) + "# Generated on host %s at %s\n" + "# Route Origin Authorizations: %zu (%zu failed parse, %zu invalid)\n" + "# Certificates: %zu (%zu failed parse, %zu invalid)\n" + "# Trust Anchor Locators: %zu (%s)\n" + "# Manifests: %zu (%zu failed parse, %zu stale)\n" + "# Certificate revocation lists: %zu\n" + "# Repositories: %zu\n" + "# VRP Entries: %zu (%zu unique)\n", + hn, tbuf, + st->roas, st->roas_fail, st->roas_invalid, + st->certs, st->certs_fail, st->certs_invalid, + st->tals, st->talnames, + st->mfts, st->mfts_fail, st->mfts_stale, + st->crls, + st->repos, + st->vrps, st->uniqs) < 0) return -1; return 0; } |