Major changes of command processing for sessiond
[lttng-tools.git] / lttng / options.c
index b4630c3d79d3b01c0d90ff420682e2079f6f6a54..de2681054c93d2dbbfd95088a860fd3909e7dda7 100644 (file)
 /* Option variables */
 char *opt_tracing_group;
 char *opt_session_uuid;
-char *opt_create_session;
 char *opt_sessiond_path;
-char *opt_destroy_session;
+char *opt_session_name;
+int opt_create_session;
+int opt_destroy_session;
 int opt_trace_kernel = 0;
 int opt_quiet = 0;
 int opt_verbose = 0;
@@ -40,15 +41,17 @@ int opt_stop_trace = 0;
 pid_t opt_trace_pid = 0;
 
 enum {
-       OPT_HELP = 42,
+       OPT_HELP = 1,
+       OPT_CREATE_SESSION,
+       OPT_DESTROY_SESSION,
 };
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       {"create-session",  'c',        POPT_ARG_STRING,        &opt_create_session, 0, 0, 0},
+       {"create-session",  'c',        POPT_ARG_STRING,        0, OPT_CREATE_SESSION, 0, 0},
        {"create-trace",        'C',    POPT_ARG_VAL,           &opt_create_trace, 1, 0, 0},
-       {"destroy-session", 'd',        POPT_ARG_STRING,        &opt_destroy_session, 0, 0, 0},
-       {"group",                       0,              POPT_ARG_STRING,        &opt_tracing_group, 0, 0},
+       {"destroy-session", 'd',        POPT_ARG_STRING,        0, OPT_DESTROY_SESSION, 0, 0},
+       {"group",                       0,              POPT_ARG_STRING,        &opt_tracing_group, 0, 0, 0},
        {"help",                        'h',    POPT_ARG_NONE,          0, OPT_HELP, 0, 0},
        {"kernel",                      0,              POPT_ARG_VAL,           &opt_trace_kernel, 1, 0, 0},
        {"list-apps",           'L',    POPT_ARG_VAL,           &opt_list_apps, 1, 0, 0},
@@ -88,7 +91,7 @@ static void usage(FILE *ofp)
        fprintf(ofp, "  -c, --create-session NAME    Create a new session\n");
        fprintf(ofp, "  -l, --list-sessions          List all available sessions\n");
        fprintf(ofp, "  -s, --session UUID           Specify tracing session using UUID\n");
-       fprintf(ofp, "  -d, --destroy-session=NAME   Destroy the session specified by NAME\n");
+       fprintf(ofp, "  -d, --destroy-session NAME   Destroy the session specified by NAME\n");
        fprintf(ofp, "\n");
        fprintf(ofp, "Tracing options:\n");
        //fprintf(ofp, "      --kernel               Enable kernel tracing\n");
@@ -101,7 +104,7 @@ static void usage(FILE *ofp)
        fprintf(ofp, "      --stop                   Stop tracing\n");
        fprintf(ofp, "\n");
        fprintf(ofp, "Please see the lttng(1) man page for full documentation.\n");
-       fprintf(ofp, "See http://lttng.org/ust for updates, bug reports and news.\n");
+       fprintf(ofp, "See http://lttng.org for updates, bug reports and news.\n");
 }
 
 /*
@@ -129,6 +132,14 @@ int parse_args(int argc, const char **argv)
                        usage(stderr);
                        clean_exit(EXIT_SUCCESS);
                        break;
+               case OPT_CREATE_SESSION:
+                       opt_create_session = 1;
+                       opt_session_name = poptGetOptArg(pc);
+                       break;
+               case OPT_DESTROY_SESSION:
+                       opt_destroy_session = 1;
+                       opt_session_uuid = poptGetOptArg(pc);
+                       break;
                default:
                        usage(stderr);
                        clean_exit(EXIT_FAILURE);
This page took 0.024016 seconds and 4 git commands to generate.