--- lbbs/include/bbs_cmd.h 2005/03/22 13:43:16 1.2 +++ lbbs/include/bbs_cmd.h 2025/06/24 10:01:24 1.9 @@ -1,35 +1,45 @@ /*************************************************************************** - bbs_cmd.h - description - ------------------- - begin : Wed Mar 16 2004 - copyright : (C) 2005 by Leaflet - email : leaflet@leafok.com + bbs_cmd.h - description + ------------------- + Copyright : (C) 2004-2025 by Leaflet + Email : leaflet@leafok.com ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * + * the Free Software Foundation; either version 3 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ +#ifndef _BBS_CMD_H_ +#define _BBS_CMD_H_ -#define MAX_CMD_LENGTH 20 -#define MAX_CMD_ID 100 +#define MAX_CMD_LENGTH 20 -#define UNKNOWN_CMD 0xff -#define EXITBBS 0x1 -#define BBSNET 0x2 -#define LICENSE 0x3 -#define COPYRIGHT 0x4 +enum menu_return_t +{ + MENU_OK = 0x0, + REDRAW = 0x1, + NOREDRAW = 0x2, + EXITMENU = 0x3, + UNKNOWN_CMD = 0xff, + EXITBBS = 0xfe, +}; + +typedef int (*bbs_cmd_handler)(void *p_param); struct _bbs_cmd { - char cmd[MAX_CMD_LENGTH]; - int value; + const char *cmd; + bbs_cmd_handler handler; }; typedef struct _bbs_cmd BBS_CMD; -extern BBS_CMD bbs_cmd_list[MAX_CMD_ID]; +extern int load_cmd(); + +extern bbs_cmd_handler get_cmd_handler(const char *cmd); + +#endif //_BBS_CMD_H_