;+
; NAME:
;	UPDATE_YOHLIB
; PURPOSE:
;	Updates the YLIB directories using control file created by 
;	the UPDATE_FROM_PATH routine
; CALLING SEQUENCE:  
;	.run UPDATE_YOHLIB
; INPUTS:
;	file YOHLIB_UPDATE_COM.DAT
; OUTPUTS:
;
; OPTIONAL OUTPUTS:
;
; RESTRICTIONS:
;	fiel must be on current directory
; PROCEDURE:
;
; MODIFICATION HISTORY:
;	RDB	16-June-92
;-

yesnox,'* Issue Copy commands: ',ansc

openr,ylib,'YOHLIB_UPDATE_COM.DAT',/get_lun

infil=''
dirs = ['BCS','GEN','HXT','SXT','WBS']
subdirs = ['ATEST','REL','CONTRIB','YUKON']

print,' '
if not ansc then print,'*** Copy Inhibited ***'

while not eof(ylib) do begin
   readf,ylib,infil
   infil = strupcase(infil)

   for j = 0,4 do begin
      n = strpos(infil,dirs(j))
      if n ge 0 then kdir = j
   endfor

   for j = 0,3 do begin
      n = strpos(infil,subdirs(j))
      if n ge 0 then ksubdir = j
   endfor
   if ksubdir eq 2 then ksubdir = 3

;		form destination string
dest = 'YLIB:[' + dirs(kdir) + '_' + subdirs(ksubdir) + ']'

;		create format string and form input string
fflen = max([60,strlen(strtrim(infil,0))])
fmt = '(a,t' + string(fflen,format='(i2)') +',a)'
infil = string(infil,' ',format=fmt)

;		issue the command
cpx = '$ copy ' + infil + '   ' + dest
print,'>>> ',cpx
if ansc then spawn,cpx

endwhile

if not ansc then print,'*** Copy Inhibited ***'
print,' '

end
