home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR10 / TLXTW110.ZIP / GAMEDIR.SLT < prev    next >
Text File  |  1993-08-22  |  2KB  |  47 lines

  1. // Changes to the game's directory and runs the following command
  2. // Uncomment which program you want to run and comment out the others.
  3. // then compile.  Ex: CS.exe gamedir
  4.  
  5. str command[] = "List";                                                      //
  6.  
  7.  
  8. // If your using a batch file as the command above,
  9. // comment out the run(command)
  10. // and uncomment the dos() command.  See below.
  11. ///////////////////////////////////////////////////////////////////////////////
  12. int     i, old_chk_key;
  13. str     bbsname[8], f1[64];
  14.  
  15. main()
  16. {
  17. update_term();
  18. old_chk_key=_scr_chk_key; _scr_chk_key=0;
  19. if (getenv("f1", f1)  < 1) { status_wind("F1 environment variable not found",25); _scr_chk_key=old_chk_key; return(-1); }
  20. i = strlen(f1); if (subchr(f1, i - 1) != '\') copystr("\", f1, i, 1);
  21. if (_entry_name == "") if (call("bbsname") == -1) { _scr_chk_key=old_chk_key; return(-1); }
  22. bbsname = _entry_name; fill_spaces();
  23. strcat(f1, bbsname); strcat(f1, "\");         // f1 = .dat file
  24. newdir(f1);
  25. _scr_chk_key=old_chk_key;
  26.  
  27.  
  28. run(command,0);
  29. // dos(command,0);
  30.  
  31. // ^ Here run is faster, but cannot handle batch files, etc. see salt.doc
  32.  
  33. newdir(_telix_dir);
  34. _scr_chk_key=old_chk_key; return;
  35. }
  36. //////////////////////////////////////////////////////////////////////////////
  37. fill_spaces()           // Filters out characters illegal in DOS filenames.
  38. {
  39. int i, count = 0; str chr[1];
  40. while (count < 6)
  41. {    if (count == 0) chr = ".";else if (count == 1) chr = "+";else if (count == 2) chr = " ";
  42. else if (count == 3) chr = "?";else if (count == 4) chr = "*";else if (count == 5) chr = "/";
  43. i=0; while (1)
  44.  {  i = strpos(bbsname, chr, i);
  45.     if (i == -1) break; setchr(bbsname, i ,'_'); i=i+1; }++count; } return; }
  46. ///////////////////////////////////////////////////////////////////////////////
  47.