From 307107ecd2fc3ffbf6fe91497daf767700f3572f Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 1 Sep 2019 22:42:49 +0200 Subject: Move command line processing stuff out of compressor code This commit moves stuff like printing help text, command line option processing and enumerating available processors on stdout out of the generic compressor code. The option string is replaced with a structure that directly exposese the tweakable parameters for all compressors. A function for parsing the command line arguments into this structure is added in sqfshelper. Signed-off-by: David Oberhollenzer --- tar/tar2sqfs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tar/tar2sqfs.c') diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c index 1e70562..c0f8a14 100644 --- a/tar/tar2sqfs.c +++ b/tar/tar2sqfs.c @@ -355,6 +355,7 @@ fail: int main(int argc, char **argv) { int outfd, status = EXIT_SUCCESS; + compressor_config_t cfg; data_writer_t *data; sqfs_super_t super; compressor_t *cmp; @@ -364,6 +365,11 @@ int main(int argc, char **argv) process_args(argc, argv); + if (compressor_cfg_init_options(&cfg, comp_id, + block_size, comp_extra)) { + return EXIT_FAILURE; + } + outfd = open(filename, outmode, 0644); if (outfd < 0) { perror(filename); @@ -373,7 +379,7 @@ int main(int argc, char **argv) if (fstree_init(&fs, block_size, fs_defaults)) goto out_fd; - cmp = compressor_create(comp_id, true, block_size, comp_extra); + cmp = compressor_create(&cfg); if (cmp == NULL) { fputs("Error creating compressor\n", stderr); goto out_fs; -- cgit v1.2.3