X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fview.c;h=3ba5766ea00c0e45dd332126956434d579bdf7d9;hb=2a08961400b46e468284e44f816d8fd614fa8f88;hp=3e2ce40ef1591c05143f7b8928427b7dd0da7da9;hpb=3cd887b35fa74815822b87c5495473288002345a;p=lttng-tools.git diff --git a/src/bin/lttng/commands/view.c b/src/bin/lttng/commands/view.c index 3e2ce40ef..3ba5766ea 100644 --- a/src/bin/lttng/commands/view.c +++ b/src/bin/lttng/commands/view.c @@ -1,18 +1,8 @@ /* - * Copyright (C) 2011 - David Goulet + * Copyright (C) 2011 David Goulet * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2 only, - * as published by the Free Software Foundation. + * SPDX-License-Identifier: GPL-2.0-only * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #define _LGPL_SOURCE @@ -68,11 +58,7 @@ enum viewer_type { VIEWER_USER_DEFINED = 2, }; -/* - * NOTE: "lttv" is a shell command and it's not working for exec() family - * functions so we might think of removing this wrapper or using bash. - */ -static const struct viewers { +static const struct viewer { const char *exec_name; enum viewer_type type; } viewers[] = { @@ -84,18 +70,13 @@ static const struct viewers { /* Is the session we are trying to view is in live mode. */ static int session_live_mode; -static const struct viewers *parse_options(void) +static const struct viewer *parse_viewer_option(void) { if (opt_viewer == NULL) { - /* Default is babeltrace */ + /* Default is babeltrace2 */ return &(viewers[VIEWER_BABELTRACE2]); } - /* - * This means that if -e, --viewers is used, we just override everything - * with it. For supported viewers like lttv, we could simply detect if "-t" - * is passed and if not, add the trace directory to it. - */ return &(viewers[VIEWER_USER_DEFINED]); } @@ -190,8 +171,8 @@ static char **alloc_argv_from_local_opts(const char **opts, size_t opts_len, memcpy(argv, opts, sizeof(char *) * opts_len); if (session_live_mode) { - argv[opts_len] = "-i"; - argv[opts_len + 1] = "lttng-live"; + argv[opts_len] = (char *) "-i"; + argv[opts_len + 1] = (char *) "lttng-live"; argv[opts_len + 2] = (char *) trace_path; argv[opts_len + 3] = NULL; } else { @@ -211,11 +192,11 @@ static int spawn_viewer(const char *trace_path) int ret = 0; struct stat status; const char *viewer_bin = NULL; - const struct viewers *viewer; + const struct viewer *viewer; char **argv = NULL; - /* Check for --viewer options */ - viewer = parse_options(); + /* Check for --viewer option. */ + viewer = parse_viewer_option(); if (viewer == NULL) { ret = CMD_ERROR; goto error;