diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2020-12-11 20:13:43 +0100 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2020-12-11 20:13:43 +0100 |
commit | 8dc996f6d89652d71c6c4fff87f7923bbfbb9a34 (patch) | |
tree | 66654d7fabd4a792989d7a32147ba688853c76fa /src/main.c | |
parent | 3b3d30aedf3d8762558e9aef846ca94dc492fa96 (diff) | |
download | polecat-8dc996f6d89652d71c6c4fff87f7923bbfbb9a34.tar.gz polecat-8dc996f6d89652d71c6c4fff87f7923bbfbb9a34.zip |
move command definitions (as well as helpers) to macros
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 24 |
1 files changed, 3 insertions, 21 deletions
@@ -18,20 +18,9 @@ const static struct Command main_commands[] = { }; -int main(int argc, char** argv) -{ - if (argc > 1) - { - for (int i = 0; i < ARRAY_LEN(main_commands); ++i) - { - if (!strcmp(main_commands[i].name, argv[1])) return main_commands[i].func(argc-1, argv+1); - } - } - - return main_help(argc-1, argv+1); -} +COMMAND_GROUP_FUNC(main) -int main_env(int argc, char** argv) +COMMAND(main, env) { char buffer[PATH_MAX]; @@ -51,11 +40,4 @@ int main_env(int argc, char** argv) return 0; } -int main_help(int argc, char** argv) -{ - puts(USAGE_STR " <command>\n\nList of commands:"); - - print_help(main_commands, ARRAY_LEN(main_commands)); - - return 0; -}
\ No newline at end of file +COMMAND_HELP(main, "")
\ No newline at end of file |