4 int cmd_do_testopchar(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
8 opchar=cmd_opchar_check(cmd_io,des,param);
9 if(opchar<0) return opchar;
12 "cmd_do_testopchar called\n"
18 param[0], param[1], param[2], param[3], opchar);
23 int cmd_do_testparam(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
26 "cmd_do_testparam called\n"
30 param[0], param[1], param[1] == NULL ? "!!unset!!" : param[2]);
35 int cmd_do_testerror(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
40 int cmd_do_test(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
42 printf("This is the simplest command\n");
46 int cmd_do_testcmdio(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
48 cmd_io_puts(cmd_io, "The first line of text\n");
49 cmd_io_puts(cmd_io, "The second line of text\n");
50 /* Only ED_LINE_CHARS character can be sent. */
54 cmd_des_t const **cmd_list;
56 cmd_des_t const cmd_des_help={
58 "HELP","prints help for commands",
59 cmd_do_help,{(char*)&cmd_list}};
62 cmd_des_t const cmd_des_val={
63 0, CDESM_OPCHR|CDESM_RW,
64 "VAL","use ':' or '?' to store/read value of an integer variable",
65 cmd_do_rw_int, {(char*)&val}};
67 cmd_des_t const cmd_des_valro={
68 0, CDESM_OPCHR|CDESM_RD,
69 "VALRO","read only access to an integer variable",
70 cmd_do_rw_int, {(char*)&val}};
72 cmd_des_t const cmd_des_valwo={
73 0, CDESM_OPCHR|CDESM_WR,
74 "VALWO","write only access to an integer variable",
75 cmd_do_rw_int, {(char*)&val}};
77 cmd_des_t const cmd_des_opchar_test={
78 0, CDESM_OPCHR|CDESM_RW,
79 "OPCHAR","opchar test (use ':' or '?' as suffix)",
82 cmd_des_t const cmd_des_opchar_testro={
83 0, CDESM_OPCHR|CDESM_RD,
84 "OPCHARRO","opchar test (only '?' is allowed)",
87 cmd_des_t const cmd_des_test={
89 "TEST","the simplest command",
92 cmd_des_t const cmd_des_testio={
94 "TESTIO","test of cmd_io inside functions (universal way to print results)",
97 cmd_des_t const cmd_des_param={
99 "PARAM","test of parameters",
102 cmd_des_t const cmd_des_prefix={
104 "PREFIX*","suffix of the command is supplied as a parametr",
107 cmd_des_t const cmd_des_num={
109 "NUM##","suffix of the command (two digits) is supplied as a parametr",
112 cmd_des_t const cmd_des_char={
114 "CHAR?","suffix of the command (one character) is supplied as a parametr",
117 cmd_des_t const cmd_des_charmid={
119 "CHAR?MID","middle character of the command is supplied as a parametr",
122 cmd_des_t const cmd_des_hiddedn={
124 "HIDDEN","should not be available",
127 cmd_des_t const cmd_des_error={
129 "TESTERROR","should produce an error",
134 cmd_des_t const *cmd_list_1[]={
138 &cmd_des_opchar_test,
139 &cmd_des_opchar_testro,
143 cmd_des_t const *cmd_list_2[]={
154 cmd_des_t const *cmd_list_main[]={
157 CMD_DES_INCLUDE_SUBLIST(cmd_list_1),
158 CMD_DES_CONTINUE_AT(cmd_list_2),
163 cmd_des_t const **cmd_list = cmd_list_main;
165 cmd_io_t cmd_io_std_line;
170 cmd_processor_run(&cmd_io_std_line, cmd_list_main);