mirror of
https://gitee.com/openharmony/startup_init
synced 2024-10-07 14:13:52 +00:00
Add begetctl to reduce commands
Signed-off-by: handyohos <zhangxiaotian@huawei.com> Change-Id: I7de63375de1c7d285a37915caed4cee48d1d1a25
This commit is contained in:
parent
2eaeba40bf
commit
4998420931
@ -61,7 +61,8 @@ static int main_cmd(int argc, char* argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
MODULE_CONSTRUCTOR() {
|
||||
MODULE_CONSTRUCTOR()
|
||||
{
|
||||
(void)BegetCtlCmdAdd("reboot", main_cmd);
|
||||
(void)BegetCtlCmdAdd("devctl", main_cmd);
|
||||
}
|
||||
|
@ -26,7 +26,8 @@ struct CMD_LIST_ST {
|
||||
|
||||
static struct CMD_LIST_ST *m_cmdList = NULL;
|
||||
|
||||
int BegetCtlCmdAdd(const char *name, BegetCtlCmdPtr cmd) {
|
||||
int BegetCtlCmdAdd(const char *name, BegetCtlCmdPtr cmd)
|
||||
{
|
||||
struct CMD_LIST_ST *item;
|
||||
|
||||
if (name == NULL) {
|
||||
@ -51,7 +52,8 @@ int BegetCtlCmdAdd(const char *name, BegetCtlCmdPtr cmd) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct CMD_LIST_ST *BegetCtlCmdFind(const char *name) {
|
||||
static const struct CMD_LIST_ST *BegetCtlCmdFind(const char *name)
|
||||
{
|
||||
const struct CMD_LIST_ST *item = m_cmdList;
|
||||
|
||||
while (item != NULL) {
|
||||
@ -63,7 +65,8 @@ static const struct CMD_LIST_ST *BegetCtlCmdFind(const char *name) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void BegetCtlUsage(const char *command) {
|
||||
static void BegetCtlUsage(const char *command)
|
||||
{
|
||||
const struct CMD_LIST_ST *item = m_cmdList;
|
||||
int notFirst = 0;
|
||||
|
||||
@ -78,7 +81,8 @@ static void BegetCtlUsage(const char *command) {
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const struct CMD_LIST_ST *cmd;
|
||||
const char *last = strrchr(argv[0], '/');
|
||||
|
||||
|
@ -244,6 +244,7 @@ static int main_cmd(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
MODULE_CONSTRUCTOR() {
|
||||
MODULE_CONSTRUCTOR()
|
||||
{
|
||||
(void)BegetCtlCmdAdd("misc_deamon", main_cmd);
|
||||
}
|
||||
|
@ -191,7 +191,8 @@ static int main_cmd(int argc, char *argv[])
|
||||
return RunParamCommand(argc, argv);
|
||||
}
|
||||
|
||||
MODULE_CONSTRUCTOR() {
|
||||
MODULE_CONSTRUCTOR()
|
||||
{
|
||||
(void)BegetCtlCmdAdd("param", main_cmd);
|
||||
}
|
||||
#endif
|
||||
|
@ -92,7 +92,8 @@ static int main_cmd(int argc, char** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
MODULE_CONSTRUCTOR() {
|
||||
MODULE_CONSTRUCTOR()
|
||||
{
|
||||
(void)BegetCtlCmdAdd("service", main_cmd);
|
||||
(void)BegetCtlCmdAdd("service_control", main_cmd);
|
||||
(void)BegetCtlCmdAdd("start_service", main_cmd);
|
||||
|
Loading…
Reference in New Issue
Block a user