home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / DOS_HELP / ADDPAT.ZIP / ADDPATH.BC next >
Encoding:
Text File  |  1990-04-30  |  6.9 KB  |  289 lines

  1. bios
  2. @echo off
  3.         if %1. = . goto usage
  4.         if %1 = ? goto usage
  5.         if %1 = - goto getoldpath
  6. let %!l = %1
  7. let %!m = %2
  8. let %!n = %3
  9. let %!o = %4
  10. let %!p = %5
  11. let %!q = %6
  12. let %!r = %7
  13. let %!s = %8
  14. let %!t = %9
  15.         gosub checkifdisk
  16.         gosub checkforslash
  17.         gosub checkforpath
  18.         gosub checkforroot
  19.         gosub checkfordir
  20.         gosub modify
  21.         gosub displayit
  22.         exit
  23.  
  24. :checkifdisk
  25.         let %!a = %1
  26.         substring %!a 2 1
  27.         if not %!a = : return
  28.         let %!z = %1
  29.         let %!b = disk
  30.         return
  31.  
  32. :checkforslash
  33.         if %!b = disk return
  34.         let %!a = %1
  35.         let %!z = %1
  36.         substring %!a 1 1
  37.         if %!a = \ return
  38.         let %!z = \%1
  39.         return
  40.  
  41. :checkforpath
  42.         let %!a = %path%
  43. :repeat
  44.         parse %!a %!c ;
  45.         if %!a. = . goto eopath
  46. if %!z = %!a goto match1
  47. if %!m = %!a goto match2
  48. if %!n = %!a goto match3
  49. if %!o = %!a goto match4
  50. if %!p = %!a goto match5
  51. if %!q = %!a goto match6
  52. if %!r = %!a goto match7
  53. if %!s = %!a goto match8
  54. if %!t = %!a goto match9
  55.         let %!a = %!c
  56.         goto repeat
  57. :eopath
  58.         return
  59. :match1
  60.         echo Request (%!z) already exists in current path.
  61.         let %!z =
  62.         goto match!
  63. :match2
  64.         echo Request (%2) already exists in current path.
  65.         let %!m =
  66.         goto match!
  67. :match3
  68.         echo Request (%3) already exists in current path.
  69.         let %!n =
  70.         goto match!
  71. :match4
  72.         echo Request (%4) already exists in current path.
  73.         let %!o =
  74.         goto match!
  75. :match5
  76.         echo Request (%5) already exists in current path.
  77.         let %!p =
  78.         goto match!
  79. :match6
  80.         echo Request (%6) already exists in current path.
  81.         let %!q =
  82.         goto match!
  83. :match7
  84.         echo Request (%7) already exists in current path.
  85.         let %!r =
  86.         goto match!
  87. :match8
  88.         echo Request (%8) already exists in current path.
  89.         let %!s =
  90.         goto match!
  91. :match9
  92.         echo Request (%9) already exists in current path.
  93.         let %!t =
  94. :match!
  95.  
  96.     echo Duplication found - Duplicate Removed!
  97.         beep
  98.         goto checkforpath
  99.         exit
  100.  
  101. :checkforroot
  102.         let %!a = %path%
  103.         getdrive %!d
  104.         if %!z = %d\ return
  105.         if %!z = \ return
  106.         if %2 = %d\ return
  107.         if %2 = \ return
  108.         if %3 = %d\ return
  109.         if %3 = \ return
  110.         if %4 = %d\ return
  111.         if %4 = \ return
  112.         if %5 = %d\ return
  113.         if %5 = \ return
  114.         if %6 = %d\ return
  115.         if %6 = \ return
  116.         if %7 = %d\ return
  117.         if %7 = \ return
  118.         if %8 = %d\ return
  119.         if %8 = \ return
  120.         if %9 = %d\ return
  121.         if %9 = \ return
  122. :more
  123.         parse %!a %!c ;
  124.         if %!a. = . goto eo2path
  125.         if %!a = %!d\ return
  126.         if %!a = \ return
  127.         let %!a = %!c
  128.         goto more
  129. :eo2path
  130.         let %!x = Warning: No path to root directory of current drive! (%!d)
  131.         return
  132.  
  133. :checkfordir
  134.          let %!k = %!z
  135.          let %!c = %2
  136.          let %!d = %3
  137.          let %!e = %4
  138.          let %!f = %5
  139.          let %!g = %6
  140.          let %!h = %7
  141.          let %!i = %8
  142.          let %!j = %9
  143.  
  144.          substring %!k 2 1
  145.          if %!k = : goto skipit
  146.          if not exist %!z\*.* goto dir1notfound
  147. :skipit
  148.          substring %!c 2 1
  149.          if %!c = : goto skipaa
  150.          if not exist %2\*.* goto dir2notfound
  151. :skipaa
  152.          substring %!d 2 1
  153.          if %!d = : goto skipbb
  154.          if not exist %3\*.* goto dir3notfound
  155. :skipbb
  156.          substring %!e 2 1
  157.          if %!e = : goto skipcc
  158.          if not exist %4\*.* goto dir4notfound
  159. :skipcc
  160.          substring %!f 2 1
  161.          if %!f = : goto skipdd
  162.          if not exist %5\*.* goto dir5notfound
  163. :skipdd
  164.          substring %!g 2 1
  165.          if %!g = : goto skipee
  166.          if not exist %6\*.* goto dir6notfound
  167. :skipee
  168.          substring %!h 2 1
  169.          if %!h = : goto skipff
  170.          if not exist %7\*.* goto dir7notfound
  171. :skipff
  172.          substring %!i 2 1
  173.          if %!i = : goto skipgg
  174.          if not exist %8\*.* goto dir8notfound
  175. :skipgg
  176.          substring %!j 2 1
  177.          if %!j = : goto skiphh
  178.          if not exist %9\*.* goto dir9notfound
  179. :skiphh
  180.          if not %!u = x return
  181.          goto emptydir
  182.  
  183. :dir1notfound
  184.         echo Directory of (%!z) not found -or- empty!
  185.         let %!u = x
  186.         goto skipit
  187. :dir2notfound
  188.         echo Directory of (%2) not found -or- empty!
  189.         let %!u = x
  190.         goto skipaa
  191. :dir3notfound
  192.         echo Directory of (%3) not found -or- empty!
  193.         let %!u = x
  194.         goto skipbb
  195. :dir4notfound
  196.         echo Directory of (%4) not found -or- empty!
  197.         let %!u = x
  198.         goto skipcc
  199. :dir5notfound
  200.         echo Directory of (%5) not found -or- empty!
  201.         let %!u = x
  202.         goto skipdd
  203. :dir6notfound
  204.         echo Directory of (%6) not found -or- empty!
  205.         let %!u = x
  206.         goto skipee
  207. :dir7notfound
  208.         echo Directory of (%7) not found -or- empty!
  209.         let %!u = x
  210.         goto skipff
  211. :dir8notfound
  212.         echo Directory of (%8) not found -or- empty!
  213.         let %!u = x
  214.         goto skipgg
  215. :dir9notfound
  216.         echo Directory of (%9) not found -or- empty!
  217.         let %!u = x
  218. :emptydir
  219.         echo Current path is:
  220.         echo %path%
  221.         beep
  222.         echo   
  223.         let %!c =
  224.         let %!d =
  225.         let %!e =
  226.         let %!f =
  227.         let %!g =
  228.         let %!h =
  229.         let %!i =
  230.         let %!j =
  231. if not %2. = . let %!c = ;%2
  232. if not %3. = . let %!d = ;%3
  233. if not %4. = . let %!e = ;%4
  234. if not %5. = . let %!f = ;%5
  235. if not %6. = . let %!g = ;%6
  236. if not %7. = . let %!h = ;%7
  237. if not %8. = . let %!i = ;%8
  238. if not %9. = . let %!j = ;%9
  239.         echonolf Do you wish to add (%!z%!c%!d%!e%!f%!g%!i%!j) to your path anyway? (Y/N):
  240.         getkey
  241.         echo   
  242.         if errlevel 89 return
  243.         if errlevel 121 return
  244.         exit
  245.  
  246. :modify
  247.         set oldpath = %path%
  248.  
  249. if not %!m. = . let %!m = ;%!m
  250. if not %!n. = . let %!n = ;%!n
  251. if not %!o. = . let %!o = ;%!o
  252. if not %!p. = . let %!p = ;%!p
  253. if not %!q. = . let %!q = ;%!q
  254. if not %!r. = . let %!r = ;%!r
  255. if not %!s. = . let %!s = ;%!s
  256. if not %!t. = . let %!t = ;%!t
  257.  
  258.         set path = %path%;%!z%!m%!n%!o%!p%!q%!r%!s%!t
  259.         return
  260.  
  261. :displayit
  262.         echo PATH appended to:
  263.         echo PATH = %path%
  264.         if not %!x. = . echo %!x
  265.         return
  266.  
  267. :usage
  268.         echo Usage: ADDPATH [additional path(s)]
  269.         echo        ADDPATH -   to return to previous path
  270.         echo Current Path is:
  271.         echo %path%
  272.         exit
  273.  
  274. :getoldpath
  275.         if %oldpath%. = . goto nooldpath
  276.         set path = %oldpath%
  277.         set oldpath =
  278.         echo Path has been returned to:
  279.         echo %path%
  280.         exit
  281.  
  282. :nooldpath
  283.         echo No Previous PATH located!
  284.         echo Current Path is:
  285.         echo %path%
  286.         beep
  287.         exit
  288.  
  289.