2017-06-13 04:34:24 +00:00
|
|
|
// Implementation of the status builtin.
|
|
|
|
#include "config.h" // IWYU pragma: keep
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <wchar.h>
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "builtin.h"
|
|
|
|
#include "builtin_status.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "fallback.h" // IWYU pragma: keep
|
|
|
|
#include "io.h"
|
|
|
|
#include "parser.h"
|
|
|
|
#include "proc.h"
|
|
|
|
#include "wgetopt.h"
|
|
|
|
#include "wutil.h" // IWYU pragma: keep
|
|
|
|
|
|
|
|
enum status_cmd_t {
|
|
|
|
STATUS_IS_LOGIN = 1,
|
|
|
|
STATUS_IS_INTERACTIVE,
|
|
|
|
STATUS_IS_BLOCK,
|
2017-06-20 04:05:34 +00:00
|
|
|
STATUS_IS_BREAKPOINT,
|
2017-06-13 04:34:24 +00:00
|
|
|
STATUS_IS_COMMAND_SUB,
|
|
|
|
STATUS_IS_FULL_JOB_CTRL,
|
|
|
|
STATUS_IS_INTERACTIVE_JOB_CTRL,
|
|
|
|
STATUS_IS_NO_JOB_CTRL,
|
2017-06-21 04:10:15 +00:00
|
|
|
STATUS_FILENAME,
|
|
|
|
STATUS_FUNCTION,
|
|
|
|
STATUS_LINE_NUMBER,
|
2017-06-13 04:34:24 +00:00
|
|
|
STATUS_SET_JOB_CONTROL,
|
2017-06-21 04:10:15 +00:00
|
|
|
STATUS_STACK_TRACE,
|
2017-06-13 04:34:24 +00:00
|
|
|
STATUS_UNDEF
|
|
|
|
};
|
|
|
|
|
|
|
|
// Must be sorted by string, not enum or random.
|
|
|
|
const enum_map<status_cmd_t> status_enum_map[] = {
|
2017-06-21 04:10:15 +00:00
|
|
|
{STATUS_FILENAME, L"current-filename"},
|
|
|
|
{STATUS_FUNCTION, L"current-function"},
|
|
|
|
{STATUS_LINE_NUMBER, L"current-line-number"},
|
|
|
|
{STATUS_FILENAME, L"filename"},
|
|
|
|
{STATUS_FUNCTION, L"function"},
|
2017-06-13 04:34:24 +00:00
|
|
|
{STATUS_IS_BLOCK, L"is-block"},
|
2017-06-20 04:05:34 +00:00
|
|
|
{STATUS_IS_BREAKPOINT, L"is-breakpoint"},
|
2017-06-13 04:34:24 +00:00
|
|
|
{STATUS_IS_COMMAND_SUB, L"is-command-substitution"},
|
|
|
|
{STATUS_IS_FULL_JOB_CTRL, L"is-full-job-control"},
|
|
|
|
{STATUS_IS_INTERACTIVE, L"is-interactive"},
|
|
|
|
{STATUS_IS_INTERACTIVE_JOB_CTRL, L"is-interactive-job-control"},
|
|
|
|
{STATUS_IS_LOGIN, L"is-login"},
|
|
|
|
{STATUS_IS_NO_JOB_CTRL, L"is-no-job-control"},
|
|
|
|
{STATUS_SET_JOB_CONTROL, L"job-control"},
|
2017-06-21 04:10:15 +00:00
|
|
|
{STATUS_LINE_NUMBER, L"line-number"},
|
|
|
|
{STATUS_STACK_TRACE, L"print-stack-trace"},
|
|
|
|
{STATUS_STACK_TRACE, L"stack-trace"},
|
2017-06-13 04:34:24 +00:00
|
|
|
{STATUS_UNDEF, NULL}};
|
|
|
|
#define status_enum_map_len (sizeof status_enum_map / sizeof *status_enum_map)
|
|
|
|
|
|
|
|
#define CHECK_FOR_UNEXPECTED_STATUS_ARGS(status_cmd) \
|
|
|
|
if (args.size() != 0) { \
|
|
|
|
const wchar_t *subcmd_str = enum_to_str(status_cmd, status_enum_map); \
|
|
|
|
if (!subcmd_str) subcmd_str = L"default"; \
|
|
|
|
streams.err.append_format(BUILTIN_ERR_ARG_COUNT2, cmd, subcmd_str, 0, args.size()); \
|
|
|
|
retval = STATUS_INVALID_ARGS; \
|
|
|
|
break; \
|
|
|
|
}
|
|
|
|
|
|
|
|
int job_control_str_to_mode(const wchar_t *mode, wchar_t *cmd, io_streams_t &streams) {
|
|
|
|
if (wcscmp(mode, L"full") == 0) {
|
|
|
|
return JOB_CONTROL_ALL;
|
|
|
|
} else if (wcscmp(mode, L"interactive") == 0) {
|
|
|
|
return JOB_CONTROL_INTERACTIVE;
|
|
|
|
} else if (wcscmp(mode, L"none") == 0) {
|
|
|
|
return JOB_CONTROL_NONE;
|
|
|
|
}
|
|
|
|
streams.err.append_format(L"%ls: Invalid job control mode '%ls'\n", cmd, mode);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-06-16 00:57:37 +00:00
|
|
|
struct status_cmd_opts_t {
|
2017-06-13 04:34:24 +00:00
|
|
|
bool print_help = false;
|
2017-06-24 05:14:21 +00:00
|
|
|
int level = 1;
|
2017-06-13 04:34:24 +00:00
|
|
|
int new_job_control_mode = -1;
|
2017-06-24 05:14:21 +00:00
|
|
|
status_cmd_t status_cmd = STATUS_UNDEF;
|
2017-06-13 04:34:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/// Note: Do not add new flags that represent subcommands. We're encouraging people to switch to
|
|
|
|
/// the non-flag subcommand form. While these flags are deprecated they must be supported at
|
|
|
|
/// least until fish 3.0 and possibly longer to avoid breaking everyones config.fish and other
|
|
|
|
/// scripts.
|
2017-06-24 05:14:21 +00:00
|
|
|
static const wchar_t *short_options = L":L:cbilfnhj:t";
|
2017-06-13 04:34:24 +00:00
|
|
|
static const struct woption long_options[] = {{L"help", no_argument, NULL, 'h'},
|
|
|
|
{L"is-command-substitution", no_argument, NULL, 'c'},
|
|
|
|
{L"is-block", no_argument, NULL, 'b'},
|
|
|
|
{L"is-interactive", no_argument, NULL, 'i'},
|
|
|
|
{L"is-login", no_argument, NULL, 'l'},
|
|
|
|
{L"is-full-job-control", no_argument, NULL, 1},
|
|
|
|
{L"is-interactive-job-control", no_argument, NULL, 2},
|
|
|
|
{L"is-no-job-control", no_argument, NULL, 3},
|
2017-06-21 04:10:15 +00:00
|
|
|
{L"filename", no_argument, NULL, 'f'},
|
2017-06-13 04:34:24 +00:00
|
|
|
{L"current-filename", no_argument, NULL, 'f'},
|
2017-06-24 05:14:21 +00:00
|
|
|
{L"level", required_argument, NULL, 'L'},
|
2017-06-21 04:10:15 +00:00
|
|
|
{L"line", no_argument, NULL, 'n'},
|
|
|
|
{L"line-number", no_argument, NULL, 'n'},
|
2017-06-13 04:34:24 +00:00
|
|
|
{L"current-line-number", no_argument, NULL, 'n'},
|
|
|
|
{L"job-control", required_argument, NULL, 'j'},
|
|
|
|
{L"print-stack-trace", no_argument, NULL, 't'},
|
|
|
|
{NULL, 0, NULL, 0}};
|
|
|
|
|
|
|
|
/// Remember the status subcommand and disallow selecting more than one status subcommand.
|
2017-06-16 00:57:37 +00:00
|
|
|
static bool set_status_cmd(wchar_t *const cmd, status_cmd_opts_t &opts, status_cmd_t sub_cmd,
|
2017-06-13 04:34:24 +00:00
|
|
|
io_streams_t &streams) {
|
2017-06-16 00:57:37 +00:00
|
|
|
if (opts.status_cmd != STATUS_UNDEF) {
|
2017-06-13 04:34:24 +00:00
|
|
|
wchar_t err_text[1024];
|
2017-06-16 00:57:37 +00:00
|
|
|
const wchar_t *subcmd_str1 = enum_to_str(opts.status_cmd, status_enum_map);
|
2017-06-13 04:34:24 +00:00
|
|
|
const wchar_t *subcmd_str2 = enum_to_str(sub_cmd, status_enum_map);
|
|
|
|
swprintf(err_text, sizeof(err_text) / sizeof(wchar_t),
|
|
|
|
_(L"you cannot do both '%ls' and '%ls' in the same invocation"), subcmd_str1,
|
|
|
|
subcmd_str2);
|
|
|
|
streams.err.append_format(BUILTIN_ERR_COMBO2, cmd, err_text);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-06-16 00:57:37 +00:00
|
|
|
opts.status_cmd = sub_cmd;
|
2017-06-13 04:34:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-06-16 00:57:37 +00:00
|
|
|
static int parse_cmd_opts(status_cmd_opts_t &opts, int *optind, //!OCLINT(high ncss method)
|
2017-06-13 20:03:32 +00:00
|
|
|
int argc, wchar_t **argv, parser_t &parser, io_streams_t &streams) {
|
2017-06-13 04:34:24 +00:00
|
|
|
wchar_t *cmd = argv[0];
|
|
|
|
int opt;
|
|
|
|
wgetopter_t w;
|
|
|
|
while ((opt = w.wgetopt_long(argc, argv, short_options, long_options, NULL)) != -1) {
|
|
|
|
switch (opt) {
|
|
|
|
case 1: {
|
2017-06-16 00:57:37 +00:00
|
|
|
if (!set_status_cmd(cmd, opts, STATUS_IS_FULL_JOB_CTRL, streams)) {
|
2017-06-13 04:34:24 +00:00
|
|
|
return STATUS_CMD_ERROR;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2: {
|
2017-06-17 04:00:24 +00:00
|
|
|
if (!set_status_cmd(cmd, opts, STATUS_IS_INTERACTIVE_JOB_CTRL, streams)) {
|
2017-06-13 04:34:24 +00:00
|
|
|
return STATUS_CMD_ERROR;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 3: {
|
2017-06-16 00:57:37 +00:00
|
|
|
if (!set_status_cmd(cmd, opts, STATUS_IS_NO_JOB_CTRL, streams)) {
|
2017-06-13 04:34:24 +00:00
|
|
|
return STATUS_CMD_ERROR;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2017-06-24 05:14:21 +00:00
|
|
|
case 'L': {
|
|
|
|
opts.level = fish_wcstoi(w.woptarg);
|
|
|
|
if (opts.level < 0 || errno == ERANGE) {
|
2017-06-24 06:19:09 +00:00
|
|
|
streams.err.append_format(_(L"%ls: Invalid level value '%ls'\n"), argv[0],
|
|
|
|
w.woptarg);
|
2017-06-24 05:14:21 +00:00
|
|
|
return STATUS_INVALID_ARGS;
|
|
|
|
} else if (errno) {
|
|
|
|
streams.err.append_format(BUILTIN_ERR_NOT_NUMBER, argv[0], w.woptarg);
|
|
|
|
return STATUS_INVALID_ARGS;
|
|
|
|
}
|
2017-06-21 04:10:15 +00:00
|
|
|
break;
|
|
|
|
}
|
2017-06-13 04:34:24 +00:00
|
|
|
case 'c': {
|
2017-06-16 00:57:37 +00:00
|
|
|
if (!set_status_cmd(cmd, opts, STATUS_IS_COMMAND_SUB, streams)) {
|
2017-06-13 04:34:24 +00:00
|
|
|
return STATUS_CMD_ERROR;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'b': {
|
2017-06-16 00:57:37 +00:00
|
|
|
if (!set_status_cmd(cmd, opts, STATUS_IS_BLOCK, streams)) {
|
2017-06-13 04:34:24 +00:00
|
|
|
return STATUS_CMD_ERROR;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'i': {
|
2017-06-16 00:57:37 +00:00
|
|
|
if (!set_status_cmd(cmd, opts, STATUS_IS_INTERACTIVE, streams)) {
|
2017-06-13 04:34:24 +00:00
|
|
|
return STATUS_CMD_ERROR;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'l': {
|
2017-06-16 00:57:37 +00:00
|
|
|
if (!set_status_cmd(cmd, opts, STATUS_IS_LOGIN, streams)) {
|
2017-06-13 04:34:24 +00:00
|
|
|
return STATUS_CMD_ERROR;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'f': {
|
2017-06-21 04:10:15 +00:00
|
|
|
if (!set_status_cmd(cmd, opts, STATUS_FILENAME, streams)) {
|
2017-06-13 04:34:24 +00:00
|
|
|
return STATUS_CMD_ERROR;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'n': {
|
2017-06-21 04:10:15 +00:00
|
|
|
if (!set_status_cmd(cmd, opts, STATUS_LINE_NUMBER, streams)) {
|
2017-06-13 04:34:24 +00:00
|
|
|
return STATUS_CMD_ERROR;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'j': {
|
2017-06-16 00:57:37 +00:00
|
|
|
if (!set_status_cmd(cmd, opts, STATUS_SET_JOB_CONTROL, streams)) {
|
2017-06-13 04:34:24 +00:00
|
|
|
return STATUS_CMD_ERROR;
|
|
|
|
}
|
2017-06-16 00:57:37 +00:00
|
|
|
opts.new_job_control_mode = job_control_str_to_mode(w.woptarg, cmd, streams);
|
|
|
|
if (opts.new_job_control_mode == -1) {
|
2017-06-13 04:34:24 +00:00
|
|
|
return STATUS_CMD_ERROR;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 't': {
|
2017-06-21 04:10:15 +00:00
|
|
|
if (!set_status_cmd(cmd, opts, STATUS_STACK_TRACE, streams)) {
|
2017-06-13 04:34:24 +00:00
|
|
|
return STATUS_CMD_ERROR;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'h': {
|
2017-06-16 00:57:37 +00:00
|
|
|
opts.print_help = true;
|
2017-06-15 05:12:29 +00:00
|
|
|
break;
|
2017-06-13 04:34:24 +00:00
|
|
|
}
|
|
|
|
case ':': {
|
|
|
|
builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1]);
|
|
|
|
return STATUS_INVALID_ARGS;
|
|
|
|
}
|
|
|
|
case '?': {
|
|
|
|
builtin_unknown_option(parser, streams, cmd, argv[w.woptind - 1]);
|
|
|
|
return STATUS_INVALID_ARGS;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
DIE("unexpected retval from wgetopt_long");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*optind = w.woptind;
|
|
|
|
return STATUS_CMD_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// The status builtin. Gives various status information on fish.
|
|
|
|
int builtin_status(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
|
|
|
wchar_t *cmd = argv[0];
|
|
|
|
int argc = builtin_count_args(argv);
|
2017-06-16 00:57:37 +00:00
|
|
|
status_cmd_opts_t opts;
|
2017-06-13 04:34:24 +00:00
|
|
|
|
|
|
|
int optind;
|
2017-06-16 00:57:37 +00:00
|
|
|
int retval = parse_cmd_opts(opts, &optind, argc, argv, parser, streams);
|
2017-06-13 04:34:24 +00:00
|
|
|
if (retval != STATUS_CMD_OK) return retval;
|
|
|
|
|
|
|
|
if (opts.print_help) {
|
|
|
|
builtin_print_help(parser, streams, cmd, streams.out);
|
|
|
|
return STATUS_CMD_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If a status command hasn't already been specified via a flag check the first word.
|
|
|
|
// Note that this can be simplified after we eliminate allowing subcommands as flags.
|
|
|
|
if (optind < argc) {
|
|
|
|
status_cmd_t subcmd = str_to_enum(argv[optind], status_enum_map, status_enum_map_len);
|
|
|
|
if (subcmd != STATUS_UNDEF) {
|
2017-06-16 00:57:37 +00:00
|
|
|
if (!set_status_cmd(cmd, opts, subcmd, streams)) {
|
2017-06-13 04:34:24 +00:00
|
|
|
return STATUS_CMD_ERROR;
|
|
|
|
}
|
|
|
|
optind++;
|
2017-06-20 04:05:34 +00:00
|
|
|
} else {
|
|
|
|
streams.err.append_format(BUILTIN_ERR_INVALID_SUBCMD, cmd, argv[1]);
|
|
|
|
return STATUS_INVALID_ARGS;
|
2017-06-13 04:34:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Every argument that we haven't consumed already is an argument for a subcommand.
|
|
|
|
const wcstring_list_t args(argv + optind, argv + argc);
|
|
|
|
|
|
|
|
switch (opts.status_cmd) {
|
|
|
|
case STATUS_UNDEF: {
|
|
|
|
CHECK_FOR_UNEXPECTED_STATUS_ARGS(opts.status_cmd)
|
|
|
|
if (is_login) {
|
|
|
|
streams.out.append_format(_(L"This is a login shell\n"));
|
|
|
|
} else {
|
|
|
|
streams.out.append_format(_(L"This is not a login shell\n"));
|
|
|
|
}
|
|
|
|
|
|
|
|
streams.out.append_format(
|
|
|
|
_(L"Job control: %ls\n"),
|
|
|
|
job_control_mode == JOB_CONTROL_INTERACTIVE
|
|
|
|
? _(L"Only on interactive jobs")
|
|
|
|
: (job_control_mode == JOB_CONTROL_NONE ? _(L"Never") : _(L"Always")));
|
|
|
|
streams.out.append(parser.stack_trace());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case STATUS_SET_JOB_CONTROL: {
|
|
|
|
if (opts.new_job_control_mode != -1) {
|
|
|
|
// Flag form was used.
|
|
|
|
CHECK_FOR_UNEXPECTED_STATUS_ARGS(opts.status_cmd)
|
|
|
|
} else {
|
|
|
|
if (args.size() != 1) {
|
|
|
|
const wchar_t *subcmd_str = enum_to_str(opts.status_cmd, status_enum_map);
|
|
|
|
streams.err.append_format(BUILTIN_ERR_ARG_COUNT2, cmd, subcmd_str, 1,
|
|
|
|
args.size());
|
|
|
|
return STATUS_INVALID_ARGS;
|
|
|
|
}
|
|
|
|
opts.new_job_control_mode = job_control_str_to_mode(args[0].c_str(), cmd, streams);
|
|
|
|
if (opts.new_job_control_mode == -1) {
|
|
|
|
return STATUS_CMD_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
job_control_mode = opts.new_job_control_mode;
|
|
|
|
break;
|
|
|
|
}
|
2017-06-21 04:10:15 +00:00
|
|
|
case STATUS_FILENAME: {
|
2017-06-13 04:34:24 +00:00
|
|
|
CHECK_FOR_UNEXPECTED_STATUS_ARGS(opts.status_cmd)
|
|
|
|
const wchar_t *fn = parser.current_filename();
|
|
|
|
|
2017-06-24 05:14:21 +00:00
|
|
|
if (!fn) fn = _(L"stdin");
|
2017-06-13 04:34:24 +00:00
|
|
|
streams.out.append_format(L"%ls\n", fn);
|
|
|
|
break;
|
|
|
|
}
|
2017-06-21 04:10:15 +00:00
|
|
|
case STATUS_FUNCTION: {
|
2017-06-13 04:34:24 +00:00
|
|
|
CHECK_FOR_UNEXPECTED_STATUS_ARGS(opts.status_cmd)
|
2017-06-24 05:14:21 +00:00
|
|
|
const wchar_t *fn = parser.get_function_name(opts.level);
|
2017-06-13 04:34:24 +00:00
|
|
|
|
2017-06-24 05:14:21 +00:00
|
|
|
if (!fn) fn = _(L"N/A");
|
2017-06-13 04:34:24 +00:00
|
|
|
streams.out.append_format(L"%ls\n", fn);
|
|
|
|
break;
|
|
|
|
}
|
2017-06-21 04:10:15 +00:00
|
|
|
case STATUS_LINE_NUMBER: {
|
2017-06-13 04:34:24 +00:00
|
|
|
CHECK_FOR_UNEXPECTED_STATUS_ARGS(opts.status_cmd)
|
2017-06-24 05:14:21 +00:00
|
|
|
// TBD is how to interpret the level argument when fetching the line number.
|
|
|
|
// See issue #4161.
|
|
|
|
// streams.out.append_format(L"%d\n", parser.get_lineno(opts.level));
|
2017-06-13 04:34:24 +00:00
|
|
|
streams.out.append_format(L"%d\n", parser.get_lineno());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case STATUS_IS_INTERACTIVE: {
|
|
|
|
CHECK_FOR_UNEXPECTED_STATUS_ARGS(opts.status_cmd)
|
|
|
|
retval = !is_interactive_session;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case STATUS_IS_COMMAND_SUB: {
|
|
|
|
CHECK_FOR_UNEXPECTED_STATUS_ARGS(opts.status_cmd)
|
|
|
|
retval = !is_subshell;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case STATUS_IS_BLOCK: {
|
|
|
|
CHECK_FOR_UNEXPECTED_STATUS_ARGS(opts.status_cmd)
|
|
|
|
retval = !is_block;
|
|
|
|
break;
|
|
|
|
}
|
2017-06-20 04:05:34 +00:00
|
|
|
case STATUS_IS_BREAKPOINT: {
|
|
|
|
CHECK_FOR_UNEXPECTED_STATUS_ARGS(opts.status_cmd)
|
|
|
|
retval = !is_breakpoint;
|
|
|
|
break;
|
|
|
|
}
|
2017-06-13 04:34:24 +00:00
|
|
|
case STATUS_IS_LOGIN: {
|
|
|
|
CHECK_FOR_UNEXPECTED_STATUS_ARGS(opts.status_cmd)
|
|
|
|
retval = !is_login;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case STATUS_IS_FULL_JOB_CTRL: {
|
|
|
|
CHECK_FOR_UNEXPECTED_STATUS_ARGS(opts.status_cmd)
|
|
|
|
retval = job_control_mode != JOB_CONTROL_ALL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case STATUS_IS_INTERACTIVE_JOB_CTRL: {
|
|
|
|
CHECK_FOR_UNEXPECTED_STATUS_ARGS(opts.status_cmd)
|
|
|
|
retval = job_control_mode != JOB_CONTROL_INTERACTIVE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case STATUS_IS_NO_JOB_CTRL: {
|
|
|
|
CHECK_FOR_UNEXPECTED_STATUS_ARGS(opts.status_cmd)
|
|
|
|
retval = job_control_mode != JOB_CONTROL_NONE;
|
|
|
|
break;
|
|
|
|
}
|
2017-06-21 04:10:15 +00:00
|
|
|
case STATUS_STACK_TRACE: {
|
2017-06-13 04:34:24 +00:00
|
|
|
CHECK_FOR_UNEXPECTED_STATUS_ARGS(opts.status_cmd)
|
|
|
|
streams.out.append(parser.stack_trace());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|