aboutsummaryrefslogtreecommitdiff
path: root/analyzer/commands.h
diff options
context:
space:
mode:
authorMaciej Borowiec <81316152+Mosder@users.noreply.github.com>2026-07-23 20:17:15 +0200
committerGitHub <noreply@github.com>2026-07-23 20:17:15 +0200
commit3419cad016b3c34d0630456d4390c70063462d91 (patch)
tree3a1aa4416e45f134d38f83d4ea2285f1972f9391 /analyzer/commands.h
parent2e3f7fe39791cd671a68330f7ba7a5bb5fc6f9ae (diff)
parent682f9fc8288fdd01de1d88af87495d9e43f56b06 (diff)
LGTM
Diffstat (limited to 'analyzer/commands.h')
-rw-r--r--analyzer/commands.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/analyzer/commands.h b/analyzer/commands.h
new file mode 100644
index 0000000..f53a140
--- /dev/null
+++ b/analyzer/commands.h
@@ -0,0 +1,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();