Skip to content

Commit

Permalink
Add 'sbctl get' options bitmasks, get_opts[] array
Browse files Browse the repository at this point in the history
  • Loading branch information
nickolasburr committed Jan 13, 2018
1 parent fbd4b49 commit 4f43197
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
24 changes: 21 additions & 3 deletions include/argv.h
Expand Up @@ -12,9 +12,13 @@
#include "utils.h"

/**
* Commands
* ASCII character codes.
*/
#define ASCII_PERCENT 37

/**
* Commands
*/
#define NUM_CMDS 6

/**
Expand All @@ -31,6 +35,9 @@
* Command options
*/

/**
* Number of 'sbctl ls' options.
*/
#define NUM_LS_OPTS 5

/**
Expand All @@ -43,9 +50,19 @@
#define MASK_CMD_LIST_OPT_USB ((0xFF << 0x4))

/**
* ASCII character codes.
* Number of 'sbctl get' options.
*/
#define ASCII_PERCENT 37
#define NUM_GET_OPTS 1

/**
* Hex masks for 'sbctl get' options.
*/
#define MASK_CMD_GET_OPT_HELP ((0xFE << 0x0))

/**
* Example usage for 'sbctl get'.
*/
#define EXAMPLE_USAGE_CMD_GET "sbctl get %1"

typedef struct {
char *value;
Expand All @@ -63,6 +80,7 @@ typedef struct {
} Command_T;

static Command_T commands[NUM_CMDS];
static Option_T get_opts[NUM_GET_OPTS];
static Option_T ls_opts[NUM_LS_OPTS];

int ARGV_get_command_bitmask(const char *);
Expand Down
14 changes: 13 additions & 1 deletion src/argv.c
Expand Up @@ -85,7 +85,19 @@ static Option_T ls_opts[] = {
};

/**
* Initialize command->options[index] structs.
* sbctl get options.
*/
static Option_T get_opts[] = {
{
"--help",
"-h",
"Show usage information.",
MASK_CMD_GET_OPT_HELP,
},
};

/**
* Initialize command->options pointer array.
*/
void ARGV_init (void) {
int index;
Expand Down

0 comments on commit 4f43197

Please sign in to comment.