1 /***************************************************************************
2 * Copyright (C) 2009 Zachary T Welch <zw@superlucidity.net> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18 ***************************************************************************/
25 static COMMAND_HELPER(handle_hello_args, const char **sep, const char **name)
29 LOG_ERROR("%s: too many arguments", CMD_NAME);
30 return ERROR_COMMAND_SYNTAX_ERROR;
42 COMMAND_HANDLER(handle_hello_command)
44 const char *sep, *name;
45 int retval = CALL_COMMAND_HANDLER(handle_hello_args, &sep, &name);
46 if (ERROR_OK == retval)
47 command_print(cmd_ctx, "Greetings%s%s!", sep, name);
51 int hello_register_commands(struct command_context_s *cmd_ctx)
53 struct command_s *cmd = register_command(cmd_ctx, NULL, "hello",
54 &handle_hello_command, COMMAND_ANY,
56 return cmd ? ERROR_OK : -ENOMEM;