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 / XWP.C < prev    next >
Text File  |  1990-07-21  |  3KB  |  212 lines

  1. /*    XWP.C
  2. **
  3. **    The Executive Workplace
  4. */
  5.  
  6. #include "a:stdio.h"
  7. #include "b:oxege.h"
  8.  
  9. #define    FLAGLOC    57
  10.  
  11. char FLmenu;        /* print menu? */
  12. int *FLchain;        /* chain flag location */
  13. extern char FLbclock, FLcalendar, FLerror, FLprint;
  14. extern char stdate[];
  15. extern int year;
  16. extern char FLIclock, FLIcalendar, FLdial;
  17. extern char Tcom[], Tlabel[], Thelp[];
  18. extern char Ecom[], Elabel[], Ehelp[];
  19. extern char Scom[], Slabel[], Shelp[], GLname[];
  20.  
  21. main()
  22.     {
  23.     int choice; 
  24.  
  25.     FLchain = FLAGLOC;
  26.  
  27.     setwindow( 0 );
  28.     defcursor( 0 );
  29.  
  30.     setup();
  31.  
  32.     if ( *FLchain != 255 )            /* Initialize */
  33.         {
  34.         cls();
  35.         ascrn();
  36.         initmsg();
  37.         signon( 1 );
  38.         getdate();
  39.         terminit();
  40.         if ( year < 1986 )
  41.             {
  42.             reset();
  43.             }
  44.         if (FLIclock)
  45.             {
  46.             initclk();
  47.             FLbclock = 1;
  48.             }
  49.         else    {
  50.             FLbclock = NULL;
  51.             }
  52.         if (FLIcalendar)
  53.             {
  54.             FLcalendar = 1;
  55.             calendar();
  56.             }
  57.         else    {
  58.             FLcalendar = NULL;
  59.             }
  60.         exclock();
  61.         }
  62.     else
  63.         {
  64.         if( *( FLchain ) == 255 )    /* Reinitialize */
  65.             {
  66.             ascrn();
  67.             }
  68.         if  ( *(FLchain-1) == 255 )
  69.             {
  70.             initclk();
  71.             FLbclock = 1;
  72.             }
  73.         else    {
  74.             FLbclock = NULL;
  75.             }
  76.         if  ( *(FLchain-2) == 255 )
  77.             {
  78.             FLcalendar = 1;
  79.             calendar();
  80.             }
  81.         else    {
  82.             FLcalendar = NULL;
  83.             }
  84.         }
  85.     FLdial = NULL;
  86.     FLmenu = 1;
  87.     *FLchain = 255;
  88.     getstd();
  89.     minit();
  90.     message( 1, 0, "XWP 1.1" );
  91.     message( 2, 0, greeting() );
  92.     message( 3, 0, stoupper( stdate ) );
  93.  
  94.     while( 1 )
  95.         {
  96.         choice = mainmenu();
  97.         switch( choice )
  98.             {        
  99.             case 1:
  100.                 signon( NULL );
  101.                 break;
  102.             case 2:
  103.                 optmenu();
  104.                 break;
  105.             case 3:
  106.                 filemenu();
  107.                 break;
  108.             case 4:
  109.                 telmenu();
  110.                 break;
  111.             case 5:
  112.                 break;
  113.             case 6:
  114.                 user();
  115.                 break;
  116.             case 7:
  117.                 shellmenu();
  118.                 break;
  119.             case 8:
  120.                 if( FLprint == 1 )
  121.                     {
  122.                     error( "PRINT ACTIVE " );
  123.                     break;
  124.                     }
  125.                 defcursor( 3 );
  126.                 *FLchain = 0;
  127.                 exclock();
  128.                 cls();
  129.                 return;
  130.             }
  131.         }
  132.     }
  133.  
  134. ascrn()
  135.     {
  136.     fill( 1, 1, 22, 78, FILL1, ATTDIM | ATTALT );
  137.     fill( 0, 0, 0, 79, ' ' | ATTINV, ATTDIM | ATTUND );
  138.     fill( 1, 0, 22, 0, OUTDIM, ATTDIM | ATTALT );
  139.     fill( 1, 79, 22, 79, OUTDIM + 1, ATTDIM | ATTALT );
  140.     }
  141.  
  142. /*    TASKS
  143. **
  144. **    Multi-tasking operations for XWP
  145. */
  146. tasks()
  147.     {
  148.     bclock();
  149.     print();
  150.     }
  151.  
  152.  
  153. execl( cmndstr )
  154.     char *cmndstr;
  155.     {
  156.     char *dmaptr;
  157.     if ( FLprint == 1 )
  158.         {
  159.         error( "PRINT ACTIVE" );
  160.         FLerror = 0;
  161.         return;
  162.         }
  163.     dmaptr = 128;
  164.     defwindow( 1, 0, 0, 22, 79 );
  165.     co( 26 );
  166.     strcpy( dmaptr, cmndstr );
  167.     if (FLbclock )
  168.         {
  169.         *(FLchain-1) = 255;
  170.         }
  171.     else    {
  172.         *(FLchain-1) = NULL;
  173.         }
  174.     defcursor( 3 );
  175.     Ubdos( 47, 0 );
  176.     }
  177.  
  178. setup()
  179.     {
  180.     int sdatfile;
  181.     if( (sdatfile = fopen( "XWP.CFG", "r" ) ) == NULL )
  182.         {
  183.         return;
  184.         }
  185.     fscanf( sdatfile, "%d %d %s %s",
  186.         &FLIclock, &FLIcalendar,
  187.         Tcom, Tlabel );
  188.     fgets(  Thelp, 25, sdatfile );
  189.     fscanf( sdatfile, "%s %s", Ecom, Elabel );
  190.     fgets(  Ehelp, 25, sdatfile );
  191.     fscanf( sdatfile, "%s %s", Scom, Slabel );
  192.     fgets(  Shelp, 25, sdatfile );
  193.     fgets(  GLname, 10, sdatfile );
  194.     fclose( sdatfile );
  195.     xcr( Thelp );
  196.     xcr( Ehelp );
  197.     xcr( Shelp );
  198.     xcr( GLname );
  199.     }
  200.  
  201. xcr( string )
  202.     char string[];
  203.     {
  204.     char *pointer;
  205.     pointer = string;
  206.     pointer[ strlen( string ) - 1 ] = 0;
  207.     }
  208.  );
  209.     }
  210.  
  211. xcr( string )
  212.     char