Hi, I've overhauled the parse interface in main.c in the interests of abstraction and clarity. Enclosed is the patch. If you don't like it, please say something, as I'm going to tag an internal version then commit this otherwise. -----High-level: I'm transforming the mandoc parse sequence (now entirely in main.c, which called to the libroff, libmdoc, and libman interfaces) into a much simple, single-header library interface. The libmdoc, libman, and libroff public interfaces are being thrown out in favour of this new one (libmandoc), which consists of all parse complexity, along with other mandoc functions (malloc/free), into one location. This does NOT change existing functionality. It's basically a huge clean-up that's been waiting to happen for quite some time. First, will allow other, non-core output modes (like, say, the indexer I'd posted) to be easily created without having to reimplement the complicated dance of parsers and pre-parse line formats. Second, this will allow consolidation of headers, functions, and so on, which will cut code size and complexity. This is already happening now, but by having everything centrallised, we can be much more aggressive in doing so. -----This patch: All of the parse functionality has been put into read.c, with its interface described in mandoc.h. Some areas have been cleaned up (like removing pfile() and so on), but for the most part, this is a direct transcription. main.c is now much cleaner, and does what it's supposed to do: read in arguments, figure them out, invoke the parser, then invoke the front-ends. There are still some obvious areas of improvement (such as the mandoc_setstatus() function), but these are easy to clean up, and I wanted to start with the simplest patch. Thoughts? Kristaps