Subversion Repositories svn1-original

Rev

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

Rev 98 Rev 162
Line 62... Line 62...
62
int         abort_flag = FALSE;                  /* Abort character detected */
62
int         abort_flag = FALSE;                  /* Abort character detected */
63
int         fnc_opr;                             /* Function key pushed */
63
int         fnc_opr;                             /* Function key pushed */
64
char        *force_cmds = NULL;                  /* Initial commnads */
64
char        *force_cmds = NULL;                  /* Initial commnads */
65
 
65
 
66
 
66
 
67
HANDLE      h_console;                          /* Output handle */
67
//HANDLE      h_console;                          /* Output handle */
68
 
68
 
69
/*
69
/*
70
**  Prototypes
70
**  Prototypes
71
*/
71
*/
72
int get_kb_character( void );
72
//int get_kb_character( void );
73
 
73
 
74
/*----------------------------------------------------------------------------
74
/*----------------------------------------------------------------------------
75
** FUNCTION           : set_commands
75
** FUNCTION           : set_commands
76
**
76
**
77
** DESCRIPTION        :
77
** DESCRIPTION        :
Line 88... Line 88...
88
** WARNING            :
88
** WARNING            :
89
**
89
**
90
** SEE ALSO           :
90
** SEE ALSO           :
91
----------------------------------------------------------------------------*/
91
----------------------------------------------------------------------------*/
92
 
92
 
93
void set_commands ( char * cptr )
93
//void set_commands ( char * cptr )
94
{
94
//{
95
    force_cmds = cptr;
95
//    force_cmds = cptr;
96
}
96
//}
97
 
97
 
98
 
98
 
99
/*========================================================================
99
/*========================================================================
100
 *
100
 *
101
 *  Initialize the screen
101
 *  Initialize the screen
Line 109... Line 109...
109
 *  Returns:
109
 *  Returns:
110
 *      Nothing
110
 *      Nothing
111
 *
111
 *
112
 *========================================================================*/
112
 *========================================================================*/
113
 
113
 
114
void init_screen( void )
114
//void init_screen( void )
115
{
115
//{
116
    clearscreen();
116
//    clearscreen();
117
    /*
117
//    /*
118
    **  Operate within a virtual console area of 24 * 80
118
//    **  Operate within a virtual console area of 24 * 80
119
    **  Ignore the real console area
119
//    **  Ignore the real console area
120
    */
120
//    */
121
    n_lines = 24;                                /* Fix number of lines for export */
121
//    n_lines = 24;                                /* Fix number of lines for export */
122
    n_cols = 80;                                 /* Number of cols */
122
//    n_cols = 80;                                 /* Number of cols */
123
}
123
//}
124
 
124
 
125
 
125
 
126
/*========================================================================
126
/*========================================================================
127
 *
127
 *
128
 *  Restore screen to normal
128
 *  Restore screen to normal
Line 136... Line 136...
136
 *  Returns:
136
 *  Returns:
137
 *      Nothing
137
 *      Nothing
138
 *
138
 *
139
 *========================================================================*/
139
 *========================================================================*/
140
 
140
 
141
void fix_screen( void )                          /* Restore screen to normal */
141
//void fix_screen( void )                          /* Restore screen to normal */
142
{
142
//{
143
    //flush_out();
143
//    //flush_out();
144
}
144
//}
145
 
145
 
146
 
146
 
147
/*========================================================================
147
///*========================================================================
148
 *
148
// *
149
 *  Position the cursor on the screen
149
// *  Position the cursor on the screen
150
 *
150
// *
151
 *  Purpose:
151
// *  Purpose:
152
 *      This function is called to save the current cursor location
152
// *      This function is called to save the current cursor location
153
 *      A single level save - for debug
153
// *      A single level save - for debug
154
 *
154
// *
155
 *  Parameters:
155
// *  Parameters:
156
 *      None
156
// *      None
157
 *
157
// *
158
 *  Returns:
158
// *  Returns:
159
 *      Nothing
159
// *      Nothing
160
 *
160
// *
161
 *========================================================================*/
161
// *========================================================================*/
162
int save_x,save_y;
162
//int save_x,save_y;
163
void save_cur(void)
163
//void save_cur(void)
164
{
164
//{
165
 
165
 
166
    CONSOLE_SCREEN_BUFFER_INFO console_info;
166
//    CONSOLE_SCREEN_BUFFER_INFO console_info;
167
 
167
 
168
    /*
168
//    /*
169
    **  Determine the screen size and the current location of the
169
//    **  Determine the screen size and the current location of the
170
    **  cursor within the screen
170
//    **  cursor within the screen
171
    */
171
//    */
172
    GetConsoleScreenBufferInfo( h_console, &console_info );
172
//    GetConsoleScreenBufferInfo( h_console, &console_info );
173
    save_x = console_info.dwCursorPosition.X;
173
//    save_x = console_info.dwCursorPosition.X;
174
    save_y = console_info.dwCursorPosition.Y;
174
//    save_y = console_info.dwCursorPosition.Y;
175
}
175
//}
176
 
176
 
177
void restore_cur(void)
177
//void restore_cur(void)
178
{
178
//{
179
    cur( save_x, save_y);
179
//    cur( save_x, save_y);
180
}
180
//}
181
 
181
 
182
 
182
 
183
 
183
 
184
 
184
 
185
/*========================================================================
185
/*========================================================================
Line 216... Line 216...
216
 *  Returns:
216
 *  Returns:
217
 *      Nothing
217
 *      Nothing
218
 *
218
 *
219
 *========================================================================*/
219
 *========================================================================*/
220
 
220
 
221
void flush_out( void )
221
//void flush_out( void )
222
{
222
//{
223
}
223
//}
224
 
224
 
225
 
225
 
226
/*========================================================================
226
/*========================================================================
227
 *
227
 *
228
 *  Get one character of input
228
 *  Get one character of input
Line 240... Line 240...
240
 *========================================================================*/
240
 *========================================================================*/
241
 
241
 
242
int getinp( void )
242
int getinp( void )
243
{
243
{
244
 
244
 
245
    /*
245
//    /*
246
     * General input routine
246
//     * General input routine
247
     * Will intercept function keys and set flags
247
//     * Will intercept function keys and set flags
248
     */
248
//     */
249
 
249
 
250
    int         c;
250
//    int         c;
251
 
251
 
252
    if ( force_cmds && *force_cmds )
252
//    if ( force_cmds && *force_cmds )
253
    {
253
//    {
254
        c = *force_cmds++;
254
//        c = *force_cmds++;
255
    }
255
//    }
256
    else
256
//    else
257
    {
257
//    {
258
        c = get_kb_character();
258
//        c = get_kb_character();
259
    }
259
//    }
260
    if( c & 0xff )
260
//    if( c & 0xff )
261
    {
261
//    {
262
        c = c & 0xff;
262
//        c = c & 0xff;
263
        if( c == '\r' )
263
//        if( c == '\r' )
264
            c = '\n';
264
//            c = '\n';
265
        if( c == ABORT_CHAR || c == ABORT_CHAR_1 )
265
//        if( c == ABORT_CHAR || c == ABORT_CHAR_1 )
266
        {
266
//        {
267
            abort_flag = TRUE;
267
//            abort_flag = TRUE;
268
            c = ABORT_CHAR;
268
//            c = ABORT_CHAR;
269
        }
269
//        }
270
        return ( c );                            /* Input is ascii char */
270
//        return ( c );                            /* Input is ascii char */
271
    }
271
//    }
272
    c >>= 8;                                     /* Upper byte */
272
//    c >>= 8;                                     /* Upper byte */
273
    if( c >= 59 && c <= 68 )
273
//    if( c >= 59 && c <= 68 )
274
    {
274
//    {
275
        fnc_opr = FNC1 + c - 59;
275
//        fnc_opr = FNC1 + c - 59;
276
        return ( 0 );
276
//        return ( 0 );
277
    }
277
//    }
278
    switch ( c )
278
//    switch ( c )
279
    {
279
//    {
280
    case 71:    return ( HOME_KEY );
280
//    case 71:    return ( HOME_KEY );
281
    case 72:    return ( UPARROW );
281
//    case 72:    return ( UPARROW );
282
    case 75:    return ( LEFTARROW );
282
//    case 75:    return ( LEFTARROW );
283
    case 77:    return ( RIGHTARROW );
283
//    case 77:    return ( RIGHTARROW );
284
    case 80:    return ( DOWNARROW );
284
//    case 80:    return ( DOWNARROW );
285
    case 73:    return ( PAGE_UP );
285
//    case 73:    return ( PAGE_UP );
286
    case 81:    return ( PAGE_DOWN );
286
//    case 81:    return ( PAGE_DOWN );
287
    case 79:    return ( END_KEY );
287
//    case 79:    return ( END_KEY );
288
    case 82:    return ( INSERT_KEY );
288
//    case 82:    return ( INSERT_KEY );
289
    case 83:    return ( DELETE_KEY );
289
//    case 83:    return ( DELETE_KEY );
290
    case 15:    return ( BACKTAB );
290
//    case 15:    return ( BACKTAB );
291
    }
291
//    }
292
    return ( 0 );
292
    return ( 0 );
293
}
293
}
294
 
294
 
295
 
295
 
296
/*========================================================================
296
/*========================================================================
Line 313... Line 313...
313
 *          0 - No valid entry
313
 *          0 - No valid entry
314
 *          1 - data entered and transfered to number.
314
 *          1 - data entered and transfered to number.
315
 *
315
 *
316
 *========================================================================*/
316
 *========================================================================*/
317
 
317
 
318
bool getnum( int max_len, int *final_buf )
318
//bool getnum( int max_len, int *final_buf )
319
{
319
//{
320
    char        n_buf[30];                       /* Convert number here */
320
//    char        n_buf[30];                       /* Convert number here */
321
 
321
 
322
    n_buf[0] = '\0';
322
//    n_buf[0] = '\0';
323
    if ( *final_buf )
323
//    if ( *final_buf )
324
        sprintf( n_buf, "%*.*d", max_len,max_len, *final_buf );
324
//        sprintf( n_buf, "%*.*d", max_len,max_len, *final_buf );
325
    if( getstring( max_len, n_buf, Digit ) )
325
//    if( getstring( max_len, n_buf, Digit ) )
326
    {
326
//    {
327
        sscanf( n_buf, "%d", final_buf );
327
//        sscanf( n_buf, "%d", final_buf );
328
        return ( TRUE );
328
//        return ( TRUE );
329
    }
329
//    }
330
    else
330
//    else
331
        return ( FALSE );
331
//        return ( FALSE );
332
}
332
//}
333
 
333
 
334
/*========================================================================
334
/*========================================================================
335
 *
335
 *
336
 *  Get and edit a string
336
 *  Get and edit a string
337
 *
337
 *
Line 346... Line 346...
346
 *  Returns:
346
 *  Returns:
347
 *      Length of the input string
347
 *      Length of the input string
348
 *
348
 *
349
 *========================================================================*/
349
 *========================================================================*/
350
 
350
 
351
int getstring( int len, const char *str, enum class_enum limit )
351
//int getstring( int len, const char *str, enum class_enum limit )
352
{
352
//{
353
    char        buf[100];                        /* Internal edit buffer */
353
//    char        buf[100];                        /* Internal edit buffer */
354
    int         i;                               /* Current index into buf */
354
//    int         i;                               /* Current index into buf */
355
    int         ii;                              /* Number of characters in buf */
355
//    int         ii;                              /* Number of characters in buf */
356
    int         j;                               /* Loooopy variable */
356
//    int         j;                               /* Loooopy variable */
357
    int         ch;                              /* Current input character */
357
//    int         ch;                              /* Current input character */
358
 
358
 
359
    ( void ) memset( buf, 0, 100 );              /* Init the buffer */
359
//    ( void ) memset( buf, 0, 100 );              /* Init the buffer */
360
    ( void ) strcpy( buf, str );                 /* Copy in the original string */
360
//    ( void ) strcpy( buf, str );                 /* Copy in the original string */
361
    ii = i = strlen( str );                      /* i is at the end of the string */
361
//    ii = i = strlen( str );                      /* i is at the end of the string */
362
    printf( "%s", buf );                         /* Display the current string */
362
//    printf( "%s", buf );                         /* Display the current string */
363
 
363
 
364
    /*
364
//    /*
365
     * This routine assumes that the cursor is at the end of
365
//     * This routine assumes that the cursor is at the end of
366
     * the string as it is displayed on the screen
366
//     * the string as it is displayed on the screen
367
     */
367
//     */
368
 
368
 
369
    while( !abort_flag )
369
//    while( !abort_flag )
370
    {
370
//    {
371
        ch = getinp();                           /* Get the next character */
371
//        ch = getinp();                           /* Get the next character */
372
 
372
 
373
        if( ch == '\n' || ch == '\t' || fnc_opr || abort_flag )/* RETURN */
373
//        if( ch == '\n' || ch == '\t' || fnc_opr || abort_flag )/* RETURN */
374
            break;                               /* Finish the edit */
374
//            break;                               /* Finish the edit */
375
 
375
 
376
        else if( ch == rubout && i )             /* Users rubout character */
376
//        else if( ch == rubout && i )             /* Users rubout character */
377
        {
377
//        {
378
            i--;
378
//            i--;
379
            putchar( '\010' );
379
//            putchar( '\010' );
380
            for( j = i; j <= ii; j++ )
380
//            for( j = i; j <= ii; j++ )
381
                buf[j] = buf[j + 1];
381
//                buf[j] = buf[j + 1];
382
            printf( "%s ", &buf[i] );            /* Print remainder of the buffer */
382
//            printf( "%s ", &buf[i] );            /* Print remainder of the buffer */
383
            ii--;                                /* One less in the buffer */
383
//            ii--;                                /* One less in the buffer */
384
            for( j = i; j <= ii; j++ )
384
//            for( j = i; j <= ii; j++ )
385
                putchar( '\010' );
385
//                putchar( '\010' );
386
        }
386
//        }
387
 
387
 
388
        else if( ch == DELETE_KEY && i != ii )   /* Delete char under cursor */
388
//        else if( ch == DELETE_KEY && i != ii )   /* Delete char under cursor */
389
        {
389
//        {
390
            for( j = i; j <= ii; j++ )
390
//            for( j = i; j <= ii; j++ )
391
                buf[j] = buf[j + 1];
391
//                buf[j] = buf[j + 1];
392
            printf( "%s ", &buf[i] );
392
//            printf( "%s ", &buf[i] );
393
            ii--;
393
//            ii--;
394
            for( j = i; j <= ii; j++ )
394
//            for( j = i; j <= ii; j++ )
395
                putchar( '\010' );
395
//                putchar( '\010' );
396
        }
396
//        }
397
 
397
 
398
        else if( ( ch == '\010' || ch == LEFTARROW ) && i ) /* Back-space */
398
//        else if( ( ch == '\010' || ch == LEFTARROW ) && i ) /* Back-space */
399
        {
399
//        {
400
            i--;
400
//            i--;
401
            putchar( '\010' );
401
//            putchar( '\010' );
402
        }
402
//        }
403
 
403
 
404
        else if( ch == RIGHTARROW && i < ii )    /* forward */
404
//        else if( ch == RIGHTARROW && i < ii )    /* forward */
405
            putchar( buf[i++] );
405
//            putchar( buf[i++] );
406
 
406
 
407
        else if( ( ii < len ) && ( ( ( limit == Alphanum  || limit == AlphnumUpper) && isprint( ch ) ) || ( ( limit == Digit ) && isascii( ch ) && isdigit( ch ) ) || ( ( limit == Alpha ) && isalpha( ch ) ) ) )    /* Insert the char */
407
//        else if( ( ii < len ) && ( ( ( limit == Alphanum  || limit == AlphnumUpper) && isprint( ch ) ) || ( ( limit == Digit ) && isascii( ch ) && isdigit( ch ) ) || ( ( limit == Alpha ) && isalpha( ch ) ) ) )    /* Insert the char */
408
        {
408
//        {
409
            if ( limit == AlphnumUpper )
409
//            if ( limit == AlphnumUpper )
410
                ch = toupper(ch);
410
//                ch = toupper(ch);
411
 
411
 
412
            for( j = ii + 1; j > i; j-- )
412
//            for( j = ii + 1; j > i; j-- )
413
                buf[j] = buf[j - 1];
413
//                buf[j] = buf[j - 1];
414
            buf[i] = ch;
414
//            buf[i] = ch;
415
            ii++;
415
//            ii++;
416
            printf( "%s", &buf[i++] );  /* Print remainder of the buffer */
416
//            printf( "%s", &buf[i++] );  /* Print remainder of the buffer */
417
            for( j = i; j < ii; j++ )
417
//            for( j = i; j < ii; j++ )
418
                putchar( '\010' );
418
//                putchar( '\010' );
419
        }
419
//        }
420
        else
420
//        else
421
        {
421
//        {
422
            beep();
422
//            beep();
423
        }
423
//        }
424
    }
424
//    }
425
 
425
 
426
    /*
426
//    /*
427
     * Edit complete - transfer the data to the user 
427
//     * Edit complete - transfer the data to the user
428
     */
428
//     */
429
 
429
 
430
    printf( "%s", &buf[i] );            /* Cursor to end of the buffer */
430
//    printf( "%s", &buf[i] );            /* Cursor to end of the buffer */
431
    if( !abort_flag )
431
//    if( !abort_flag )
432
        strcpy( (char *)str, buf );             /* Copy buffer to the user */
432
//        strcpy( (char *)str, buf );             /* Copy buffer to the user */
433
    else
433
//    else
434
        ii = 0;
434
//        ii = 0;
435
    return ( ii );                               /* Return length of input */
435
//    return ( ii );                               /* Return length of input */
436
}
436
//}
437
 
437
 
438
/*========================================================================
438
/*========================================================================
439
 *
439
 *
440
 *  Get a sex type from the operator
440
 *  Get a sex type from the operator
441
 *
441
 *
Line 449... Line 449...
449
 *      A sex type
449
 *      A sex type
450
 *      The unknown sex type is used to signal no change in state
450
 *      The unknown sex type is used to signal no change in state
451
 *
451
 *
452
 *========================================================================*/
452
 *========================================================================*/
453
 
453
 
454
sex_type getsex( void )
454
//sex_type getsex( void )
455
{
455
//{
456
    sex_type    curr = unknown;                  /* current sex type in display */
456
//    sex_type    curr = unknown;                  /* current sex type in display */
457
    char        c;
457
//    char        c;
458
 
458
 
459
    while( ( c = getinp() ) != ABORT_CHAR )
459
//    while( ( c = getinp() ) != ABORT_CHAR )
460
    {
460
//    {
461
        if( c == '\n' || c == '\t' )
461
//        if( c == '\n' || c == '\t' )
462
        {
462
//        {
463
            return ( curr );
463
//            return ( curr );
464
        }
464
//        }
465
        if( c == 'M' || c == 'm')
465
//        if( c == 'M' || c == 'm')
466
        {
466
//        {
467
            printf( "Male  \010\010\010\010\010\010" );
467
//            printf( "Male  \010\010\010\010\010\010" );
468
            curr = male;
468
//            curr = male;
469
        }
469
//        }
470
        else if( c == 'F' || c == 'f' )
470
//        else if( c == 'F' || c == 'f' )
471
        {
471
//        {
472
            printf( "Female\010\010\010\010\010\010" );
472
//            printf( "Female\010\010\010\010\010\010" );
473
            curr = female;
473
//            curr = female;
474
        }
474
//        }
475
        else
475
//        else
476
        {
476
//        {
477
            beep();
477
//            beep();
478
        }
478
//        }
479
    }
479
//    }
480
    return ( unknown );
480
//    return ( unknown );
481
}
481
//}
482
 
482
 
483
/*========================================================================
483
/*========================================================================
484
 *
484
 *
485
 *  Get a class descriptor
485
 *  Get a class descriptor
486
 *
486
 *
Line 493... Line 493...
493
 *  Returns:
493
 *  Returns:
494
 *      An integer which is the index into the  config.team_class array
494
 *      An integer which is the index into the  config.team_class array
495
 *
495
 *
496
 *========================================================================*/
496
 *========================================================================*/
497
 
497
 
498
int getclass( void )
498
//int getclass( void )
499
{
499
//{
500
    char        cc[3];                           /* Input character */
500
//    char        cc[3];                           /* Input character */
501
    int         i, j;                            /* One those loopy things */
501
//    int         i, j;                            /* One those loopy things */
502
 
502
 
503
 
503
 
504
    cc[0] = '\0';
504
//    cc[0] = '\0';
505
    while( ( j = getstring( 2, cc, AlphnumUpper ) ) != 0 )
505
//    while( ( j = getstring( 2, cc, AlphnumUpper ) ) != 0 )
506
    {
506
//    {
507
        /*
507
//        /*
508
        **  Is this a valid class
508
//        **  Is this a valid class
509
        */
509
//        */
510
        if ( (i = lookup_class(cc, NULL)) > 0 )
510
//        if ( (i = lookup_class(cc, NULL)) > 0 )
511
            return (i);
511
//            return (i);
512
 
512
 
513
        /*
513
//        /*
514
        **  Invalid
514
//        **  Invalid
515
        **  Rubout and try again
515
//        **  Rubout and try again
516
        */
516
//        */
517
        beep();
517
//        beep();
518
        for( i = 0; i < j; i++ )
518
//        for( i = 0; i < j; i++ )
519
            putchar( '\010' );
519
//            putchar( '\010' );
520
    }
520
//    }
521
    return ( 0 );
521
//    return ( 0 );
522
}
522
//}
523
 
523
 
524
/*========================================================================
524
/*========================================================================
525
 *
525
 *
526
 *  Get a country descriptor
526
 *  Get a country descriptor
527
 *
527
 *
Line 534... Line 534...
534
 *  Returns:
534
 *  Returns:
535
 *      An integer which is the index into the config.country_name array.
535
 *      An integer which is the index into the config.country_name array.
536
 *
536
 *
537
 *========================================================================*/
537
 *========================================================================*/
538
 
538
 
539
int getcountry( void )
539
//int getcountry( void )
540
{
540
//{
541
    char        cc[5];                           /* Input character */
541
//    char        cc[5];                           /* Input character */
542
    int         i, j, k;                         /* One those loopy things */
542
//    int         i, j, k;                         /* One those loopy things */
543
 
543
 
544
    cc[0] = '\0';
544
//    cc[0] = '\0';
545
    while( ( j = getstring( 4, cc, Alphanum ) ) != 0 )
545
//    while( ( j = getstring( 4, cc, Alphanum ) ) != 0 )
546
    {
546
//    {
547
 
547
 
548
        /*
548
//        /*
549
         * Attempt to locate the entered country in the list of defined countries
549
//         * Attempt to locate the entered country in the list of defined countries
550
         */
550
//         */
551
 
551
 
552
        for( i = 0; i < MAX_COUNTRY; i++ )
552
//        for( i = 0; i < MAX_COUNTRY; i++ )
553
        {
553
//        {
554
            for( k = 0; k <= j; k++ )
554
//            for( k = 0; k <= j; k++ )
555
            {
555
//            {
556
                if( cc[k] == '\000' )
556
//                if( cc[k] == '\000' )
557
                    return ( ++i );              /* Found it */
557
//                    return ( ++i );              /* Found it */
558
 
558
 
559
                if( toupper( cc[k] ) !=
559
//                if( toupper( cc[k] ) !=
560
                    toupper( config.country_name[i].abr[k] ) )
560
//                    toupper( config.country_name[i].abr[k] ) )
561
                    break;
561
//                    break;
562
            }
562
//            }
563
        }
563
//        }
564
        beep();
564
//        beep();
565
        for( i = 0; i < j; i++ )
565
//        for( i = 0; i < j; i++ )
566
            putchar( '\010' );
566
//            putchar( '\010' );
567
    }
567
//    }
568
    return ( 0 );
568
//    return ( 0 );
569
}
569
//}
570
 
570
 
571
/*========================================================================
571
/*========================================================================
572
 *
572
 *
573
 *  Get menu selector
573
 *  Get menu selector
574
 *
574
 *
Line 587... Line 587...
587
 *  Returns:
587
 *  Returns:
588
 *      Selected character
588
 *      Selected character
589
 *
589
 *
590
 *========================================================================*/
590
 *========================================================================*/
591
 
591
 
592
char getfnc( const char *list )
592
//char getfnc( const char *list )
593
{
593
//{
594
    const char       *copylist;
594
//    const char       *copylist;
595
    char        c;
595
//    char        c;
596
    char        result = 0;
596
//    char        result = 0;
597
 
597
 
598
    copylist = ( *list == '*' ) ? list + 1 : list;
598
//    copylist = ( *list == '*' ) ? list + 1 : list;
599
    while( ( c = getinp() ) != ABORT_CHAR )
599
//    while( ( c = getinp() ) != ABORT_CHAR )
600
    {
600
//    {
601
        c = toupper( c );                        /* Get a character */
601
//        c = toupper( c );                        /* Get a character */
602
        if( strchr( copylist, c ) )
602
//        if( strchr( copylist, c ) )
603
        {
603
//        {
604
            result = c;
604
//            result = c;
605
            break;
605
//            break;
606
        }
606
//        }
607
 
607
 
608
        if( c == '\n' && *list != '*' )
608
//        if( c == '\n' && *list != '*' )
609
        {
609
//        {
610
            result = *list;
610
//            result = *list;
611
            break;
611
//            break;
612
        }
612
//        }
613
 
613
 
614
        beep();
614
//        beep();
615
    }
615
//    }
616
 
616
 
617
    /*
617
//    /*
618
    **  Display the option selected
618
//    **  Display the option selected
619
    **  Not ready for this yet. Looks a bit ugle in a few places
619
//    **  Not ready for this yet. Looks a bit ugle in a few places
620
    */
620
//    */
621
    /*    if ( result )
621
//    /*    if ( result )
622
    **    putchar(result);
622
//    **    putchar(result);
623
    */
623
//    */
624
 
624
 
625
    return ( result );
625
//    return ( result );
626
}
626
//}
627
 
627
 
628
/*========================================================================
628
/*========================================================================
629
 *
629
 *
630
 *  Prompt for YES / NO
630
 *  Prompt for YES / NO
631
 *
631
 *
Line 638... Line 638...
638
 *  Returns:
638
 *  Returns:
639
 *      TRUE for Yes, FALSE for No
639
 *      TRUE for Yes, FALSE for No
640
 *
640
 *
641
 *========================================================================*/
641
 *========================================================================*/
642
 
642
 
643
bool getyes( const char *prompt )
643
//bool getyes( const char *prompt )
644
{
644
//{
645
    char        c;
645
//    char        c;
646
 
646
 
647
    printf( "%s ? ", prompt );
647
//    printf( "%s ? ", prompt );
648
    c = getfnc( "*YN" );
648
//    c = getfnc( "*YN" );
649
    putchar( '\n' );
649
//    putchar( '\n' );
650
    return ( c == 'Y' );
650
//    return ( c == 'Y' );
651
}
651
//}
652
 
652
 
653
/*========================================================================
653
/*========================================================================
654
 *
654
 *
655
 *  Convert character to upper case
655
 *  Convert character to upper case
656
 *
656
 *
Line 728... Line 728...
728
 *
728
 *
729
 *  Returns:
729
 *  Returns:
730
 *      Nothing
730
 *      Nothing
731
 *
731
 *
732
 *========================================================================*/
732
 *========================================================================*/
733
void console_clreol( void )
733
//void console_clreol( void )
734
{
734
//{
735
 
735
 
736
    CONSOLE_SCREEN_BUFFER_INFO console_info;
736
//    CONSOLE_SCREEN_BUFFER_INFO console_info;
737
    DWORD                      rlen;
737
//    DWORD                      rlen;
738
 
738
 
739
    int ii;
739
//    int ii;
740
    int top;
740
//    int top;
741
 
741
 
742
 
742
 
743
    /*
743
//    /*
744
    **  Determine the screen size and the current location of the
744
//    **  Determine the screen size and the current location of the
745
    **  cursor within the screen
745
//    **  cursor within the screen
746
    */
746
//    */
747
    GetConsoleScreenBufferInfo( h_console, &console_info );
747
//    GetConsoleScreenBufferInfo( h_console, &console_info );
748
 
748
 
749
    /*
749
//    /*
750
    **  Clear all of it
750
//    **  Clear all of it
751
    */
751
//    */
752
    top = console_info.dwSize.X - console_info.dwCursorPosition.X;
752
//    top = console_info.dwSize.X - console_info.dwCursorPosition.X;
753
 
753
 
754
    for ( ii = 0; ii < top ; ii++ )
754
//    for ( ii = 0; ii < top ; ii++ )
755
    {
755
//    {
756
        WriteConsole( h_console, " ", 1, &rlen, NULL );
756
//        WriteConsole( h_console, " ", 1, &rlen, NULL );
757
    }
757
//    }
758
    cur ( console_info.dwCursorPosition.X, console_info.dwCursorPosition.Y );
758
//    cur ( console_info.dwCursorPosition.X, console_info.dwCursorPosition.Y );
759
}
759
//}
760
 
760
 
761
/*========================================================================
761
/*========================================================================
762
 *
762
 *
763
 *  printf - Text display routines
763
 *  printf - Text display routines
764
 *  putchar - Text display routines
764
 *  putchar - Text display routines
Line 777... Line 777...
777
 *========================================================================*/
777
 *========================================================================*/
778
 
778
 
779
 
779
 
780
int putchar(int cc)
780
int putchar(int cc)
781
{
781
{
782
    printf( "aaa-%c", cc );
782
    printf( "%c", cc );
783
    return 1;
783
    return 1;
784
}
784
}
785
 
785
 
786
// void gross_error_message(void)
786
// void gross_error_message(void)
787
// {
787
// {
Line 817... Line 817...
817
 *
817
 *
818
 *  Returns:
818
 *  Returns:
819
 *      Nothing
819
 *      Nothing
820
 *
820
 *
821
 *========================================================================*/
821
 *========================================================================*/
822
void console_prompt( char prompt )
822
//void console_prompt( char prompt )
823
{
823
//{
824
    SetConsoleTextAttribute( h_console, FOREGROUND_GREEN );
824
//    SetConsoleTextAttribute( h_console, FOREGROUND_GREEN );
825
    putchar( prompt );
825
//    putchar( prompt );
826
    SetConsoleTextAttribute( h_console, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE );
826
//    SetConsoleTextAttribute( h_console, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE );
827
}
827
//}
828
 
828
 
829
/*------------------------------------------------------------------------------
829
/*------------------------------------------------------------------------------
830
Name:           get_kb_character
830
Name:           get_kb_character
831
Description:    Extract a keyboard character - including cursor and function
831
Description:    Extract a keyboard character - including cursor and function
832
                keys.
832
                keys.
Line 834... Line 834...
834
Global Refs:
834
Global Refs:
835
Returns:        a 16 bit value that encodes ascii character and scan code
835
Returns:        a 16 bit value that encodes ascii character and scan code
836
Side-effects:
836
Side-effects:
837
------------------------------------------------------------------------------*/
837
------------------------------------------------------------------------------*/
838
 
838
 
839
int get_kb_character( void )
839
//int get_kb_character( void )
840
{
840
//{
841
    HANDLE          hConsoleInput;
841
//    HANDLE          hConsoleInput;
842
    INPUT_RECORD    Buffer;
842
//    INPUT_RECORD    Buffer;
843
    DWORD           NumberOfEventsRead;
843
//    DWORD           NumberOfEventsRead;
844
 
844
 
845
    hConsoleInput = GetStdHandle(STD_INPUT_HANDLE);
845
//    hConsoleInput = GetStdHandle(STD_INPUT_HANDLE);
846
 
846
 
847
    /*
847
//    /*
848
    **  Process console events until we get a suitable keystroke event
848
//    **  Process console events until we get a suitable keystroke event
849
    */
849
//    */
850
    FlushFileBuffers( h_console );
850
//    FlushFileBuffers( h_console );
851
    for (;;)
851
//    for (;;)
852
    {
852
//    {
853
        if (ReadConsoleInput( hConsoleInput, &Buffer, 1, &NumberOfEventsRead ))
853
//        if (ReadConsoleInput( hConsoleInput, &Buffer, 1, &NumberOfEventsRead ))
854
        {
854
//        {
855
            /*
855
//            /*
856
            **  Only want keyboard depression - ignore other events
856
//            **  Only want keyboard depression - ignore other events
857
            */
857
//            */
858
            if (Buffer.EventType == KEY_EVENT && Buffer.Event.KeyEvent.bKeyDown)
858
//            if (Buffer.EventType == KEY_EVENT && Buffer.Event.KeyEvent.bKeyDown)
859
            {
859
//            {
860
                /*
860
//                /*
861
                **  Ignore several scan codes
861
//                **  Ignore several scan codes
862
                **  CNTRL, ALT, SHIFT, CAPLOCK
862
//                **  CNTRL, ALT, SHIFT, CAPLOCK
863
                */
863
//                */
864
                if (Buffer.Event.KeyEvent.wVirtualScanCode == 0x38 ||
864
//                if (Buffer.Event.KeyEvent.wVirtualScanCode == 0x38 ||
865
                    Buffer.Event.KeyEvent.wVirtualScanCode == 0x1D ||
865
//                    Buffer.Event.KeyEvent.wVirtualScanCode == 0x1D ||
866
                    Buffer.Event.KeyEvent.wVirtualScanCode == 0x2A ||
866
//                    Buffer.Event.KeyEvent.wVirtualScanCode == 0x2A ||
867
                    Buffer.Event.KeyEvent.wVirtualScanCode == 0x3A)
867
//                    Buffer.Event.KeyEvent.wVirtualScanCode == 0x3A)
868
                {
868
//                {
869
                    continue;
869
//                    continue;
870
                }
870
//                }
871
 
871
 
872
                return ( (int) (Buffer.Event.KeyEvent.uChar.AsciiChar + (Buffer.Event.KeyEvent.wVirtualScanCode << 8)));
872
//                return ( (int) (Buffer.Event.KeyEvent.uChar.AsciiChar + (Buffer.Event.KeyEvent.wVirtualScanCode << 8)));
873
            }
873
//            }
874
        }
874
//        }
875
        else
875
//        else
876
        {
876
//        {
877
            sleep (1);
877
//            sleep (1);
878
        }
878
//        }
879
    }
879
//    }
880
 
880
 
881
}
881
//}
882
 
882
 
883
/********************************* EOF ***********************************/
883
/********************************* EOF ***********************************/
884
 
884