function rbrange (args)

*************************************************************
*****                                                   *****
*****  Usage:  set_rbrange_cint name field1 field2 ...  *****
*****                                                   *****
*****  This function sets the RBRANGE and the CINT      *****
*****  based on an arbitrary number of input fields.    *****
*****  If NAME exists as a file, RBRANGE and CINT will  *****
*****  be read in, otherwise RBRANGE and CINT will be   *****
*****  computed.                                        *****
*****                                                   *****
*************************************************************

k = 1
while( k > 0 )
field.k = subwrd(args,k)
if( field.k = '' )
k = 1-k
else
k = k+1
endif
endwhile
k = -k

name = '' 
n = k
while( n > 1 )
name = name' 'field.n
n = n-1
endwhile

file = subwrd(args,1)
 min = sublin( read(file),2 )
 max = sublin( read(file),2 )
 cnt = sublin( read(file),2 )

if( min = '' )
'minmax 'name
max = subwrd(result,1)
min = subwrd(result,2)
cnt = (max-min)/15
write(file,min)
write(file,max)
write(file,cnt)
endif

say 'setting rbrange with 'min' 'max
say 'setting cint    with 'cnt
 'set rbrange 'min' 'max
 'set cint 'cnt
*'set cmax 'max
*'set cmin 'min
return min' 'max' 'cnt

return
