2008-11-30 22:42:34 +00:00
|
|
|
/* \file server/commands/command_list.c
|
2007-06-23 21:41:50 +00:00
|
|
|
* Defines the dispatcher for handlers dealing with the client commands.
|
2002-04-26 00:00:31 +00:00
|
|
|
*
|
|
|
|
|
* This contains definitions for all the functions which clients can run.
|
|
|
|
|
* The functions here are to be called only from parse.c's interpreter.
|
|
|
|
|
*
|
|
|
|
|
* The client's available function set is defined here, as is the syntax
|
2002-06-28 23:35:55 +00:00
|
|
|
* for each command. <-- TODO !
|
2002-04-26 00:00:31 +00:00
|
|
|
*/
|
|
|
|
|
|
2008-11-30 22:42:34 +00:00
|
|
|
/* This file is part of LCDd, the lcdproc server.
|
|
|
|
|
*
|
|
|
|
|
* This file is released under the GNU General Public License.
|
|
|
|
|
* Refer to the COPYING file distributed with this package.
|
|
|
|
|
*
|
|
|
|
|
* Copyright (c) 1999, William Ferrell, Scott Scriven
|
|
|
|
|
* 2003, Joris Robijn
|
|
|
|
|
*/
|
|
|
|
|
|
2002-04-26 00:00:31 +00:00
|
|
|
#include "command_list.h"
|
|
|
|
|
#include "server_commands.h"
|
|
|
|
|
#include "client_commands.h"
|
|
|
|
|
#include "screen_commands.h"
|
|
|
|
|
#include "widget_commands.h"
|
|
|
|
|
#include "menu_commands.h"
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
2005-06-28 17:12:30 +00:00
|
|
|
#include <string.h>
|
2002-04-26 00:00:31 +00:00
|
|
|
|
2005-06-28 17:12:30 +00:00
|
|
|
static client_function commands[] = {
|
|
|
|
|
{ "test_func", test_func_func },
|
|
|
|
|
{ "hello", hello_func },
|
|
|
|
|
{ "client_set", client_set_func },
|
|
|
|
|
{ "client_add_key", client_add_key_func },
|
|
|
|
|
{ "client_del_key", client_del_key_func },
|
|
|
|
|
/* { "screen_add_key", screen_add_key_func }, */
|
|
|
|
|
/* { "screen_del_key", screen_del_key_func }, */
|
|
|
|
|
{ "screen_add", screen_add_func },
|
|
|
|
|
{ "screen_del", screen_del_func },
|
|
|
|
|
{ "screen_set", screen_set_func },
|
|
|
|
|
{ "widget_add", widget_add_func },
|
|
|
|
|
{ "widget_del", widget_del_func },
|
|
|
|
|
{ "widget_set", widget_set_func },
|
|
|
|
|
{ "menu_add_item", menu_add_item_func },
|
|
|
|
|
{ "menu_del_item", menu_del_item_func },
|
|
|
|
|
{ "menu_set_item", menu_set_item_func },
|
|
|
|
|
{ "menu_goto", menu_goto_func },
|
|
|
|
|
{ "menu_set_main", menu_set_main_func },
|
2002-04-26 00:00:31 +00:00
|
|
|
/* Misc stuff...*/
|
2005-06-28 17:12:30 +00:00
|
|
|
{ "backlight", backlight_func },
|
|
|
|
|
{ "output", output_func },
|
|
|
|
|
{ "noop", noop_func },
|
|
|
|
|
{ "info", info_func },
|
|
|
|
|
{ "sleep", sleep_func },
|
2006-05-07 16:49:31 +00:00
|
|
|
{ "bye", bye_func },
|
2005-06-28 17:12:30 +00:00
|
|
|
{ NULL, NULL},
|
2002-04-26 00:00:31 +00:00
|
|
|
};
|
2005-06-28 17:12:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
CommandFunc get_command_function(char *cmd)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (cmd == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
for (i = 0; commands[i].keyword != NULL; i++) {
|
|
|
|
|
if (0 == strcmp(cmd, commands[i].keyword))
|
|
|
|
|
return commands[i].function;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|