; RFH Installer v22
(set sourcedir
    (askdir
        (prompt "OK, where are the RFH files??")
        (help @askdir-help)
        (default "MAIL:rexx/")
    )
)

(set @default-dest
    (askdir
        (prompt "OK, where will I install RFH??")
        (help @askdir-help)
        (default "MAIL:rexx/")
    )
)


( set bbs 
 (askchoice
    (prompt "Select Generic or BBS version to Install.")
    (help "Select file description method")
    (choices "GENERIC - uses FileNotes" "DLG - uses FD files" "TransAmiga - uses DESC files" "Excelsior - uses database ")
    (default 0)
 )
)
(if (= bbs 0)
    (set bbsfile "!GEN.rfh")
    (if (= bbs 1)
        (set bbsfile "!DLG.rfh")
        (if (= bbs 2)
            (set bbsfile "!TRN.rfh")
            (if (= bbs 3)            
                (set bbsfile "!EXL.rfh")
            )
        )
    )
)

(set bbsfile (tackon sourcedir bbsfile))
(set root    (tackon sourcedir "RFH.SRC"))
(set destfile (tackon @default-dest "RFH.REXX"))
(textfile
    (prompt "Create " bbsfile " version of RFH.rexx in " @default-dest)
    (help "NO HELP'!")
    (dest destfile)
    (append "/**/\n")
    (append "v=\"$VER: RFH Rexx WPL Mailer File Request Function Host Williamson 56.29\"\n")
    (append "compiled=0  /* Set to 1 before compiling! */\n")
    (append "if ~show('L', \"rexxdossupport.library\") then\n")
    (append "if ~addlib(\"rexxdossupport.library\", 0, -30, 2) then do\n")
    (append "Say 'Could not access WB2 rexxdossupport.library'\n")
    (append "exit 20\n")
    (append "end\n")
    (include root)
    (include bbsfile)
)

(exit)
