Survival Royale 1.0.0
A very simple yet funny card game.
Loading...
Searching...
No Matches
cli.c File Reference

Implementation of functions which handles CLI. More...

#include "cli.h"

Go to the source code of this file.

Functions

void getHelp (const char *scope)
 Prints the generic help message or a detailed help message describing a particular option.
int handleCLIArguments (char **argv, const int argc)
 It validates and intreprets the CLI options.
GameConfiguration getConfigurationFromArguments (char **argv, const int argc)
 Generates a game configuration from the given options. If some options are not specified, the default game configuration values for that option are used.

Detailed Description

Implementation of functions which handles CLI.

Definition in file cli.c.

Function Documentation

◆ getConfigurationFromArguments()

GameConfiguration getConfigurationFromArguments ( char ** argv,
const int argc )

Generates a game configuration from the given options. If some options are not specified, the default game configuration values for that option are used.

Parameters
argvThe CLI options vector.
argcThe length of argv.
Returns
The game configuration generated.

Definition at line 135 of file cli.c.

◆ getHelp()

void getHelp ( const char * scope)

Prints the generic help message or a detailed help message describing a particular option.

Parameters
scopeGeneric scope or a CLI option (shorthands are not handled).

Definition at line 23 of file cli.c.

◆ handleCLIArguments()

int handleCLIArguments ( char ** argv,
const int argc )

It validates and intreprets the CLI options.

Parameters
argvThe CLI options vector.
argcThe length of argv.
Returns
If the CLI options are legal, it returns a bit-masked action code meaning the action that the program has to take of, otherwise exits with EXIT_CLI_ILLEGAL. If the user was legally asking for help, it returns ACTION_HELP; otherwise it exits with EXIT_CLI_ILLEGAL.

Definition at line 72 of file cli.c.