Added argument parser and set all logs to STDERR

This commit is contained in:
Nikita Tyukalov, ASUS, Linux
2026-03-24 20:44:22 +03:00
parent 1cc2ef41d1
commit c8b0a5fe5a
5 changed files with 170 additions and 17 deletions

23
utils.h
View File

@@ -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