mirror of
https://github.com/onyx-and-iris/vmrcli.git
synced 2026-04-09 12:53:32 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7c8931dea9 | |||
| f76b4c5f8a |
11
.gitignore
vendored
11
.gitignore
vendored
@@ -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-*
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
version: '3'
|
version: '3'
|
||||||
|
|
||||||
dotenv: ['.env']
|
dotenv: ['.Taskfile.env']
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
PROGRAM: vmrcli
|
PROGRAM: vmrcli
|
||||||
|
|||||||
19
src/vmrcli.c
19
src/vmrcli.c
@@ -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()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user