static int opt_no_output;
static int opt_snapshot;
static unsigned int opt_live_timer;
+static bool opt_default_name;
enum {
OPT_HELP = 1,
OPT_LIST_OPTIONS,
OPT_LIVE_TIMER,
+ OPT_DEFAULT_NAME,
};
enum output_type {
{"live", 0, POPT_ARG_INT | POPT_ARGFLAG_OPTIONAL, 0, OPT_LIVE_TIMER, 0, 0},
{"shm-path", 0, POPT_ARG_STRING, &opt_shm_path, 0, 0, 0},
{"template-path", 0, POPT_ARG_STRING, &opt_template_path, 0, 0, 0},
+ {"default-name", 0, POPT_ARG_NONE, NULL, OPT_DEFAULT_NAME, 0, 0},
{0, 0, 0, 0, 0, 0, 0}
};
}
}
+ if (opt_session_name && opt_default_name) {
+ ERR("A session name must not be provided if the --default-name option is used");
+ ret = CMD_ERROR;
+ goto error;
+ }
error:
return ret;
}
goto error;
}
DBG("Session name from command option set to %s", base_session_name);
- } else if (base_session_name) {
+ } else if (base_session_name && !opt_default_name) {
printed_bytes = asprintf(&session_name_date, "%s-%s", base_session_name, datetime);
if (printed_bytes < 0) {
PERROR("Asprintf session name");
DBG("Session live timer interval set to %d", opt_live_timer);
break;
}
+ case OPT_DEFAULT_NAME:
+ opt_default_name = true;
+ break;
default:
ret = CMD_UNDEFINED;
goto end;