+int opt_quiet;
+int opt_verbose;
+static int opt_no_sessiond;
+static char *opt_sessiond_path;
+
+enum {
+ OPT_SESSION_PATH,
+ OPT_DUMP_OPTIONS,
+ OPT_DUMP_COMMANDS,
+};
+
+/* Getopt options. No first level command. */
+static struct option long_options[] = {
+ {"help", 0, NULL, 'h'},
+ {"group", 1, NULL, 'g'},
+ {"verbose", 0, NULL, 'v'},
+ {"quiet", 0, NULL, 'q'},
+ {"no-sessiond", 0, NULL, 'n'},
+ {"sessiond-path", 1, NULL, OPT_SESSION_PATH},
+ {"list-options", 0, NULL, OPT_DUMP_OPTIONS},
+ {"list-commands", 0, NULL, OPT_DUMP_COMMANDS},
+ {NULL, 0, NULL, 0}
+};
+
+/* First level command */
+static struct cmd_struct commands[] = {
+ { "list", cmd_list},
+ { "create", cmd_create},
+ { "destroy", cmd_destroy},
+ { "start", cmd_start},
+ { "stop", cmd_stop},
+ { "enable-event", cmd_enable_events},
+ { "disable-event", cmd_disable_events},
+ { "enable-channel", cmd_enable_channels},
+ { "disable-channel", cmd_disable_channels},
+ { "add-context", cmd_add_context},
+ { "set-session", cmd_set_session},
+ { "version", cmd_version},
+ { NULL, NULL} /* Array closure */
+};
+
+static void usage(FILE *ofp)