/*                                                                                    
Runprog.c: To select item and run it.                  
                                                                                  
Compiler: BC++ 3.1,                                                               
          Turbo C ++ 1.01(3.01) (free from http://community.borland.com/museum)   
          MSC 6.0,                                                                
          MSVC 1.52.                                                              
                                                                                  
Compile mode: large                                                               
                                                                                  
Project: Runprog.c                                                                 
         ..\Lib\(8000E.Lib,7188XAL.Lib,7188XBL.Lib,7188XL.Lib or 7188EL.Lib)      
                                                                                  
Hardware: 7188/8000                                                               
Detail description:
        User can use menu to select to execute program or dos command,
        then they will come back the menu after finishing program. 
        
        To test the program
        Step1. download the Hello.exe, name.exe, and Runprog.exe
               to the controller.
        
        Step2. type Runprog.exe to run demo program. 
               (you can see menu message)
        
        Step3. press 1 ~ 3 key to exeute items.
               
        Step4. After finishing items, program will come back the menu.
               (only include: hello and Modeule name).
                
[24 May,2005] by Bill
*/                                                                                    

#include "..\..\lib\vp2k.h"
/* ------------------------------------------------------------------------*/

void Run(char *cmd)
{
    while(*cmd)
    {
      Ungetch(*cmd++);
    }
    Ungetch('\r');
}

void main(void)
{
    InitLib();
    Print("Select a program to run...\n\r");
    Print("1:Hello.EXE\n\r");
    Print("2:Module name\n\r");
    Print("3:dir\n\r");
    Print("others:quit\n\r");
    
    switch(Getch())
    {
        case '1':
                Run("Hello.exe");
            break;
        case '2':               
                Run("name.exe");
            break;
        case '3':
                Run("dir");
            break;
        default:
                Print("Do not select program to run.");
            break;
    }
}