##- # Author: Brian Tiffin # Licensed under the GNU LGPL, version 3 or greater # # Date: # Modified: ##+ # # program.icn, description # # tectonics: # $define VERSION 0.1 link options procedure main(argv) opts := options(argv, "-h! -v! -source!", optError) if \opts["h"] then return showHelp() if \opts["v"] then return showVersion() if \opts["source"] then return showSource() end # # show help, version and source info # procedure showVersion() write(&errout, &progname, " ", VERSION, " ", __DATE__) end procedure showHelp() showVersion() write(&errout, "Usage:") write(&errout, "\t-h\tshow this help") write(&errout, "\t-v\tshow version") write(&errout, "\t-source\tlist source code") end procedure showSource() local f f := open(&file, "r") | stop("Source file ", &file, " unavailable") every write(!f) close(f) end # # options error # procedure optError(s) write(&errout, s) stop("Try ", &progname, " -h for more information") end