Annotation of coherent/d/support/bbsadmin/getfilename.c, revision 1.1.1.1

1.1       root        1: /* getfilename() This will print the list of available files to 
                      2:  * stdscr and allow the user to choose one of them for further processing.
                      3: */
                      4: 
                      5: #include <stdio.h>
                      6: #include <curses.h>
                      7: #include "contents.h"
                      8: #include "maillist.h"
                      9: 
                     10: void getfilename()
                     11: {
                     12: int x;
                     13: char tryfile[7][15] = {FILE0,FILE1,FILE2,FILE3,FILE4,FILE5,FILE6};
                     14: 
                     15:        clear();
                     16:        refresh();
                     17:        noecho();
                     18: 
                     19:        /* print our file choices */
                     20: 
                     21:        for (x=8;x<15;x++)
                     22:                {
                     23:                move(x,32);
                     24:                printw("%d. %s",(x-8),tryfile[x-8]);
                     25:                }
                     26: 
                     27:        move(23,0);
                     28:        printw("Press the number corresponding to the desired file/option.");
                     29:        refresh();
                     30: 
                     31:        /* while the returned value of getch is less than 0 or greater
                     32:         * than 6, keep getting a keystroke. This is how we will select
                     33:         * our file to use for further operations.
                     34:        */
                     35: 
                     36:        x = 0;
                     37:        while( x<48 || x>54 )
                     38:                x = getch();
                     39: 
                     40:        if( (x-48)==5)
                     41:                get_net_map();
                     42:        else
                     43:                strcpy(workfile,tryfile[x-48]);
                     44: 
                     45:        echo(); 
                     46:        if (strcmp(workfile,"QUIT")!= 0)
                     47:                {
                     48:                move(23,0);
                     49:                printw("Reading file %s ...",workfile);
                     50:                clrtoeol();
                     51:                refresh();
                     52:                }
                     53: }
                     54: 
                     55: 
                     56: void get_net_map()
                     57: 
                     58: {
                     59: int x;
                     60: char choice;
                     61: 
                     62:        clear();
                     63:        
                     64: 
                     65: 
                     66:        for (x=11;x<15;x++)
                     67:                {
                     68:                move(x,32);
                     69:                printw("%d. %s",(x-11),mapfile[x-11]);
                     70:                }
                     71:        move(23,0);
                     72:        printw("Press the number of the map file to read.");
                     73:        refresh();
                     74: 
                     75:        choice = 0;
                     76:        while( (choice < 48) || (x > 51) )
                     77:                choice = getch();
                     78: 
                     79:        strcpy(workfile,mapfile[choice - 48]);
                     80: 
                     81: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.