home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / WHEREBK.ZIP / WH.CMD
OS/2 REXX Batch file  |  1993-03-15  |  3KB  |  132 lines

  1. /*WHERE.CMD (c) C.BLACK, B.STONE, KUTEK  1992,1993*/
  2. /* from ***BLKOS2***   */
  3. /*all rights reserved*/
  4. /*Final standalone version*/
  5. /* may not be bundled or sold,use at your own risk*/
  6. /* This copyright notice may not be removed*/
  7. /*if you upload this elsewhere*/
  8. /*KUTEK PO BOX 261 Forked River, NJ 08731*/
  9. /*USAGE: wh <path/filename> <opt start drive><opt drv type><]> <]]>*/
  10. /*type where.cmd ? at the prompt for help*/
  11. /* this pgm is  free for individual users.It is an introduction to the */
  12. /*functionality of the upcoming BLKOS2 and the BACKSTONE SHELL*/
  13. /* there are no name dependencies in this pgm -call it anything you like.*/
  14. /*requires either rexx20 update, the service pak or OS2 2.1*/
  15. /*THIS PGM WILL LOAD THE REXXUTIL FUNCS IF NOT LOADED*/
  16. /* BUT IT DOES NOT UNLOAD THEM*/
  17. '@echo off'
  18. ttestt= rxfuncquery(sysloadfuncs)
  19. if ttestt=1 then do
  20. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  21. call sysloadfuncs
  22. end
  23. ansi1=x2c(1B)'[1;31m'
  24. ansi2=x2c(1B)'[1;32m'
  25. ansi3=x2c(1B)'[1;33m'
  26. ansi66=x2c(1B)'[1;36m'
  27. ansi0=x2c(1B)'[0;m'
  28. ind=0;aa=0;diu=0;flok='b'
  29. arg nn pp                           
  30. if nn='?' then call info
  31. if wordpos(']',pp)\=0 then diu =1
  32. if wordpos(']]',pp)\=0 then flok='d'
  33. parse var pp hh ll mm oo
  34. bb='*USED*LOCAL*REMOTE*'
  35. if ll='' then ll='USED'
  36. if hh=''|hh=']'|hh=']]' then hh='C:'
  37. if pos(hh,bb)\=0 then do;ll=hh;hh='C:';end
  38. if ll=']'|ll=']]' then ll=''
  39. if mm=']'|mm=']]' then mm=''
  40. parse value systextscreensize() with kl km
  41. call syscls
  42. dd=syscurpos(5,0)
  43. if pos(':',nn)\=0 then call sing
  44. dri=sysdrivemap(hh,ll)
  45. if dri='' then do
  46. say ansi1 'NO' ll 'DRIVE(S) AVAILABLE' ansi0;exit;end
  47. else say ansi2 'SEARCHING DRIVES' ansi3  dri ansi2 'FOR' ansi66 nn ansi0
  48. ne=0
  49. do until dri=''
  50. ne=ne+1
  51. parse var dri djd.ne dri
  52. end
  53. do i= 1 to ne
  54. onetime:
  55. ready=sysdriveinfo(djd.i)
  56. if ready='' then do
  57. say ansi1||'DRIVE' djd.i 'NOT ACCESSIBLE'||ansi0
  58. if ind=1 then exit
  59. else iterate
  60. end
  61. else
  62. dr=sysfiletree(djd.i'\'nn,vt,(flok)s)
  63. if vt.0\=0 then do f=1 to vt.0
  64. aa=aa+1
  65. kill.aa=vt.f
  66. end 
  67. if ind=1 then call list
  68. end
  69. if aa=0 then do
  70. no:
  71. say ansi1 'OBJECT' ansi66 nn ansi1 'NOT FOUND' ansi0
  72. exit
  73. end
  74. else do
  75. list:
  76. if diu\=1 then say ansi2 aa 'OBJECT(S) FOUND' ansi0
  77. nbn=0
  78. if aa\=0 then do j=1 to aa
  79. nbn=nbn+1
  80. if diu=1 then do
  81. parse var kill.j d1 d2 d3 d4 d5
  82. say d5
  83. end
  84. else  say ansi66 kill.j ansi0
  85. if nbn=kl-6&diu\=1 then do
  86.    pause
  87. nbn=0
  88. end  
  89. end
  90. if aa=0 then call no
  91. exit
  92.  
  93. sing:
  94. ind=1
  95. parse var nn dj +2 nn
  96. i=1
  97. djd.1=(dj)
  98.  say ansi2 'SEARCHING DRIVE' ansi3 dj ansi2  'FOR' ansi66 nn ansi0
  99. call onetime
  100.  
  101. info:
  102. call syscls
  103. poss =syscurpos(5,0)
  104. say   ansi66||'USAGE: WHERE <drv:filename> <opt start drive> <opt drv type> <]> <]]>'
  105. say
  106. say 'Example:  where c:cmd.exe a: LOCAL ]   (note:no backslashes used)'
  107. SAY
  108. say ansi3||'OMITTING drv SPEC SEARCHES ALL DRIVES STARTING AT C:'
  109. say
  110. say  '<DRIVE TYPE> CAN BE ONE OF FOLLOWING:'
  111. say  'USED,LOCAL,REMOTE'
  112. say
  113. say 'START DRIVE PARAMETER MUST HAVE COLON eg. F:'
  114. say
  115. say '<]> PARAMETER DENOTES NON STOP LIST OF PATH/NAME RESULTS ONLY'
  116. say
  117. say '<]]> PARAMETER DENOTES DIR ONLY LISTING'
  118. say
  119. say 'CASE IS IRRELEVANT,WILDCARDS ARE ALLOWED IN FILE SPEC'
  120. say
  121. say 'TYPING SOMETHING LIKE <name>* AUTOMATICALLY COMPLETES  <name>'
  122. say
  123. say  ansi2||'TYPE INPUT SPECS NOW OR HIT ENTER TO EXIT'||ansi0
  124. pull nn pp
  125. if nn='' then exit
  126. return  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.