pro help_prefix, descr, long=long, full=full, hc=hc, outfil=outfil, force_rd=force_rd, $
	file_type=file_type, proc_info=proc_info, help=help
;
;+
;NAME:
;	help_prefix
;PURPOSE:
;	To display information on the different YOHKOH prefixes available
;SAMPLE CALLING SEQUENCE:
;	help_prefix
;	help_prefix, 's*'
;	help_prefix, 'obs', /full
;	help_prefix, proc_info='ref_daily'
;	help_prefix, file_type='sda'
;	help_prefix, /help
;OPTIONAL INPUT:
;	descr	- A string or wildcard for which prefixes to list
;OPTIONAL KEYWORD INPUT:
;	long	- If set, print out the full long description.
;	full	- If set, print out the full long description plus the
;		  line describing the processing and tape information
;	hc	- If set, write to an output file and print it out
;	outfil	- If defined, write the output to that file
;	force_rd- If set, force a new read of the file that contains
;		  the descriptions of the prefixes.
;	file_type- If set, then search for "descr" occurrence in the file_type
;		  string
;	proc_info- If set, then search for "descr" occurrence in the processed
;		   info string
;	help	- If set, then just print the help information.
;HISTORY:
;	Written 6-Apr-93 by M.Morrison
;-
;
common help_prefix, list, header
;
default_outfil = concat_dir(getenv('HOME'), 'help_prefix.printout')
if ((n_elements(list) eq 0) or (keyword_set(force_rd))) then list = rd_prefix_doc(header=header)
if (n_elements(descr) eq 0) then descr = '*'
if (keyword_set(hc) and (not keyword_set(outfil))) then outfil = default_outfil
;
if (keyword_set(help)) then begin
    prstr, header, file=outfil, hc=hc
    return
end
;
ss = wc_where(list.prefix, descr, /case_ignore)
if (keyword_set(file_type)) then ss = wc_where(list.file_type, '*'+descr+'*', /case_ignore)
if (keyword_set(proc_info)) then ss = wc_where(list.proc_info, '*'+descr+'*', /case_ignore)
;
if (ss(0) eq -1) then begin
    print, 'No matches in prefixes for: ', descr
    return
end
;
lun = -1
if (n_elements(outfil) ne 0) then begin
    openw, lun, outfil, /get_lun
    printf, lun, 'HELP_PREFIX.PRO  Ver 1.0
    printf, lun, 'Program run: ', !stime
end
;
last_prefix = '???'
for i=0,n_elements(ss)-1 do begin
    list0 = list(ss(i))
    qblank = 0
    if (keyword_set(full) or keyword_set(long)) then qblank = 1		;have a blank between entries
    if (strmid(last_prefix, 0, 1) ne strmid(list0.prefix, 0, 1)) then qblank = 1
    if (qblank) then begin
	print, ' '
	if (lun ne -1) then printf, lun, ' '
    end
    if (list0.prefix eq '...') then goto, skip		;sorry - afterthought - want to force a blank line...
    ;
    fmt = '(a3, 3x, a56, a18)'
    str = string(list0.prefix, list0.descr, list0.file_type+'                        ', format=fmt)
    print, str
    if (lun ne -1) then printf, lun, str
    ;
    if (keyword_set(full) or keyword_set(long)) then begin
	fmt = '(8x, a)'
	temp = list0.full_descr
	for j=0, n_elements(temp)-1 do if (strtrim(temp(j),2) ne '') then begin
	    str = string(temp(j), format=fmt)
	    print, str
	    if (lun ne -1) then printf, lun, str
	end
    end
    if (keyword_set(full)) then begin
	if (strtrim(list0.proc_info,2) ne '') then begin
	    fmt = '(8x, a)'
	    str = string(list0.proc_info, format=fmt)
	    print, str
	    if (lun ne -1) then printf, lun, str
	end
    end
    ; 
    last_prefix = list0.prefix
    skip:
end
;
if (lun ne -1) then begin
    free_lun, lun
    if (keyword_set(hc)) then dprint, outfil
    if (outfil eq default_outfil) then file_delete, outfil
end
end
