From 6c965e26b1a93da63948edae6b68564be1ded507 Mon Sep 17 00:00:00 2001 From: tb <> Date: Mon, 6 Mar 2023 14:32:06 +0000 Subject: Rename struct ${app}_config to plain cfg All the structs are static and we need to reach into them many times. Having a shorter name is more concise and results in less visual clutter. It also avoids many overlong lines and we will be able to get rid of some unfortunate line wrapping down the road. Discussed with jsing --- src/usr.bin/openssl/certhash.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/usr.bin/openssl/certhash.c') diff --git a/src/usr.bin/openssl/certhash.c b/src/usr.bin/openssl/certhash.c index 785f1216ad..5ee29b8d01 100644 --- a/src/usr.bin/openssl/certhash.c +++ b/src/usr.bin/openssl/certhash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: certhash.c,v 1.20 2022/11/11 17:07:38 joshua Exp $ */ +/* $OpenBSD: certhash.c,v 1.21 2023/03/06 14:32:05 tb Exp $ */ /* * Copyright (c) 2014, 2015 Joel Sing * @@ -36,20 +36,20 @@ static struct { int dryrun; int verbose; -} certhash_config; +} cfg; static const struct option certhash_options[] = { { .name = "n", .desc = "Perform a dry-run - do not make any changes", .type = OPTION_FLAG, - .opt.flag = &certhash_config.dryrun, + .opt.flag = &cfg.dryrun, }, { .name = "v", .desc = "Verbose", .type = OPTION_FLAG, - .opt.flag = &certhash_config.verbose, + .opt.flag = &cfg.verbose, }, { NULL }, }; @@ -569,7 +569,7 @@ certhash_directory(const char *path) goto err; } - if (certhash_config.verbose) + if (cfg.verbose) fprintf(stdout, "scanning directory %s\n", path); /* Create lists of existing hash links, certs and CRLs. */ @@ -594,11 +594,11 @@ certhash_directory(const char *path) if (link->exists == 0 || (link->reference != NULL && link->changed == 0)) continue; - if (certhash_config.verbose) + if (cfg.verbose) fprintf(stdout, "%s link %s -> %s\n", - (certhash_config.dryrun ? "would remove" : + (cfg.dryrun ? "would remove" : "removing"), link->filename, link->target); - if (certhash_config.dryrun) + if (cfg.dryrun) continue; if (unlink(link->filename) == -1) { fprintf(stderr, "failed to remove link %s\n", @@ -611,12 +611,12 @@ certhash_directory(const char *path) for (link = links; link != NULL; link = link->next) { if (link->exists == 1 && link->changed == 0) continue; - if (certhash_config.verbose) + if (cfg.verbose) fprintf(stdout, "%s link %s -> %s\n", - (certhash_config.dryrun ? "would create" : + (cfg.dryrun ? "would create" : "creating"), link->filename, link->reference->filename); - if (certhash_config.dryrun) + if (cfg.dryrun) continue; if (symlink(link->reference->filename, link->filename) == -1) { fprintf(stderr, "failed to create link %s -> %s\n", @@ -658,7 +658,7 @@ certhash_main(int argc, char **argv) exit(1); } - memset(&certhash_config, 0, sizeof(certhash_config)); + memset(&cfg, 0, sizeof(cfg)); if (options_parse(argc, argv, certhash_options, NULL, &argsused) != 0) { certhash_usage(); -- cgit v1.2.3-55-g6feb