;+
; NAME:
;	DEFINE_SITE_PATH
; PURPOSE:
;	Routine that writes the routine SITE_PATH.PRO which when 
;	executed defines !path for a site.
;	This procedure should be executed using DEFINE_IDL_PATH.COM
;	which temporarily defines IDL_PATH.
;
;	Designed for VMS machines to speed IDL startup
; CALLING SEQUENCE:  
;	Can only be run on entry by the command
;		IDL DEFINE_SITE_PATH
; INPUTS:
;	uses the string help in !path which is derived from IDL_PATH
;	if this logical is set.
; OUTPUTS:
;	writes file SITE_PATH.PRO to current directory
; OPTIONAL OUTPUTS:
;
; RESTRICTIONS:
;	Currently only splits VMS !path
;
;	Note:
;	  1) Define the YOHKOH symbols and logicals by executing
;	  YOHKOH_SETUP.COM prior to execution of DEFINE_IDL_PATH.COM.
;	  2) Make sure to redefine the YOHKOH symbols and logicals
;	  again after the .COM file has been used as they are left in 
;	  non standard state!
; PROCEDURE:
;
; MODIFICATION HISTORY:
; 	RDB, Thu Jan 23 14:49:43 1992
;
;-
 
qq = !path
bb = byte(qq)
comma = byte(44)	;','
ixcomma= where(bb eq comma)
ncomma = n_elements(ixcomma)

openw,1,'site_path.pro'
printf,1,'pro	site_path,dummy
printf,1,' '
printf,1,';+
printf,1,';
printf,1,';	Routine SITE_PATH defines the path for the given site.
printf,1,';	It is defined automatically using DEFINE_SITE_PATH.PRO.
printf,1,';	On VMS machines, create this by executing DEFINE_SITE_PATH.COM.
printf,1,';	This path defined on:  ',!stime
printf,1,';
printf,1,';-
printf,1,' '

printf,1,"newpath = '" + strmid(qq,0,ixcomma(0)+1) + "'  $"
for j=0,ncomma-2 do $
  printf,1,"	+ '" + strmid(qq,ixcomma(j)+1,ixcomma(j+1)-ixcomma(j)) + "'   $
printf,1,"	+ '" + strmid(qq,ixcomma(ncomma-1)+1,strlen(qq)-ixcomma(ncomma-1)-1) + "'"

printf,1,' '
printf,1,'!path = newpath'
printf,1,' '
printf,1,"end"
close,1

;end
