Subversion Repositories svn1-original

Rev

Rev 95 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 95 Rev 162
Line 41... Line 41...
41
 *  Returns:
41
 *  Returns:
42
 *      Nothing
42
 *      Nothing
43
 *
43
 *
44
 *========================================================================*/
44
 *========================================================================*/
45
 
45
 
46
void do_menu( const char *header, const char *prompt, menu_table * table )
46
//void do_menu( const char *header, const char *prompt, menu_table * table )
47
{
47
//{
48
    menu_table *curr;                            /* Current entry pointer */
48
//    menu_table *curr;                            /* Current entry pointer */
49
    int         i;
49
//    int         i;
50
    char        c;
50
//    char        c;
51
    int         alldone = FALSE;
51
//    int         alldone = FALSE;
52
    int         found;
52
//    int         found;
53
 
53
 
54
    /*
54
//    /*
55
     * Clear the screen and display the menu 
55
//     * Clear the screen and display the menu
56
     */
56
//     */
57
 
57
 
58
    do
58
//    do
59
    {
59
//    {
60
        abort_flag = FALSE;                      /* Reset global abort flag */
60
//        abort_flag = FALSE;                      /* Reset global abort flag */
61
        curr = table;                            /* init the current pointer */
61
//        curr = table;                            /* init the current pointer */
62
        i = 2;                                   /* init cursor position */
62
//        i = 2;                                   /* init cursor position */
63
        clearscreen();
63
//        clearscreen();
64
        cur( 10, i );
64
//        cur( 10, i );
65
        printf( "%s", header );                  /* display header */
65
//        printf( "%s", header );                  /* display header */
66
        i += 2;
66
//        i += 2;
67
        while( curr->key )
67
//        while( curr->key )
68
        {
68
//        {
69
            cur( 10, i );
69
//            cur( 10, i );
70
            console_prompt ( curr->key  );
70
//            //console_prompt ( curr->key  );
71
            printf( " %s", curr->prompt );
71
//            printf( " %s", curr->prompt );
72
            i++;
72
//            i++;
73
            curr++;
73
//            curr++;
74
        }
74
//        }
75
 
75
 
76
        /*
76
//        /*
77
         * Prompt the operator to select an item 
77
//         * Prompt the operator to select an item
78
         */
78
//         */
79
 
79
 
80
        found = FALSE;
80
//        found = FALSE;
81
        while( !found )
81
//        while( !found )
82
        {
82
//        {
83
            cur( 0, 2 + i );
83
//            cur( 0, 2 + i );
84
            printf( "%s:", prompt );
84
//            printf( "%s:", prompt );
85
            console_clreol();
85
//            //console_clreol();
86
            c = toupper( getinp() );
86
//            c = toupper( getinp() );
87
            if( abort_flag )
87
//            if( abort_flag )
88
            {
88
//            {
89
                alldone = TRUE;
89
//                alldone = TRUE;
90
                break;
90
//                break;
91
            }
91
//            }
92
            curr = table;
92
//            curr = table;
93
            while( curr->key )
93
//            while( curr->key )
94
            {
94
//            {
95
                if( toupper( ( int ) curr->key ) == c )
95
//                if( toupper( ( int ) curr->key ) == c )
96
                {
96
//                {
97
                    found = TRUE;
97
//                    found = TRUE;
98
                    /*
98
//                    /*
99
                     * Correct operation located 
99
//                     * Correct operation located
100
                     */
100
//                     */
101
                    if( curr->doit == NULL )
101
//                    if( curr->doit == NULL )
102
                    {
102
//                    {
103
                        alldone = TRUE;
103
//                        alldone = TRUE;
104
                        break;
104
//                        break;
105
                    }
105
//                    }
106
                    else
106
//                    else
107
                    {
107
//                    {
108
                        clearscreen();
108
//                        clearscreen();
109
                        ( void ) ( *curr->doit ) ();
109
//                        ( void ) ( *curr->doit ) ();
110
                        break;
110
//                        break;
111
                    }
111
//                    }
112
                }
112
//                }
113
                curr++;
113
//                curr++;
114
            }
114
//            }
115
            if( !found )
115
//            if( !found )
116
                beep();                        /* operator */
116
//                beep();                        /* operator */
117
        }
117
//        }
118
    } while( !alldone );
118
//    } while( !alldone );
119
}
119
//}
120
 
120
 
121
/********************************* EOF ***********************************/
121
/********************************* EOF ***********************************/