Exemplo n.º 1
0
main()
{
    ShowAllCmd(head);

    while(exit_signal == 0)
    {
        /* Get a command */
        char cmdin[CMD_MAX_LEN];
        printf("Please input a cmd ---> ");
        scanf("%s", cmdin);
        
        /* distinguish the command */
        if(!strcmp("help", cmdin))
        {
            ShowAllCmd(head);
        }
        else if(!strcmp("exit", cmdin))
        { 
            Exit();
        }
        else if(!strcmp("writer", cmdin))
        {
            WriterCmd();
        }
        else if(!strcmp("version", cmdin))
        {
            VersionCmd();
        }
        else
        {
            WrongCmd();
        }
    }
}
Exemplo n.º 2
0
main()
{    
    tLinkTable * head = NULL;
    InitMenuData(&head);
    printf("增加命令之前:\n");
    ShowAllCmd(head);
    FindCmd( head, "help");
    InsertCmd(head,"debug", "this is debug", NULL);
    printf("增加命令之后:\n");
    ShowAllCmd(head);
    while(1)
    {
        char cmd[CMD_MAX_LEN];
        printf("Input a cmd number > ");
        scanf("%s", cmd);
        tDataNode *p = FindCmd(head, cmd);
        if( p == NULL)
        {
            printf("This is a wrong cmd!\n ");
            continue;
        }
        printf("%s - %s\n", p->cmd, p->desc); 
        if(p->handler != NULL) 
        { 
            p->handler();
        }
   
    }
}
Exemplo n.º 3
0
int Help(tLinkTable *pLinkTable)
{
	ShowAllCmd(pLinkTable);
	return 0;
}
Exemplo n.º 4
0
Arquivo: menu.c Projeto: YoungCC/lab
int Help()
{
    ShowAllCmd(head);
    return 0;
}
Exemplo n.º 5
0
Arquivo: menu.c Projeto: peyfey/selabs
int Help(tLinkTable * head)
{
    ShowAllCmd(head);
    return 0;
}