Base: LCDproc 0.5.2
[lcdproc-de200c.git] / server / commands / command_list.c
blob1d3f97e313f2ed6040cce021f5d6e99a926ca25e
1 /*
2 * commands/command_list.c
3 * This file is part of LCDd, the lcdproc server.
5 * This file is released under the GNU General Public License. Refer to the
6 * COPYING file distributed with this package.
8 * Copyright (c) 1999, William Ferrell, Scott Scriven
9 * 2003, Joris Robijn
12 * This contains definitions for all the functions which clients can run.
13 * The functions here are to be called only from parse.c's interpreter.
15 * The client's available function set is defined here, as is the syntax
16 * for each command. <-- TODO !
20 #include "command_list.h"
21 #include "server_commands.h"
22 #include "client_commands.h"
23 #include "screen_commands.h"
24 #include "widget_commands.h"
25 #include "menu_commands.h"
27 #include <stdlib.h>
28 #include <string.h>
30 static client_function commands[] = {
31 { "test_func", test_func_func },
32 { "hello", hello_func },
33 { "client_set", client_set_func },
34 { "client_add_key", client_add_key_func },
35 { "client_del_key", client_del_key_func },
36 /* { "screen_add_key", screen_add_key_func }, */
37 /* { "screen_del_key", screen_del_key_func }, */
38 { "screen_add", screen_add_func },
39 { "screen_del", screen_del_func },
40 { "screen_set", screen_set_func },
41 { "widget_add", widget_add_func },
42 { "widget_del", widget_del_func },
43 { "widget_set", widget_set_func },
44 { "menu_add_item", menu_add_item_func },
45 { "menu_del_item", menu_del_item_func },
46 { "menu_set_item", menu_set_item_func },
47 { "menu_goto", menu_goto_func },
48 { "menu_set_main", menu_set_main_func },
49 /* Misc stuff...*/
50 { "backlight", backlight_func },
51 { "output", output_func },
52 { "noop", noop_func },
53 { "info", info_func },
54 { "sleep", sleep_func },
55 { "bye", bye_func },
56 { NULL, NULL},
60 CommandFunc get_command_function(char *cmd)
62 int i;
64 if (cmd == NULL)
65 return NULL;
67 for (i = 0; commands[i].keyword != NULL; i++) {
68 if (0 == strcmp(cmd, commands[i].keyword))
69 return commands[i].function;
72 return NULL;