;+
;
; NAME: 
;       USER_CHOOSE
;
; PURPOSE:
;
;
; CATEGORY:
;       BATSE
;
; CALLING SEQUENCE:
;
;
; CALLS:
;	none
;
; INPUTS:
;       none explicit, only through commons;
;
; OPTIONAL INPUTS:
;	none
;
; OUTPUTS:
;       none explicit, only through commons;
;
; OPTIONAL OUTPUTS:
;	none
;
; KEYWORDS:
;	none
; COMMON BLOCKS:
;	none
;
; SIDE EFFECTS:
;	none
;
; RESTRICTIONS:
;	none
;
; PROCEDURE:
;	none
;
; MODIFICATION HISTORY:
;
;-
pro user_choose, message, prompt, choices, selection

selection = -1

print, message

n = n_elements (choices)
for i = 0,n-1 do print, i, '.    ', choices(i)

; Prompt operator for choice.
;
read_num:
num = ''
print, prompt
read, 'Selection? ', num

if num eq '' then goto, getout

on_ioerror, read_num
num = fix(num)
if (num lt 0) or (num gt n-1) then begin
   print, 'Invalid choice, please reenter'
   goto,read_num
endif
;
selection = num

getout:
return&end
