2 Commits

Author SHA1 Message Date
7c8931dea9 rename env file used by Task 2026-04-08 21:53:48 +01:00
f76b4c5f8a upd docstrings 2026-04-08 21:30:45 +01:00
4 changed files with 26 additions and 6 deletions

View File

11
.gitignore vendored
View File

@@ -1,3 +1,6 @@
# Generated by ignr: github.com/onyx-and-iris/ignr
## C ##
# Prerequisites # Prerequisites
*.d *.d
@@ -51,11 +54,13 @@ Module.symvers
Mkfile.old Mkfile.old
dkms.conf dkms.conf
# Task Runner # debug information files
.task/ *.dwo
# End of ignr
.task/
.vscode/ .vscode/
test/ test/
test-* test-*

View File

@@ -1,6 +1,6 @@
version: '3' version: '3'
dotenv: ['.env'] dotenv: ['.Taskfile.env']
vars: vars:
PROGRAM: vmrcli PROGRAM: vmrcli

View File

@@ -65,7 +65,7 @@ struct result
}; };
/** /**
* @struct A struct to hold the program configuration, set by CLI args * @struct A struct to hold the program configuration, set by CLI flags
*/ */
struct config_t { struct config_t {
bool mflag; bool mflag;
@@ -96,6 +96,14 @@ static void parse_input(const struct context_t *context, char *input, char *deli
static void parse_command(const struct context_t *context, char *command); static void parse_command(const struct context_t *context, char *command);
static void get(PT_VMR vmr, char *command, struct result *res); static void get(PT_VMR vmr, char *command, struct result *res);
/**
* @brief Parse CLI flags and set the program configuration accordingly.
*
* @param config Pointer to the configuration struct to be filled
* @param argc Number of command-line arguments
* @param argv Array of command-line arguments
* @return int Index of the first non-option argument
*/
int get_options(struct config_t *config, int argc, char *argv[]) int get_options(struct config_t *config, int argc, char *argv[])
{ {
static const struct option options[] = static const struct option options[] =
@@ -196,6 +204,13 @@ int get_options(struct config_t *config, int argc, char *argv[])
return optind; return optind;
} }
/**
* @brief Entry point of the program.
*
* @param argc Number of command-line arguments
* @param argv Array of command-line arguments
* @return int Exit status
*/
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
struct context_t context = {0}; struct context_t context = {0};
@@ -282,7 +297,7 @@ static void terminate(PT_VMR vmr, char *msg)
} }
/** /**
* @brief Prints the help message * @brief Prints the help message and exits with success status
*/ */
static void usage() static void usage()
{ {