zdump/opts: Make parsing of command line arguments testable

Make the C module responsible for the parsing of command-line arguments
independent of other global variables. This improves its testability.

Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Alexander Egorenkov
2021-10-11 16:09:07 +02:00
committed by Jan Höppner
parent 1005e7be7e
commit df338a3bac
4 changed files with 155 additions and 142 deletions
+38
View File
@@ -0,0 +1,38 @@
/*
* Copyright IBM Corp. 2001, 2018
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*/
#ifndef OPTS_H
#define OPTS_H
#include "zg.h"
/*
* zgetdump options
*/
struct options {
const char *prog_name;
int action_specified;
enum zg_action action;
char *device;
char *mount_point;
int fmt_specified;
const char *fmt;
int debug_specified;
char **argv_fuse;
int argc_fuse;
const char *select;
int select_specified;
int verbose;
};
extern const char *OPTS_SELECT_KDUMP;
extern const char *OPTS_SELECT_PROD;
extern const char *OPTS_SELECT_ALL;
void opts_parse(int argc, char *argv[], struct options *opts);
#endif /* OPTS_H */