mac client: moved command-line parsing and context alloc from library to app