42 lines
1 KiB
C
42 lines
1 KiB
C
|
|
#ifndef ARGS_H
|
||
|
|
#define ARGS_H
|
||
|
|
|
||
|
|
#include <stdbool.h>
|
||
|
|
|
||
|
|
enum input_type
|
||
|
|
{
|
||
|
|
INPUT_UNDEFINED,
|
||
|
|
INPUT_FILE,
|
||
|
|
INPUT_CMD,
|
||
|
|
INPUT_STDIN
|
||
|
|
};
|
||
|
|
|
||
|
|
struct args_options
|
||
|
|
{
|
||
|
|
/** Source of the input, filename or command string depending on type, NULL
|
||
|
|
* if INPUT_STDIN */
|
||
|
|
const char *input_source;
|
||
|
|
/** Type of the input source */
|
||
|
|
enum input_type type;
|
||
|
|
/** Enable or disable pretty printing of outputs */
|
||
|
|
bool pretty_print;
|
||
|
|
/** Enable or disable verbose mode */
|
||
|
|
bool verbose;
|
||
|
|
};
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Handles command-line arguments and populates the args_options structure.
|
||
|
|
* @param argc The argument count.
|
||
|
|
* @param argv The argument vector.
|
||
|
|
* @param options Pointer to args_options structure to be populated.
|
||
|
|
* @return 0 on success, non-zero on failure.
|
||
|
|
*/
|
||
|
|
int args_handler(int argc, char **argv, struct args_options *options);
|
||
|
|
|
||
|
|
/** Prints the parsed arguments for debugging purposes.
|
||
|
|
* @param options Pointer to args_options structure containing parsed options.
|
||
|
|
*/
|
||
|
|
void args_print(struct args_options *options);
|
||
|
|
|
||
|
|
#endif /* ARGS_H */
|