#include #include #include #include "gui.h" #include "xmpp.h" // configuration struct for all command line options typedef struct options { bool unknown; bool help; } Options; // parses all command line arguments. static void get_opts(Options* opts, int argc, char* argv[]) { // initialize Options struct opts->unknown = false; opts->help = false; // parse all arguments to Options struct int c; while ((c=getopt(argc, argv, "h")) != -1) { switch (c) { case 'h': opts->help = true; break; default: opts->unknown = true; } } } // prints out the help page. static void print_help(void) { printf( "The Linux on mobile XMPP (LimoX) client.\n" "\n" "Usage: limox [-h]\n" "\n" "Options:\n" " -h print help page\n" ); } int main(int argc, char* argv[]) { // parse command line options Options opts; get_opts(&opts, argc, argv); // handle correct use case if (opts.unknown || opts.help) { print_help(); } else { xmpp_connect(); gui_run(); } }