aboutsummaryrefslogtreecommitdiff
path: root/analyzer/commands.h
blob: f53a1407b523bb24cae38fbf5fdc9bf8c688bbfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// commands.h
// commands to use in the program

#include <stddef.h>

#define MAX_EXPLANATION_LINES 3

typedef struct {
    char *name;
    char *short_name;
    char *args_str;
    char *explanation[MAX_EXPLANATION_LINES];
    size_t explanation_lines;
    int (*handler)(int argc, char *argv[]);
} Command;

// all commands of the program
extern const Command commands[];
extern const size_t commands_count;

// check if the given command is represented by the given string
// params:
//      - command - potentailly represented command
//      - str - potentially representing string
// returns:
//      1 if command is represneted by string, 0 if not
extern int is_command(Command command, char *str);

// print information about help when program didn't recognize command
extern void command_not_recognized();