cmd.h (429B)
1#pragma once 2 3#include <stdlib.h> 4#include <stdbool.h> 5 6typedef bool (*cmd_func)(const char *args); 7 8struct cmd { 9 const char *name; 10 cmd_func func; 11}; 12 13void cmd_init(void); 14void cmd_deinit(void); 15 16bool cmd_run(const char *name, bool *found); 17bool cmd_rerun(void); 18 19const struct cmd *cmd_get(const char *name); 20const struct cmd *cmd_find(const char *name); 21 22extern const struct cmd commands[]; 23extern const size_t command_count;