module "/pliant/language/unsafe.pli" function readline prompt -> line arg CStr prompt line external "libreadline.so" "readline" function add_history line arg CStr line external "libreadline.so" "add_history" # this doesn't seem to be necessary function rl_init external "libreadline.so" "rl_initialize" function rl_get prompt -> line arg Str prompt line var CStr ret ret := readline:prompt if ret:characters = null line := "[0]" else line := ret if not line = "" and not line = "[0]" add_history:line export rl_init rl_get