Added argument parser and set all logs to STDERR
This commit is contained in:
23
utils.h
23
utils.h
@@ -1,6 +1,29 @@
|
||||
#ifndef __UTILS_H
|
||||
#define __UTILS_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
// 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
|
||||
|
||||
Reference in New Issue
Block a user