import cmd line parsing from cruftybehemoth

* finally that project become useful!
* also, had to adapt it to C as that was C++