From 5f189e6208e5165343ebdced86e01d8b67cb2089 Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Tue, 16 Apr 2013 15:23:04 +0200 Subject: [PATCH] change json to ycfg --- ykpers-args.c | 9 ++++----- ykpers.c | 4 ++-- ykpers.h | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ykpers-args.c b/ykpers-args.c index 98e7db1..7ed0a49 100644 --- a/ykpers-args.c +++ b/ykpers-args.c @@ -65,8 +65,7 @@ const char *usage = " (if FILE is -, send to stdout)\n" "-iFILE read configuration from FILE.\n" " (if FILE is -, read from stdin)\n" -"-fformat set the data format for -s and -i (and for standard write to console\n" -" valid values are json or legacy.\n" +"-fformat set the data format for -s and -i valid values are ycfg or legacy.\n" "-aXXX.. The AES secret key as a 32 (or 40 for OATH-HOTP/HMAC CHAL-RESP)\n" " char hex value (not modhex)\n" "-cXXX.. A 12 char hex value (not modhex) to use as access code for programming\n" @@ -374,12 +373,12 @@ int args_to_config(int argc, char **argv, YKP_CONFIG *cfg, YK_KEY *yk, *outfname = optarg; break; case 'f': - if(strcmp(optarg, "json") == 0) { - *data_format = YKP_FORMAT_JSON; + if(strcmp(optarg, "ycfg") == 0) { + *data_format = YKP_FORMAT_YCFG; } else if(strcmp(optarg, "legacy") == 0) { *data_format = YKP_FORMAT_LEGACY; } else { - fprintf(stderr, "The only valid formats to -f is json and legacy.\n"); + fprintf(stderr, "The only valid formats to -f is ycfg and legacy.\n"); *exit_code = 1; return 0; } diff --git a/ykpers.c b/ykpers.c index 6b83c18..510dbef 100644 --- a/ykpers.c +++ b/ykpers.c @@ -996,7 +996,7 @@ static int ykp_legacy_export_config(const YKP_CONFIG *cfg, char *buf, size_t len int ykp_export_config(const YKP_CONFIG *cfg, char *buf, size_t len, int format) { - if(format == YKP_FORMAT_JSON) { + if(format == YKP_FORMAT_YCFG) { return ykp_json_export_cfg(cfg, buf, len); } else if(format == YKP_FORMAT_LEGACY) { return ykp_legacy_export_config(cfg, buf, len); @@ -1008,7 +1008,7 @@ int ykp_export_config(const YKP_CONFIG *cfg, char *buf, size_t len, int ykp_import_config(const char *buf, size_t len, YKP_CONFIG *cfg, int format) { - if(format == YKP_FORMAT_JSON) { + if(format == YKP_FORMAT_YCFG) { return ykp_json_import_cfg(buf, len, cfg); } else if(format == YKP_FORMAT_LEGACY) { ykp_errno = YKP_ENOTYETIMPL; diff --git a/ykpers.h b/ykpers.h index 5a81707..8369703 100644 --- a/ykpers.h +++ b/ykpers.h @@ -141,7 +141,7 @@ int ykp_export_config(const YKP_CONFIG *cfg, char *buf, size_t len, int format); int ykp_import_config(const char *buf, size_t len, YKP_CONFIG *cfg, int format); #define YKP_FORMAT_LEGACY 0x01 -#define YKP_FORMAT_JSON 0x02 +#define YKP_FORMAT_YCFG 0x02 extern int * _ykp_errno_location(void); #define ykp_errno (*_ykp_errno_location()) -- 2.39.5