From 3d5610f901a5ad3939c12faa077a91894a409ad1 Mon Sep 17 00:00:00 2001 From: Dominik Loidolt <dominik.loidolt@univie.ac.at> Date: Mon, 17 Apr 2023 11:14:11 +0200 Subject: [PATCH] -b can now also be used for binary mode as --binary --- CHANGELOG.md | 2 +- cmp_tool.c | 11 +++++------ lib/cmp_io.c | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3707ef..2b5b5a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. ## [Unreleased] ### Added -- add --binary option for read and write files in binary format +- add -b or --binary option for read and write files in binary format - add cross compile file for sparc - add tests for the compression entity - add test for cmp_rdcu_cfg.c diff --git a/cmp_tool.c b/cmp_tool.c index f309699..847100f 100644 --- a/cmp_tool.c +++ b/cmp_tool.c @@ -73,7 +73,6 @@ enum { NO_HEADER, MODEL_ID, MODEL_COUTER, - BINARY_IO, }; static const struct option long_options[] = { @@ -90,7 +89,7 @@ static const struct option long_options[] = { {"no_header", no_argument, NULL, NO_HEADER}, {"model_id", required_argument, NULL, MODEL_ID}, {"model_counter", required_argument, NULL, MODEL_COUTER}, - {"binary", no_argument, NULL, BINARY_IO}, + {"binary", no_argument, NULL, 'b'}, {NULL, 0, NULL, 0} }; @@ -165,12 +164,15 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } - while ((opt = getopt_long(argc, argv, "ac:d:hi:m:no:vV", long_options, + while ((opt = getopt_long(argc, argv, "abc:d:hi:m:no:vV", long_options, NULL)) != -1) { switch (opt) { case 'a': /* --rdcu_par */ add_rdcu_pars = 1; break; + case 'b': + io_flags |= CMP_IO_BINARY; + break; case 'c': cmp_operation = 1; cfg_file_name = optarg; @@ -233,9 +235,6 @@ int main(int argc, char **argv) case MODEL_COUTER: model_counter_str = optarg; break; - case BINARY_IO: - io_flags |= CMP_IO_BINARY; - break; default: print_help(program_name); exit(EXIT_FAILURE); diff --git a/lib/cmp_io.c b/lib/cmp_io.c index a730ea9..b1ab76b 100644 --- a/lib/cmp_io.c +++ b/lib/cmp_io.c @@ -81,7 +81,7 @@ void print_help(const char *program_name) printf(" -o <prefix> Use the <prefix> for output files\n"); printf(" -n, --model_cfg Print a default model configuration and exit\n"); printf(" --diff_cfg Print a default 1d-differencing configuration and exit\n"); - printf(" --binary Read and write files in binary format\n"); + printf(" -b, --binary Read and write files in binary format\n"); printf(" --no_header Do not add a compression entity header in front of the compressed data\n"); printf(" -a, --rdcu_par Add additional RDCU control parameters\n"); printf(" -V, --version Print program version and exit\n"); -- GitLab