home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / BEEHIVE / UTILITYS / XWP11SRC.ARC / XWPMENU.C < prev    next >
Text File  |  1990-07-21  |  4KB  |  220 lines

  1.  
  2. #include "a:stdio.h"
  3. #include "b:oxege.h"
  4.  
  5. extern char FLmenu, FLbclock, FLcalendar, FLerror;
  6. extern char Ecom[], Elabel[], Ehelp[];
  7. extern char Tcom[], Tlabel[], Thelp[];
  8. extern char Scom[], Slabel[], Shelp[];
  9. extern char filename[], scratch[];
  10. extern int *FLchain;
  11.  
  12. mainmenu()
  13.     { 
  14.     int choice;
  15.  
  16.     setmenu( 1, 10, " HELP " );
  17.     setmenu( 2, 10, " OPTIONS " );
  18.     setmenu( 3, 10, " FILES " );
  19.     setmenu( 4, 10, " TELCOM " );
  20.     setmenu( 5, 10, " " );
  21.     setmenu( 6, 10, " USER " );
  22.     setmenu( 7, 10, " SHELL " );
  23.     setmenu( 8, 10, " EXIT " );
  24.  
  25.     choice = menu( 0, 0, 8, 1, 10, FLmenu );
  26.     FLmenu = 0;
  27.     setwindow( 0 );
  28.     return choice;
  29.     }
  30.  
  31. filemenu()
  32.     {
  33.     int choice;
  34.     setmenu( 1, 10, " SWEEP " );
  35.     setmenu( 2, 10, " EDIT " );
  36.     setmenu( 3, 10, " PRINT " );
  37.     setmenu( 4, 10, " RETURN " );
  38.  
  39.     choice = menu( 1, 20, 1, 4, 10, 1 );
  40.  
  41.     setwindow(0);
  42.     fill( 1, 20, 4, 30, FILL1, ATTDIM | ATTALT );
  43.  
  44.     switch( choice )
  45.         {
  46.         case 1:
  47.             check( Scom );
  48.             if ( FLerror )
  49.                 {
  50.                 FLerror = NULL;
  51.                 return;
  52.                 }
  53.             message( 1, 0, Slabel );
  54.             message( 2, 0, Shelp );
  55.             strcpy( scratch, Scom );
  56.             strcat( scratch, "!xwp" );
  57.             execl( scratch );
  58.             break;
  59.         case 2:
  60.             edit();
  61.             break;
  62.         case 3:
  63.             initprn();
  64.             break;
  65.         case 4:
  66.             break;
  67.         }
  68.     }
  69.  
  70. edit()
  71.     {
  72.     check( Ecom );
  73.     if (FLerror)
  74.         {
  75.         FLerror = NULL;
  76.         return;
  77.         }
  78.     spoke( 1, 20, " FILE TO EDIT:   ", ATTDIM );
  79.     spoke( 2, 20, "                 ", ATTBRT | INVATT);
  80.     adr( 2, 21 );
  81.     fflush( stdin );
  82.     defcursor( 3 );
  83.     gets( filename );
  84.     defcursor( 0 );
  85.     *(FLchain-3) = 255;
  86.     defwindow( 1, 1, 0, 22, 79 );
  87.     cls();
  88.     strcpy( scratch, Ecom );
  89.     strcat( scratch, " " );
  90.     strcat( scratch, filename );
  91.     strcat( scratch, " !xwp " );
  92.     message( 1, 0, Elabel );
  93.     message( 2, 0, Ehelp );
  94.     execl( scratch );
  95.     }
  96.  
  97. optmenu()
  98.     {
  99.     int choice;
  100.  
  101.     setmenu( 1, 12, " CLOCK " );
  102.     setmenu( 2, 12, " CALENDAR " );
  103.     setmenu( 3, 12, " RESET " );
  104.     setmenu( 4, 12, " PRINTER " );
  105.     setmenu( 5, 12, " RETURN " );
  106.  
  107.     choice = menu( 1, 10, 1, 5, 12, 1 );
  108.     setwindow( 0 );
  109.  
  110.     fill( 1, 10, 5, 10+12, FILL1, ATTDIM | ATTALT );
  111.  
  112.     /* switch goes here */
  113.     switch( choice )
  114.         {
  115.         case 1:
  116.             if ( FLbclock == 1)
  117.                 {
  118.                 clrclk();
  119.                 }
  120.             else    {
  121.                 initclk();
  122.                 }
  123.             break;
  124.         case 2:
  125.             if ( FLcalendar )
  126.                 {
  127.                 clrcal();
  128.                 }
  129.             else    {
  130.                 calendar();
  131.                 }
  132.             FLcalendar = !FLcalendar;
  133.             break;
  134.         case 3:
  135.             reset();
  136.             break;
  137.         case 4:
  138.             printer();
  139.             break;
  140.         case 5:
  141.             break;
  142.         }
  143.     }
  144.  
  145. telmenu()
  146.     {
  147.     int choice;
  148.     setmenu( 1, 10, " DIAL " );
  149.     setmenu( 2, 10, " TERM " );
  150.     setmenu( 3, 10, " TELCOM " );
  151.     setmenu( 4, 10, " RETURN " );
  152.     choice = menu( 1, 30, 1, 4, 10, 1 );
  153.     fill( 1, 30, 4, 40, FILL1, ATTDIM | ATTALT );
  154.     switch( choice )
  155.         {
  156.         case 1:
  157.             dial();
  158.             break;
  159.         case 2:
  160.             term();
  161.             break;
  162.         case 3:
  163.             check( Tcom );
  164.             if ( FLerror )
  165.                 {
  166.                 FLerror = NULL;
  167.                 return;
  168.                 }
  169.             message( 1, 0, Tlabel );
  170.             message( 2, 0, Thelp );
  171.             strcpy( scratch, Tcom );
  172.             strcat( scratch, "!xwp" );
  173.             execl( scratch );
  174.             break;
  175.         case 4:
  176.             break;
  177.         }
  178.     }
  179.  
  180. shellmenu()
  181.     {
  182.     int choice;
  183.     setmenu( 1, 10, " EXECUTE " );
  184.     setmenu( 2, 10, " CP/M+ " );
  185.     setmenu( 3, 10, " RETURN " );
  186.     choice = menu( 1, 60, 1, 3, 10, 1 );
  187.     fill( 1, 60, 3, 70, FILL1, ATTDIM | ATTALT );
  188.     switch( choice )
  189.         {
  190.         case 1:
  191.             fill( 4, 20, 7, 60, ' ', ATTBRT );
  192.             outline( 4, 20, 7, 60, OUTBLK, ATTDIM | ATTALT );
  193.             fill( 5, 21, 5, 59, ' ' | ATTINV, ATTDIM );
  194.             spoke( 5, 28, " Enter CP/M command line: ", ATTDIM );
  195.             setwindow( 0 );
  196.             defcursor( 3 );
  197.             defwindow( 1, 6, 21, 6, 59 );
  198.             gets( scratch );
  199.             strcat( scratch, "!xwp " );
  200.             message( 1, 0, "XWP" );
  201.             message( 2, 0, "EXECUTING COMMAND..." );
  202.             execl( scratch );
  203.             break;
  204.         case 2:
  205.             message( 1, 0, "CP/M+" );
  206.             message( 2, 0, " " );
  207.             defwindow( 1, 0, 0, 22, 79 );
  208.             defcursor( 3 );
  209.             co( 26 );
  210.             abort( 1 );
  211.             break;
  212.         case 3:
  213.             break;
  214.         }
  215.     }
  216.  
  217.         defwindow( 1, 0, 0, 22, 79 );
  218.             defcursor( 3 );
  219.             co( 26 );
  220.             abo