1 /*
2  * Copyright (C) 2015 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef _RECOVERY_DEBUG_CMD_H_
17 #define _RECOVERY_DEBUG_CMD_H_
18 
19 struct command {
20 	int (*handler)(int argc, const char *argv[]);
21 	struct command *subcmd;
22 	const char *name;
23 	const char *help;
24 };
25 
26 #define CMD(n, helpstr) \
27 	{.handler = cmd_##n, .subcmd = NULL, .name = #n, .help = helpstr}
28 
29 #define CMDS(n, helpstr) \
30 	{.handler = cmd_##n, .subcmd = subcmds_##n, .name = #n, .help = helpstr}
31 
32 #define SUBCMDS(n, helpstr) \
33 	{.handler = NULL, .subcmd = subcmds_##n, \
34 	 .name = #n, .help = helpstr}
35 
36 #define CMD_GUARD_LAST { .name = NULL }
37 
38 extern struct command subcmds_ec[];
39 
40 #endif /* _RECOVERY_DEBUG_CMD_H_ */
41