Allow writing to stdout, refractor openscad.cc on the way

These patches refractor openscad.cc. They include pull requests #657, #658 and #659. On top of them they
- allow writing output to standart ouput
- allow to specify either an --action or and -o[utput] to run command line mode
- write to temporary files commit them after all operations succeeded; this prevents garbled output files and is required for proper use in Makefiles
- remove a lot of redundant code