38 lines
762 B
C
38 lines
762 B
C
#ifndef __UTILS_H
|
|
#define __UTILS_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
/*
|
|
* Public data
|
|
*/
|
|
extern int flag_verbose;
|
|
|
|
/*
|
|
* Public API
|
|
*/
|
|
// Print usage text.
|
|
void print_usage_text();
|
|
|
|
// Set CLI argument.
|
|
// Parameters:
|
|
// - key - argument key (without leading dash)
|
|
// - value - argument value as string
|
|
// Returns:
|
|
// - true on success
|
|
// - false on failure
|
|
// Remarks:
|
|
// - neither key nor value are copied, they are saved as pointers
|
|
// - use this function only with data from argv
|
|
bool cli_arg_set(const char *key, char *value);
|
|
|
|
// Get CLI argument.
|
|
// Parameters:
|
|
// - key - argument key (without leading dash)
|
|
// Returns:
|
|
// - pointer to the value (not owned by you)
|
|
// - NULL on failure
|
|
const char *cli_arg_get(const char *key);
|
|
|
|
#endif
|