home *** CD-ROM | disk | FTP | other *** search
/ Mega CD-ROM 1 / megacd_rom_1.zip / megacd_rom_1 / MISCUTL / SYMPLE.ZIP / SYMPLE.C next >
Text File  |  1986-08-26  |  42KB  |  1,454 lines

  1. /***********************************************************************
  2.  *                                       *
  3.  *   symple.c                                   *
  4.  *       (c) 1986 by Collin Brendemuehl                   *
  5.  *               B Systems                       *
  6.  *               3228 S. Blvd. #171                   *
  7.  *               Edmond OK 73013                       *
  8.  *               (405) 341-7437                       *
  9.  *       All Rights Reserved.                        *
  10.  *   Symple is a configurable DOS system manager for MS-DOS.  It will  *
  11.  *   allow the user to set up a complex menu system or a simple DOS    *
  12.  *   manager for the benefit of anyone who is tired of learning/teach- *
  13.  *   ing/typing DOS commands.                           *
  14.  *   Symple was written in C and is for use with either Lattice 3.x or *
  15.  *   Mark Williams C.  It was written so that any conversion to/from   *
  16.  *   other compilers is a simple matter.                   *
  17.  *   For more information on inexpensive tools from B Systems/Collin   *
  18.  *   Brendemuehl, please register your copy, noncommercial, at $19.95. *
  19.  *   At the time of registration you will receive a serialized copy    *
  20.  *   of Symple.  When a distributed copy of YOUR serial number is      *
  21.  *   registered, I will send you $4.00.  Registration also entitles    *
  22.  *   to discounts on my other software packages.               *
  23.  *   Also, please do not violate the spirit of "shareware"--please     *
  24.  *   distribute the software with the Documentation for personal,      *
  25.  *   non-commercial use.  A License is available for commercial use,   *
  26.  *   along with source code.  Thanks for your assistance.           *
  27.  ***********************************************************************/
  28.  
  29. #include "symple.h"
  30.  
  31. main()
  32.      {
  33.      initialize();     /* initialize the system      */
  34.      operate();        /* operate Symple         */
  35.      }
  36.  
  37. /***********************************************************************/
  38. /*                                       */
  39. /*   System Initialization                           */
  40. /*                                       */
  41. /***********************************************************************/
  42.  
  43. initialize()
  44.      {
  45.      up_front();         /* draw the start-up screen   */
  46.      memory_allocation();    /* allocate memory        */
  47.      get_cfg("symple.cfg");  /* get the default .cfg file  */
  48.      cls();             /* clear the screen       */
  49.      display_setup();         /* setup the initial display  */
  50.      }
  51.  
  52. /***********************************************************************/
  53. /*                                       */
  54. /*   Up Front                                   */
  55. /*                                       */
  56. /***********************************************************************/
  57.  
  58. up_front()     /* fairly self-explanatory    */
  59.      {
  60.      long ii;
  61.      cls();     /* for Lattice C, putsnb should be replaced with printf */
  62.      locate( 5,12); putsnb("╔════════╗                                ┌──┐ ╔═════╗");
  63.      locate( 6,12); putsnb("║  ╔═════╝                                │  │ ║  ╔══╝");
  64.      locate( 7,12); putsnb("║  ╚═════╗ ┌──┐┌──┐ ┌──────────┐ ┌──────┐ │  │ ║  ╚═╗ ");
  65.      locate( 8,12); putsnb("╚═════╗  ║ │  ││  │ │  ┌┐  ┌┐  │ │  ┌┐  │ │  │ ║  ╔═╝ ");
  66.      locate( 9,12); putsnb("╔═════╝  ║ │  └┘  │ │  ││  ││  │ │  └┘  │ │  │ ║  ╚══╗");
  67.      locate(10,12); putsnb("╚════════╝ └───┐  │ └──┘└──┘└──┘ │  ┌───┘ └──┘ ╚═════╝");
  68.      locate(11,12); putsnb("           ┌───┘  │              │  │");
  69.      locate(12,12); putsnb("           └──────┘              └──┘");
  70.      locate(14,10); putsnb("     Use Free of Charge.  Or register Symple for $20.00 for");
  71.      locate(15,10); putsnb("non-commercial use.  Commercial License available.");
  72.      locate(16,34); putsnb("Serial #684F");    /* FIDO in "hex" (so to bark) */
  73.      locate(17,34); putsnb("Collin Brendemuehl");
  74.      locate(18,34); putsnb("3882 S Blvd #171");
  75.      locate(19,34); putsnb("Edmond OK 73013");
  76.      locate(20,34); putsnb("(405) 341-7437");
  77.      locate(23,0);  putsnb("System Manager Plus");
  78.      locate(24,0);  putsnb("Copyright 1986 by Collin Brendemuehl");
  79.      for(ii=0;ii<80000l;ii++);
  80.      for(ii=0;ii<80000l;ii++);
  81.      for(ii=0;ii<80000l;ii++);
  82.      for(ii=0;ii<80000l;ii++);
  83.      }
  84.  
  85. /***********************************************************************/
  86. /*                                       */
  87. /*   General Operation Loop                           */
  88. /*                                       */
  89. /***********************************************************************/
  90.  
  91. operate()
  92.      {
  93.      int ii;
  94.  
  95.      do    {
  96.        fill_window(3,8,3,16,0x70);
  97.        locate(3,8);
  98.        putsnb("Functions");
  99.        while( kbhit()!=TRUE)   /* if no key has been hit     */
  100.          new_time();       /*  do a time update      */
  101.                    /* kbhit is OPPOSITE lattice  */
  102.        ii = getfch();       /* now get a character     */
  103.                    /* a handy little function!     */
  104.        noftitle();           /* clear title         */
  105.        switch(ii)           /* call execute with proper     */
  106.          {           /* operation in hand      */
  107.          case F1:   execute(funcommand[0][0]); break;
  108.          case F2:   execute(funcommand[0][1]); break;
  109.          case F3:   execute(funcommand[0][2]); break;
  110.          case F4:   execute(funcommand[0][3]); break;
  111.          case F5:   execute(funcommand[0][4]); break;
  112.          case F6:   execute(funcommand[0][5]); break;
  113.          case F7:   execute(funcommand[0][6]); break;
  114.          case F8:   execute(funcommand[0][7]); break;
  115.          case F9:   execute(funcommand[0][8]); break;
  116.          case F10:  execute(funcommand[0][9]); break;
  117.          case SF1:  execute(funcommand[1][0]); break;
  118.          case SF2:  execute(funcommand[1][1]); break;
  119.          case SF3:  execute(funcommand[1][2]); break;
  120.          case SF4:  execute(funcommand[1][3]); break;
  121.          case SF5:  execute(funcommand[1][4]); break;
  122.          case SF6:  execute(funcommand[1][5]); break;
  123.          case SF7:  execute(funcommand[1][6]); break;
  124.          case SF8:  execute(funcommand[1][7]); break;
  125.          case SF9:  execute(funcommand[1][8]); break;
  126.          case SF10: execute(funcommand[1][9]); break;
  127.          case AF1:  execute(funcommand[2][0]); break;
  128.          case AF2:  execute(funcommand[2][1]); break;
  129.          case AF3:  execute(funcommand[2][2]); break;
  130.          case AF4:  execute(funcommand[2][3]); break;
  131.          case AF5:  execute(funcommand[2][4]); break;
  132.          case AF6:  execute(funcommand[2][5]); break;
  133.          case AF7:  execute(funcommand[2][6]); break;
  134.          case AF8:  execute(funcommand[2][7]); break;
  135.          case AF9:  execute(funcommand[2][8]); break;
  136.          case AF10: execute(funcommand[2][9]); break;
  137.          case CF1:  execute(funcommand[3][0]); break;
  138.          case CF2:  execute(funcommand[3][1]); break;
  139.          case CF3:  execute(funcommand[3][2]); break;
  140.          case CF4:  execute(funcommand[3][3]); break;
  141.          case CF5:  execute(funcommand[3][4]); break;
  142.          case CF6:  execute(funcommand[3][5]); break;
  143.          case CF7:  execute(funcommand[3][6]); break;
  144.          case CF8:  execute(funcommand[3][7]); break;
  145.          case CF9:  execute(funcommand[3][8]); break;
  146.          case CF10: execute(funcommand[3][9]); break;
  147.          case PGDN: rotate(); break;
  148.          case HOME: display_contents(); break;
  149.          default:   break;
  150.          }
  151.        } while(ii!=ESC);
  152.      setcsize(1,5);
  153.      cls();
  154.      locate(0,0);
  155.      putsnb("Thank you for using Symple.");
  156.      }
  157.  
  158. noftitle()
  159.      {
  160.      clear_window(3,8,3,16);
  161.      locate(3,8);
  162.      putsnb("Functions");
  163.      }
  164.  
  165. /***********************************************************************/
  166. /*                                       */
  167. /*   Setup the screen for display                       */
  168. /*                                       */
  169. /***********************************************************************/
  170.  
  171. display_setup()
  172.      {
  173.      cls();             /* clear the screen     */
  174.      setcsize(14,14);         /* get rid of cursor    */
  175.      borders();          /* draw borders         */
  176.      titles();             /* display titles         */
  177.      display_contents();     /* display contents     */
  178.      }
  179.  
  180. /***********************************************************************/
  181. /*                                       */
  182. /*   Display the Contents on the Screen                    */
  183. /*                                       */
  184. /***********************************************************************/
  185.  
  186. display_contents()
  187.      {
  188.      display_directory();       /* the directory       */
  189.      display_cfg();           /* the .cfg prompt lines*/
  190.      infowindow();           /* the path, drive, etc.*/
  191.      time_display();           /* the time and date    */
  192.      }
  193.  
  194. /***********************************************************************/
  195. /*                                       */
  196. /*   Display the Functions                           */
  197. /*                                       */
  198. /***********************************************************************/
  199.  
  200. display_cfg()
  201.      {
  202.      int i;
  203.      static char *sac[4] =
  204.        {
  205.        "      ",
  206.        "Shift-",
  207.        "  Alt-",
  208.        " Ctrl-"
  209.        };
  210.      cfg_window();
  211.      for( i=0 ; i<10 ; i++ )
  212.        {
  213.        locate(funloc[i][0],funloc[i][1]);
  214.        putsnb(sac[ilevel]);
  215.        locate(funloc[i][0],funloc[i][1]+6);
  216.        putsnb(funnames[i]);
  217.        locate(funloc[i][0],funloc[i][1]+10);
  218.        putsnb(funtitles[ilevel][i]);
  219.        }
  220.      }
  221.  
  222. /***********************************************************************/
  223. /*                                       */
  224. /*   Display the Titles                            */
  225. /*                                       */
  226. /***********************************************************************/
  227.  
  228. titles()
  229.      {
  230.      locate(1,40 - (strlen(system_title) / 2 ) );
  231.                putsnb(system_title);
  232.      locate(3,8);      putsnb("Functions");
  233.      locate(16,24);    putsnb("Calculator and System Information");
  234.      locate(3,50);     putsnb(" Directory ");
  235.      }
  236.  
  237. /***********************************************************************/
  238. /*                                       */
  239. /*   Draw the Borders                               */
  240. /*                                       */
  241. /***********************************************************************/
  242.  
  243. borders()
  244.      {
  245.      int i;
  246.      locate(0,0);     putcnb('┌');
  247.      locate(24,0);    putcnb('└');
  248.      locate(0,78);    putcnb('┐');
  249.      locate(24,78);   putcnb('┘');
  250.      for(i=1;i<78;i++)
  251.        {
  252.        locate(0,i);  putcnb('─');
  253.        locate(2,i);  putcnb('─');
  254.        locate(4,i);  putcnb('─');
  255.        locate(15,i); putcnb('─');
  256.        locate(17,i); putcnb('─');
  257.        locate(24,i); putcnb('─');
  258.        }
  259.      for(i=1;i<24;i++)
  260.        {
  261.        locate(i,0);  putcnb('│');
  262.        locate(i,78); putcnb('│');
  263.        if(i>2 && i<15) {
  264.          locate(i,40); putcnb('│'); }
  265.        }
  266.  
  267.      locate(2,40);     putcnb('┬');
  268.      locate(4,40);     putcnb('┼');
  269.      locate(15,40);    putcnb('┴');
  270.      locate(2,0);      putcnb('├');
  271.      locate(4,0);      putcnb('├');
  272.      locate(15,0);     putcnb('├');
  273.      locate(17,0);     putcnb('├');
  274.  
  275.      locate(2,78);     putcnb('┤');
  276.      locate(4,78);     putcnb('┤');
  277.      locate(15,78);    putcnb('┤');
  278.      locate(17,78);    putcnb('┤');
  279.      }
  280.  
  281. /***********************************************************************/
  282. /*                                       */
  283. /*   Load the Configuration File                       */
  284. /*                                       */
  285. /***********************************************************************/
  286.  
  287. get_cfg(fe_cfg)
  288.      char *fe_cfg;
  289.      {
  290.      int i,j;
  291.      FILE *fecfg;
  292.      fecfg = fopen(fe_cfg,"r");
  293.      fgets(system_title,0x80,fecfg);
  294.      for(i=0;i<4;i++)
  295.        {
  296.        for(j=0;j<10;j++)
  297.          {
  298.          fgets(funtitles[i][j],0x80,fecfg);
  299.          fgets(funcommand[i][j],0x80,fecfg);
  300.          funcommand[i][j][strlen(funcommand[i][j])-1]='\0';
  301.          }
  302.        }
  303.      fclose(fecfg);
  304.      }
  305.  
  306. /***********************************************************************/
  307. /*                                       */
  308. /*   Allocate Memory for the System                       */
  309. /*                                       */
  310. /***********************************************************************/
  311.  
  312. memory_allocation()
  313.      {
  314.      int i,j;
  315.      int strcmp();
  316.  
  317.      dirtag = (char*) malloc(300*sizeof(char));
  318.      directory = (char**)malloc(300*sizeof(char*));
  319.  
  320.      for(i=0;i<300;i++)
  321.        directory[i] = (char*)malloc(15*sizeof(char));
  322.  
  323.      get_directory("*.*");
  324.  
  325.      for(i=0;i<4;i++)
  326.        for(j=0;j<10;j++)
  327.          {
  328.          funtitles[i][j]=(char*)malloc(20*sizeof(char));
  329.          funcommand[i][j]=(char*)malloc(30*sizeof(char));
  330.          }
  331.      }
  332.  
  333. /***********************************************************************/
  334. /*                                       */
  335. /*   Get the General Directory                           */
  336. /*                                       */
  337. /***********************************************************************/
  338.  
  339. get_directory(format)
  340.      char *format;
  341.      {
  342.      dircount=0;
  343.      get_dir(format,0);
  344.      if(last_dir_format != format)
  345.        strcpy(last_dir_format,format);
  346.      }
  347.  
  348. /***********************************************************************/
  349. /*                                       */
  350. /*   Get the Directory                               */
  351. /*                                       */
  352. /***********************************************************************/
  353.  
  354. get_dir(format,atrib)
  355.      char *format;
  356.      int atrib;
  357.      {
  358.      if(dfind(&finfo,format,atrib)==TRUE)
  359.        do     {
  360.          dirtag[dircount]    = '-';
  361.  
  362.          strcpy(directory[dircount++],finfo.fnd_name);
  363.          } while(dnext(&finfo)==TRUE && dircount <300);
  364.      }
  365.  
  366. /***********************************************************************/
  367. /*                                       */
  368. /*   Display the Directory                           */
  369. /*                                       */
  370. /***********************************************************************/
  371.  
  372. display_directory()
  373.      {
  374.      int i;
  375.      dir_window();
  376.      for( i = 0 ; i < min(dircount,10) ; i++)
  377.        {
  378.        locate(dirloc[i][0],dirloc[i][1]);
  379.        sprintf(temp,"%c  %-12s ",dirtag[i],directory[i]);
  380.        putsnb(temp);
  381.        }
  382.      }
  383.  
  384. /***********************************************************************/
  385. /*                                       */
  386. /*   Rotate the Normal Shift Alternate Control Function Keys           */
  387. /*                                       */
  388. /***********************************************************************/
  389.  
  390. rotate()
  391.      {
  392.      if(++ilevel==4) ilevel=0;
  393.      display_cfg();
  394.      }
  395.  
  396. /***********************************************************************/
  397. /*                                       */
  398. /*   Function Execution                            */
  399. /*                                       */
  400. /***********************************************************************/
  401.  
  402. execute(strcom)
  403.      char *strcom;
  404.      {
  405.      char c;
  406.      switch(*strcom)
  407.        {
  408.        case '1': new_cfg();
  409.              break;
  410.        case '2': program_tags(1);
  411.              break;
  412.        case '3': delete_tags();
  413.              break;
  414.        case '4': copy_tags();
  415.              break;
  416.        case '5': print_tags();
  417.              break;
  418.        case '6': un_tags();
  419.              break;
  420.        case '7': new_dir(strcom+1);
  421.              break;
  422.        case '8': manual_entry("Change to Directory: ");
  423.              chdir(manual_command);
  424.              break;
  425.        case '9': manual_entry("Remove Directory: ");
  426.              rmdir(manual_command);
  427.              break;
  428.        case '0': manual_entry("Create Directory: ");
  429.              mkdir(manual_command);
  430.              break;
  431.        case '=': manual_entry("Manual DOS Command: ");
  432.              cls();
  433.              system(manual_command);
  434.              putsnb("Hit <RETURN> to return to Symple");
  435.              c = getcnb();
  436.              cls();
  437.              display_setup();
  438.              break;
  439.        case '/': program_tags(0);
  440.              break;
  441.        case '+': calculator();
  442.              break;
  443.        case '!': mkdir(strcom+1);
  444.              break;
  445.        case '@': chdir(strcom+1);
  446.              break;
  447.        case '%': rmdir(strcom+1);
  448.              break;
  449.        case '*': chdrive(strcom+1);
  450.              break;
  451.        case '&': manual_entry("Drive Selected: ");
  452.              chdrive(manual_command);
  453.              break;
  454.        case '^': get_cfg(strcom+1);
  455.              display_cfg(0);
  456.              break;
  457.        default : cls();
  458.              setcsize(1,5);
  459.              system(strcom);
  460.              setcsize(14,14);
  461.              putsnb("Hit <RETURN> to return to Symple");
  462.              c = getcnb();
  463.              cls();
  464.              display_setup();
  465.        }
  466.      }
  467.  
  468. /***********************************************************************/
  469. /*                                       */
  470. /*   Set up the Information Window                       */
  471. /*                                       */
  472. /***********************************************************************/
  473.  
  474. infowindow()
  475.      {
  476.      text_window();
  477.      locate(18,10);
  478.      disk_space();
  479.      sprintf(temp,"%10ld Drive Size  %10ld Free Space   %2ld%% Unused",
  480.            disk_size,         free_space,     disk_slack);
  481.      putsnb(temp);
  482.      locate(19,10);
  483.      putsnb("Current Path : ");
  484.      locate(19,25);
  485.      current_drive();
  486.      putcnb('A' + REGS.HREG.r_al);     putsnb(":\\");
  487.      getpath();
  488.      locate(19,28);
  489.      putsnb((char*)REGS.WREG.r_si);
  490.      locate(20,10);
  491.      putsnb("PgDn Shows more Function Key Options");
  492.      locate(21,10);
  493.      putsnb("Esc Exits to DOS, HOME Rewrites Screen Contents.");
  494.      }
  495.  
  496. /***********************************************************************/
  497. /*                                       */
  498. /*   A Simple Calculator                           */
  499. /*                                       */
  500. /***********************************************************************/
  501.  
  502. calculator()
  503.      {
  504.      text_window();
  505.      dispstack();
  506.      calc_input();
  507.      infowindow();
  508.      }
  509.  
  510. /***********************************************************************/
  511. /*                                       */
  512. /*   Display the Stack                               */
  513. /*                                       */
  514. /***********************************************************************/
  515.  
  516. dispstack()
  517.      {
  518.      int i;
  519.      for(i=0;i<=5;i++)
  520.        {
  521.        locate(18+i,8);
  522.        sprintf(temp,"%c. %15.6lf",'1'+i,calcstack[i]);
  523.        putsnb(temp);
  524.        }
  525.      }
  526.  
  527. /***********************************************************************/
  528. /*                                       */
  529. /*   Calculator Entry and Operations                       */
  530. /*                                       */
  531. /***********************************************************************/
  532.  
  533. calc_input()
  534.      {
  535.      static double rval = 0.0;
  536.      static double lval = 0.0;
  537.      static double mval = 0.0;
  538.      static char ul[] = "_______________";
  539.      char calca[16];
  540.      char calcb[16];
  541.      char formula;
  542.  
  543.      fill_window(16,24,16,33,0x70);
  544.      locate(16,24);
  545.      putsnb("Calculator");
  546.  
  547.      locate(21,40);    putsnb("...............");
  548.      locate(22,40);    putsnb(ul);
  549.      locate(23,40);    putsnb("+ - * /");
  550.  
  551.      for(;;)
  552.        {
  553.        locate(22,40);
  554.        sprintf(temp,"%15.6lf",mval);
  555.        putsnb(temp);
  556.  
  557.        locate(19,40);
  558.        putsnb(ul);
  559.        locate(20,40);
  560.        putsnb(ul);
  561.            /*  123456789012345 */
  562.  
  563.        locate(19,38);
  564.        putcnb('>');
  565.        locate(19,40);
  566.        while( kbhit()!=TRUE)
  567.          {
  568.          new_time();
  569.          locate(19,40);
  570.          }
  571.        locate(19,40);
  572.        gets(calca);
  573.        locate(19,38);
  574.        putcnb(' ');
  575.        if(strlen(calca)==0) break;
  576.  
  577.        if(calca[0]=='P')
  578.          {
  579.          switch(calca[1])
  580.                {
  581.                case '1': lval = calcstack[0]; break;
  582.                case '2': lval = calcstack[1]; break;
  583.                case '3': lval = calcstack[2]; break;
  584.                case '4': lval = calcstack[3]; break;
  585.                case '5': lval = calcstack[4]; break;
  586.                case '6': lval = calcstack[5]; break;
  587.                }
  588.          }
  589.        else
  590.        if(calca[0]=='S')
  591.          {
  592.          switch(calca[1])
  593.                {
  594.                case '1': calcstack[0] = mval; break;
  595.                case '2': calcstack[1] = mval; break;
  596.                case '3': calcstack[2] = mval; break;
  597.                case '4': calcstack[3] = mval; break;
  598.                case '5': calcstack[4] = mval; break;
  599.                case '6': calcstack[5] = mval; break;
  600.                }
  601.          dispstack();
  602.          continue;
  603.          }
  604.        else  lval = atof(calca);
  605.  
  606.        locate(19,40);
  607.        sprintf(temp,"%15.6lf",lval);
  608.        putsnb(temp);
  609.  
  610.        locate(20,38);
  611.        putcnb('>');
  612.        locate(20,40);
  613.        while( kbhit()!=TRUE)
  614.          {
  615.          new_time();
  616.          locate(20,40);
  617.          }
  618.        locate(20,40);
  619.        gets(calcb);
  620.        locate(20,38);
  621.        putcnb(' ');
  622.  
  623.        if(strlen(calcb)==0) rval = 0.0;
  624.        else
  625.        if(calcb[0]=='P')
  626.          {
  627.          switch(calcb[1])
  628.                {
  629.                case '1': rval = calcstack[0]; break;
  630.                case '2': rval = calcstack[1]; break;
  631.                case '3': rval = calcstack[2]; break;
  632.                case '4': rval = calcstack[3]; break;
  633.                case '5': rval = calcstack[4]; break;
  634.                case '6': rval = calcstack[5]; break;
  635.                }
  636.          }
  637.        else  rval = atof(calcb);
  638.  
  639.        locate(20,40);
  640.        sprintf(temp,"%15.6lf",rval);
  641.        putsnb(temp);
  642.  
  643.        locate(23,38);
  644.        putcnb('>');
  645.        do     {
  646.          locate(23,48);
  647.          formula = getcnb();
  648.          } while(formula != '+' && formula != '-' &&
  649.              formula != '*' && formula != '/' );
  650.        switch(formula)
  651.          {
  652.          case '+': mval = rval + lval; break;
  653.          case '-': mval = rval - lval; break;
  654.          case '*': mval = rval * lval; break;
  655.          case '/': mval = rval / lval; break;
  656.          }
  657.        locate(23,38);
  658.        putcnb(' ');
  659.        }
  660.      clear_window(16,24,16,33);
  661.      locate(16,24);
  662.      putsnb("Calculator");
  663.      }
  664.  
  665. /***********************************************************************/
  666. /*                                       */
  667. /*   Get the new Directory Listing                       */
  668. /*                                       */
  669. /***********************************************************************/
  670.  
  671. new_dir(dstring)
  672.      char *dstring;
  673.      {
  674.      get_directory(dstring);
  675.      display_directory();
  676.      }
  677.  
  678. /***********************************************************************/
  679. /*                                       */
  680. /*   Tag Files/Scan Files                           */
  681. /*                                       */
  682. /***********************************************************************/
  683.  
  684. program_tags(mode)
  685.      int mode;
  686.      {
  687.      int i,j,k;
  688.  
  689.      fill_window(3,50,3,60,0x70);
  690.      locate(3,50);
  691.      putsnb(" Directory ");
  692.  
  693.      text_window();
  694.      locate(20,20);
  695.      if(mode==1)
  696.        putsnb("T)ag U)ntag ");
  697.      putsnb("UP-Prev DOWN/<Space>-Next ESC-Quit HOME-First");
  698.      dir_window();
  699.      /***********************************/
  700.      /*    Tag Prompt            */
  701.      /***********************************/
  702.      locate(dirloc[0][0],dirloc[0][1]-2);
  703.      putcnb('>');
  704.  
  705.      /***********************************/
  706.      /*    Tag Prompt            */
  707.      /***********************************/
  708.      for( i = 0 ; i < min(dircount,10) ; i++ )
  709.        {
  710.        locate(dirloc[i][0],dirloc[i][1]);
  711.        sprintf(temp,"%c  %-12s ",dirtag[i],directory[i]);
  712.        putsnb(temp);
  713.        }
  714.  
  715.      for(i=0;i<dircount;i++)
  716.        {
  717.        /***********************************/
  718.        /*     User Entry              */
  719.        /***********************************/
  720. userloop:
  721.        while( kbhit() != TRUE)
  722.          new_time();
  723.        j = getfch();
  724.  
  725.        /***********************************/
  726.        /*     User Options              */
  727.        /***********************************/
  728.  
  729.        switch(j)
  730.          {
  731.          case UP   :
  732.                i -= 2;
  733.                if(i == -2)
  734.                  i = -1;
  735.                else  dir_window_down();
  736.  
  737.                locate(dirloc[0][0],dirloc[0][1]);
  738.                sprintf(temp,"%c  %12s",
  739.                  dirtag[i+1],directory[i+1]);
  740.                putsnb(temp);
  741.                break;
  742.          case DOWN :
  743.          case ' '  :
  744.                dir_window_up();
  745.                if(i == dircount) i = 0;
  746.                if(i+10 < dircount)
  747.                  {
  748.                  locate(dirloc[9][0],dirloc[9][1]);
  749.                  sprintf(temp,"%c  %12s",
  750.                      dirtag[i+10],directory[i+10]);
  751.                  putsnb(temp);
  752.                  }
  753.                break;
  754.          case 't'  :
  755.          case 'T'  :
  756.                if(mode==1)
  757.                  {
  758.                  dirtag[i] = 'T';
  759.                  locate(dirloc[0][0],dirloc[0][1]);
  760.                  putcnb(dirtag[i]);
  761.                  goto userloop;
  762.                  }
  763.                break;
  764.          case 'u'  :
  765.          case 'U'  :
  766.                if(mode==1)
  767.                  {
  768.                  dirtag[i] = '-';
  769.                  locate(dirloc[0][0],dirloc[0][1]);
  770.                  putcnb(dirtag[i]);
  771.                  goto userloop;
  772.                  }
  773.                break;
  774.          case HOME :
  775.                dir_window();
  776.                for( k = 0 ; k < min(dircount,10) ; k++ )
  777.                  {
  778.                  locate(dirloc[k][0],dirloc[k][1]);
  779.                  sprintf(temp,"%c  %12s",
  780.                      dirtag[k],directory[k]);
  781.                  putsnb(temp);
  782.                  }
  783.                i = -1;
  784.                continue;
  785.          case ESC  :
  786.                locate(dirloc[0][0],dirloc[0][1]-2);
  787.                putcnb(' ');
  788.                clear_window(3,50,3,60);
  789.                locate(3,50);
  790.                putsnb(" Directory ");
  791.                locate(20,8);
  792.                clrline();
  793.                display_directory();
  794.                infowindow();
  795.                return;
  796.          default: i--;
  797.          }
  798.        /***********************************/
  799.        /*     Loop Continuation          */
  800.        /***********************************/
  801.        if(i==dircount) i = -1;
  802.        }
  803.      clear_window(3,50,3,60);
  804.      locate(3,50);
  805.      putsnb(" Directory ");
  806.      locate(20,8);
  807.      clrline();
  808.      display_directory();
  809.      infowindow();
  810.      }
  811.  
  812. /***********************************************************************/
  813. /*                                       */
  814. /*   Display the File Tag Status                       */
  815. /*                                       */
  816. /***********************************************************************/
  817.  
  818. display_entry(table_entry)
  819.      int table_entry;
  820.      {
  821.      if(table_entry<13)
  822.        {
  823.        locate(dirloc[table_entry][0],dirloc[table_entry][1]-9);
  824.        putcnb(dirtag[table_entry]);
  825.        }
  826.      }
  827.  
  828. /***********************************************************************/
  829. /*                                       */
  830. /*   Delete all tagged files                           */
  831. /*                                       */
  832. /***********************************************************************/
  833.  
  834. delete_tags()
  835.      {
  836.      int i;
  837.      locate(20,8);     clrline();
  838.      locate(20,8);
  839.      putsnb("Deleting Files : ");
  840.      for(i=0;i<dircount;i++)
  841.        {
  842.        if(dirtag[i] == 'T')
  843.          {
  844.          locate(20,25);
  845.          putsnb(directory[i]);
  846.          putsnb("          ");
  847.          unlink(directory[i]);
  848.          }
  849.        }
  850.      get_directory();
  851.      display_directory();
  852.      }
  853.  
  854. /***********************************************************************/
  855. /*                                       */
  856. /*   Backup the Tagged Files                           */
  857. /*                                       */
  858. /***********************************************************************/
  859.  
  860. copy_tags()
  861.      {
  862.      int i;
  863.      manual_entry("Destination Directory:");
  864.      for(i=0;i<dircount;i++)
  865.        {
  866.        if(dirtag[i] == 'T')
  867.          {
  868.          strcpy(temp,"copy ");
  869.          strcat(directory[i]);
  870.          strcat(temp," ");
  871.          strcat(temp,manual_command);
  872.          strcat(temp," > NUL:");
  873.          system(temp);
  874.          }
  875.        }
  876.      }
  877.  
  878. /***********************************************************************/
  879. /*                                       */
  880. /*   Send Tagged Files to the Printer                       */
  881. /*                                       */
  882. /***********************************************************************/
  883.  
  884. print_tags()
  885.      {
  886.      int i;
  887.      for(i=0;i<dircount;i++)
  888.        {
  889.        if(dirtag[i] == 'T')
  890.          {
  891.          strcpy(temp,"pr ");
  892.          strcat(temp,directory[i]);
  893.          system(temp);
  894.          }
  895.        }
  896.      }
  897.  
  898. /***********************************************************************/
  899. /*                                       */
  900. /*   Untag the tagged files                           */
  901. /*                                       */
  902. /***********************************************************************/
  903.  
  904. un_tags()
  905.      {
  906.      int i;
  907.      for(i=0;i<300;i++)
  908.        dirtag[i] = '-';
  909.      }
  910.  
  911. /***********************************************************************/
  912. /*                                       */
  913. /*   Get the new "config" File                                         */
  914. /*                                       */
  915. /***********************************************************************/
  916.  
  917. new_cfg()
  918.      {
  919.      FILE *tmfile;
  920.      do    {
  921.        manual_entry("New Config File: ");
  922.        if(strlen(manual_command)==0) return;
  923.        tmfile=fopen(manual_command,"r");
  924.        }while(tmfile==0);
  925.      fclose(tmfile);
  926.      get_cfg(manual_command);
  927.      display_cfg(0);
  928.      }
  929.  
  930. /***********************************************************************/
  931. /*                                       */
  932. /*   Manual Command Line Entry.                        */
  933. /*                                       */
  934. /***********************************************************************/
  935.  
  936. manual_entry(prompt)
  937.      char *prompt;
  938.      {
  939.      locate(22,8);
  940.      putsnb(prompt);
  941.      while( kbhit()!=TRUE)
  942.        {
  943.        new_time();
  944.        locate(22,8);
  945.        }
  946.      locate(22,8+strlen(prompt)+1);
  947.      setcsize(1,5);
  948.      gets(manual_command);
  949.      setcsize(14,14);
  950.      locate(22,8);
  951.      clrline();
  952.      locate(22,8);
  953.      }
  954.  
  955. /***********************************************************************/
  956. /*                                       */
  957. /*  Clear the contents of a line.                       */
  958. /*                                       */
  959. /***********************************************************************/
  960.  
  961. clrline()
  962.      {
  963.      putsnb("                                                              ");
  964.      }
  965.  
  966. /***********************************************************************/
  967. /*                                       */
  968. /*   Clear Function Window                           */
  969. /*                                       */
  970. /***********************************************************************/
  971.  
  972. cfg_window()
  973.      {
  974.      clear_window(5,1,14,39);
  975.      }
  976.  
  977. /***********************************************************************/
  978. /*                                       */
  979. /*   Directory Window UP                           */
  980. /*                                       */
  981. /***********************************************************************/
  982.  
  983. dir_window_up()
  984.      {
  985.      scroll_window_up(5,41,14,74);
  986.      }
  987.  
  988. /***********************************************************************/
  989. /*                                       */
  990. /*   Clear directory Window                           */
  991. /*                                       */
  992. /***********************************************************************/
  993.  
  994. dir_window_down()
  995.      {
  996.      scroll_window_down(5,41,14,74);
  997.      }
  998.  
  999. /***********************************************************************/
  1000. /*                                       */
  1001. /*   Clear directory Window                           */
  1002. /*                                       */
  1003. /***********************************************************************/
  1004.  
  1005. dir_window()
  1006.      {
  1007.      clear_window(5,41,14,74);
  1008.      }
  1009.  
  1010. /***********************************************************************/
  1011. /*                                       */
  1012. /*   Clear the Text Window                           */
  1013. /*                                       */
  1014. /***********************************************************************/
  1015.  
  1016. text_window()
  1017.      {
  1018.      clear_window(18,1,23,77);
  1019.      }
  1020.  
  1021. /***********************************************************************/
  1022. /*                                       */
  1023. /*   Get a function character                           */
  1024. /*                                       */
  1025. /***********************************************************************/
  1026.  
  1027. char getfch()
  1028.      {
  1029.      char i;
  1030.      i = getcnenb();
  1031.      if(i) return i;
  1032.      else  return -getcnenb();
  1033.      }
  1034.  
  1035. /***********************************************************************/
  1036. /*                                       */
  1037. /*   Put string Unbuffered.                           */
  1038. /*                                       */
  1039. /***********************************************************************/
  1040.  
  1041. putsnb(_str)
  1042.      char *_str;
  1043.      {
  1044.      while(*_str) putcnb(*_str++);
  1045.      }
  1046.  
  1047. /***********************************************************************/
  1048. /*                                       */
  1049. /*   DOS low-level Fucntions                           */
  1050. /*                                       */
  1051. /***********************************************************************/
  1052. /***********************************************************************/
  1053. /*                                       */
  1054. /*   Get char unbuffered with echo.                       */
  1055. /*                                       */
  1056. /***********************************************************************/
  1057.  
  1058. char getcnenb()
  1059.      {
  1060.      REGS.HREG.r_ah = 8;
  1061.      REGS.HREG.r_al = 0;
  1062.      REGS.HREG.r_bh = 0;
  1063.      REGS.HREG.r_bl = 0;
  1064.      REGS.HREG.r_ch = 0;
  1065.      REGS.HREG.r_cl = 0;
  1066.      REGS.HREG.r_dh = 0;
  1067.      REGS.HREG.r_dl = 0;
  1068.      intcall(®S,®S,0x21);
  1069.      return REGS.WREG.r_ax & 0xff;
  1070.      }
  1071.  
  1072. /***********************************************************************/
  1073. /*                                       */
  1074. /*   Has the keyboard been hit?                        */
  1075. /*                                       */
  1076. /***********************************************************************/
  1077.  
  1078. kbhit()
  1079.      {
  1080.      REGS.HREG.r_ah = 0x0b;
  1081.      intcall(®S,®S,0x21);
  1082.      return (REGS.HREG.r_al!=0);
  1083.      }
  1084.  
  1085. /***********************************************************************/
  1086. /*                                       */
  1087. /*   Set the cursor size.  Good for Monochrome and Color           */
  1088. /*                                       */
  1089. /***********************************************************************/
  1090.  
  1091. setcsize(tscan,bscan)
  1092.      int tscan,bscan;
  1093.      {
  1094.      REGS.HREG.r_ah = 0x1;
  1095.      REGS.HREG.r_al = 0;
  1096.      REGS.HREG.r_ch = tscan;
  1097.      REGS.HREG.r_cl = bscan;
  1098.      intcall(®S,®S,0x10);
  1099.      }
  1100.  
  1101. /***********************************************************************/
  1102. /*                                       */
  1103. /*   Clear the Screen.                               */
  1104. /*                                       */
  1105. /***********************************************************************/
  1106.  
  1107. cls()
  1108.      {
  1109.      clear_window(0,0,24,79);
  1110.      }
  1111.  
  1112. /***********************************************************************/
  1113. /*                                       */
  1114. /*   Fill a window.                               */
  1115. /*                                       */
  1116. /***********************************************************************/
  1117.  
  1118. fill_window(rch,rcl,rdh,rdl,attrib)
  1119.      int rch,rcl,rdh,rdl,attrib;
  1120.      {
  1121.      REGS.HREG.r_ah = 6;
  1122.      REGS.HREG.r_al = 0;
  1123.      REGS.HREG.r_bh = attrib;
  1124.      REGS.HREG.r_bl = 0;
  1125.      REGS.HREG.r_ch = rch;
  1126.      REGS.HREG.r_cl = rcl;
  1127.      REGS.HREG.r_dh = rdh;
  1128.      REGS.HREG.r_dl = rdl;
  1129.      intcall(®S,®S,0x10);
  1130.      }
  1131.  
  1132. /***********************************************************************/
  1133. /*                                       */
  1134. /*   Clear a window.                               */
  1135. /*                                       */
  1136. /***********************************************************************/
  1137.  
  1138. clear_window(rch,rcl,rdh,rdl)
  1139.      int rch,rcl,rdh,rdl;
  1140.      {
  1141.      REGS.HREG.r_ah = 6;
  1142.      REGS.HREG.r_al = 0;
  1143.      REGS.HREG.r_bh = 7;
  1144.      REGS.HREG.r_bl = 0;
  1145.      REGS.HREG.r_ch = rch;
  1146.      REGS.HREG.r_cl = rcl;
  1147.      REGS.HREG.r_dh = rdh;
  1148.      REGS.HREG.r_dl = rdl;
  1149.      intcall(®S,®S,0x10);
  1150.      }
  1151.  
  1152. /***********************************************************************/
  1153. /*                                       */
  1154. /*   Scroll Window UP                               */
  1155. /*                                       */
  1156. /***********************************************************************/
  1157.  
  1158. scroll_window_up(rch,rcl,rdh,rdl)
  1159.      int rch,rcl,rdh,rdl;
  1160.      {
  1161.      REGS.HREG.r_ah = 6;
  1162.      REGS.HREG.r_al = 1;
  1163.      REGS.HREG.r_bh = 7;
  1164.      REGS.HREG.r_bl = 0;
  1165.      REGS.HREG.r_ch = rch;
  1166.      REGS.HREG.r_cl = rcl;
  1167.      REGS.HREG.r_dh = rdh;
  1168.      REGS.HREG.r_dl = rdl;
  1169.      intcall(®S,®S,0x10);
  1170.      }
  1171.  
  1172. /***********************************************************************/
  1173. /*                                       */
  1174. /*   Scroll Window DOWN.                           */
  1175. /*                                       */
  1176. /***********************************************************************/
  1177.  
  1178. scroll_window_down(rch,rcl,rdh,rdl)
  1179.      int rch,rcl,rdh,rdl;
  1180.      {
  1181.      REGS.HREG.r_ah = 7;
  1182.      REGS.HREG.r_al = 1;
  1183.      REGS.HREG.r_bh = 7;
  1184.      REGS.HREG.r_bl = 0;
  1185.      REGS.HREG.r_ch = rch;
  1186.      REGS.HREG.r_cl = rcl;
  1187.      REGS.HREG.r_dh = rdh;
  1188.      REGS.HREG.r_dl = rdl;
  1189.      intcall(®S,®S,0x10);
  1190.      }
  1191.  
  1192. /***********************************************************************/
  1193. /*                                       */
  1194. /*   Position the Cursor.                           */
  1195. /*                                       */
  1196. /***********************************************************************/
  1197.  
  1198. locate(rr,cc)
  1199.      int rr,cc;
  1200.      {
  1201.      REGS.HREG.r_ah = 2;
  1202.      REGS.HREG.r_al = 0;
  1203.      REGS.HREG.r_bh = 0;
  1204.      REGS.HREG.r_bl = 0;
  1205.      REGS.HREG.r_ch = 0;
  1206.      REGS.HREG.r_cl = 0;
  1207.      REGS.HREG.r_dh = rr;
  1208.      REGS.HREG.r_dl = cc;
  1209.      intcall(®S,®S,0x10);
  1210.      }
  1211.  
  1212. /***********************************************************************/
  1213. /*                                       */
  1214. /*   Find the first occurance to match the given file name.           */
  1215. /*                                       */
  1216. /***********************************************************************/
  1217.  
  1218. dfind(find_struct,find_name,attrib)
  1219.      struct FILEINFO *find_struct;
  1220.      char *find_name;
  1221.      int attrib;
  1222.      {
  1223.      thisattrib = attrib;
  1224.      thisfile    = find_name;
  1225.  
  1226.      REGS.WREG.r_ax = SETDTA;           /* set disk transfer to structure */
  1227.      ptoreg(dsreg, REGS.WREG.r_dx, REGS.WREG.r_ds, find_struct);
  1228.      intcall(®S, ®S, DOSINT);
  1229.  
  1230.      REGS.WREG.r_ax = NFFIRST;           /* FINDFIRST function          */
  1231.      REGS.WREG.r_cx = thisattrib;       /* attributes set              */
  1232.      ptoreg(dsreg, REGS.WREG.r_dx, REGS.WREG.r_ds, thisfile);
  1233.      intcall(®S, ®S, DOSINT);     /* Find first                */
  1234.  
  1235.      if (REGS.WREG.r_flags & F_CF)
  1236.        return FALSE;       /* no matches found               */
  1237.      return TRUE;
  1238.      }
  1239.  
  1240. /***********************************************************************/
  1241. /*                                       */
  1242. /*   Find the next occurance to match the given file name           */
  1243. /*                                       */
  1244. /***********************************************************************/
  1245.  
  1246. dnext(find_struct)
  1247.      struct find *find_struct;
  1248.      {
  1249.      REGS.WREG.r_ax = SETDTA;
  1250.      ptoreg(dsreg, REGS.WREG.r_dx, REGS.WREG.r_ds, find_struct);
  1251.      intcall(®S, ®S, DOSINT);
  1252.  
  1253.      REGS.WREG.r_ax = NFNEXT;           /* FINDFIRST function          */
  1254.      REGS.WREG.r_cx = thisattrib;       /* attributes set              */
  1255.      ptoreg(dsreg, REGS.WREG.r_dx, REGS.WREG.r_ds, thisfile);
  1256.      intcall(®S, ®S, DOSINT);     /* Find first                */
  1257.  
  1258.      if (REGS.WREG.r_flags & F_CF)
  1259.        return FALSE;       /* no more matches found           */
  1260.      return TRUE;
  1261.      }
  1262.  
  1263. /***********************************************************************/
  1264. /*                                       */
  1265. /*   Get and dispaly the computer's time                               */
  1266. /*                                       */
  1267. /***********************************************************************/
  1268.  
  1269. new_time()
  1270.      {
  1271.      static char ampm[5] = "a.m.";
  1272.      REGS.HREG.r_ah = 0x2c;
  1273.      REGS.HREG.r_al = 0;
  1274.      intcall(®S, ®S, DOSINT);
  1275.      nhour    = REGS.HREG.r_ch;
  1276.      if(nhour > 12)
  1277.        {
  1278.        nhour -= 12;
  1279.        ampm[0] = 'p';
  1280.        }
  1281.      else  {
  1282.        if(nhour == 0)
  1283.          nhour = 12;
  1284.        ampm[0] = 'a';
  1285.        }
  1286.      nminute  = REGS.HREG.r_cl;
  1287.      nsecond  = REGS.HREG.r_dh;
  1288.      locate(1,60);
  1289.      sprintf(temp,"%02d:%02d:%02d %s",nhour,nminute,nsecond,ampm);
  1290.      putsnb(temp);
  1291.      }
  1292.  
  1293. /***********************************************************************/
  1294. /*                                       */
  1295. /*   Get and dispaly the computer's date                               */
  1296. /*                                       */
  1297. /***********************************************************************/
  1298.  
  1299. new_date()
  1300.      {
  1301.      REGS.HREG.r_ah = 0x2a;
  1302.      REGS.HREG.r_al = 0;
  1303.      intcall(®S, ®S, DOSINT);
  1304.      nmonth   = REGS.HREG.r_dh;
  1305.      nday     = REGS.HREG.r_dl;
  1306.      nyear    = REGS.WREG.r_cx - 1900;
  1307.      locate(1,5);
  1308.      sprintf(temp,"%02d/%02d/%02d",nmonth,nday   ,nyear  );
  1309.      putsnb(temp);
  1310.      }
  1311.  
  1312. /***********************************************************************/
  1313. /*                                       */
  1314. /*   Display the computer's date and time                              */
  1315. /*                                       */
  1316. /***********************************************************************/
  1317.  
  1318. time_display()
  1319.      {
  1320.      new_time();
  1321.      new_date();
  1322.      }
  1323.  
  1324. /***********************************************************************/
  1325. /*                                       */
  1326. /*   Get the Current Drive                           */
  1327. /*                                       */
  1328. /***********************************************************************/
  1329.  
  1330. current_drive()
  1331.      {
  1332.      REGS.HREG.r_ah = 0x19;
  1333.      REGS.HREG.r_al = 0;
  1334.      REGS.HREG.r_bh = 0;
  1335.      REGS.HREG.r_bl = 0;
  1336.      REGS.HREG.r_ch = 0;
  1337.      REGS.HREG.r_cl = 0;
  1338.      REGS.HREG.r_dh = 0;
  1339.      REGS.HREG.r_dl = 0;
  1340.      intcall(®S,®S,0x21);
  1341.      }
  1342.  
  1343. /***********************************************************************/
  1344. /*                                       */
  1345. /*   Get the Current Path                           */
  1346. /*                                       */
  1347. /***********************************************************************/
  1348.  
  1349. getpath()
  1350.      {
  1351.      ptoreg(dsreg, REGS.WREG.r_dx, REGS.WREG.r_ds,temp);
  1352.      REGS.HREG.r_ah = 0x47;
  1353.      REGS.HREG.r_al = 0;
  1354.      REGS.HREG.r_dh = 0;
  1355.      REGS.HREG.r_dl = 0;
  1356.      REGS.HREG.r_ch = 0;
  1357.      REGS.HREG.r_cl = 0;
  1358.      REGS.HREG.r_bh = 0;
  1359.      REGS.HREG.r_bl = 0;
  1360.      intcall(®S,®S,0x21);
  1361.      }
  1362.  
  1363. /***********************************************************************/
  1364. /*                                       */
  1365. /*   Make a new Subdirectory                           */
  1366. /*                                       */
  1367. /***********************************************************************/
  1368.  
  1369. mkdir(newdir)
  1370.      char *newdir;
  1371.      {
  1372.      ptoreg(dsreg, REGS.WREG.r_dx, REGS.WREG.r_ds,newdir);
  1373.      REGS.HREG.r_ah = 0x39;
  1374.      REGS.HREG.r_al = 0;
  1375.      intcall(®S,®S,0x21);
  1376.      }
  1377.  
  1378. /***********************************************************************/
  1379. /*                                       */
  1380. /*   Change Sub-directory                           */
  1381. /*                                       */
  1382. /***********************************************************************/
  1383.  
  1384. chdir(newdir)
  1385.      char *newdir;
  1386.      {
  1387.      ptoreg(dsreg, REGS.WREG.r_dx, REGS.WREG.r_ds,newdir);
  1388.      REGS.HREG.r_ah = 0x3b;
  1389.      REGS.HREG.r_al = 0;
  1390.      intcall(®S,®S,0x21);
  1391.      get_directory(last_dir_format);
  1392.      display_contents();
  1393.      }
  1394.  
  1395. /***********************************************************************/
  1396. /*                                       */
  1397. /*   Remove a SubDirectory                           */
  1398. /*                                       */
  1399. /***********************************************************************/
  1400.  
  1401. rmdir(newdir)
  1402.      char *newdir;
  1403.      {
  1404.      ptoreg(dsreg, REGS.WREG.r_dx, REGS.WREG.r_ds,newdir);
  1405.      REGS.HREG.r_ah = 0x3a;
  1406.      REGS.HREG.r_al = 0;
  1407.      intcall(®S,®S,0x21);
  1408.      }
  1409.  
  1410. /***********************************************************************/
  1411. /*                                       */
  1412. /*   Change Logged Drive                           */
  1413. /*                                       */
  1414. /***********************************************************************/
  1415.  
  1416. chdrive(newdrv)
  1417.      char *newdrv;
  1418.      {
  1419.      REGS.HREG.r_ah = 0x0e;
  1420.      REGS.HREG.r_al = 0;
  1421.      REGS.HREG.r_dl = toupper(*newdrv) - 'A';
  1422.      intcall(®S,®S,0x21);
  1423.      getpath();
  1424.      locate(19,15);
  1425.      putsnb("Current Path : ");
  1426.      putsnb((char*)REGS.WREG.r_si);
  1427.      infowindow();
  1428.      get_directory(last_dir_format);
  1429.      display_directory();
  1430.      }
  1431.  
  1432. /***********************************************************************/
  1433. /*                                       */
  1434. /*   Get Disk Space                               */
  1435. /*                                       */
  1436. /***********************************************************************/
  1437.  
  1438. disk_space()
  1439.      {
  1440.      REGS.HREG.r_ah = 0x36;
  1441.      REGS.HREG.r_al = 0;
  1442.      REGS.HREG.r_dl = 0;
  1443.      REGS.HREG.r_dh = 0;
  1444.      intcall(®S,®S,0x21);
  1445.      free_space  = REGS.WREG.r_cx;
  1446.      free_space *= REGS.WREG.r_ax;
  1447.      free_space *= REGS.WREG.r_bx;
  1448.      disk_size     = REGS.WREG.r_cx;
  1449.      disk_size    *= REGS.WREG.r_ax;
  1450.      disk_size    *= REGS.WREG.r_dx;
  1451.      disk_slack =(REGS.WREG.r_bx * 100) / REGS.WREG.r_dx;
  1452.      }
  1453.  
  1454.