Debian Codegraph @

libdebugger/command/show.c

raw symbols SCIP
1 /*
2 Copyright (C) 2004-2005, 2007-2009, 2011, 2020 R. Bernstein
3 <[email protected]>
4 This file is part of GNU Make (remake variant).
5
6 GNU Make is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU Make is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Make; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 /**
22 * \brief Debugger `show` command.
23 *
24 * Show debugger settings.
25 **/
26
27 #include "../../src/trace.h"
28 #include "../../src/debug.h"
29 #include "../../src/main.h"
30 #include "../../src/print.h"
31
32 #include "../cmd.h"
33 #include "../fns.h"
34 #include "../info.h"
35 #include "../msg.h"
36 #include "../subcmd.h"
37
38 subcommand_var_info_t show_subcommands[] = {
39 { "args",
40 "Show the command-line invocation",
41 NULL,
42 NULL,
43 false, 1},
44 { "basename",
45 "Show if we are to show short or long filenames",
46 NULL,
47 &basename_filenames, true, 1},
48 { "commands", "Show the history of commands you typed.",
49 NULL,
50 NULL,
51 false, 1},
52 { "debug",
53 "Show the value of the GNU Make debug mask (set via `--debug` or `-d`)",
54 NULL,
55 &db_level, false, 1},
56 { "ignore-errors",
57 "Show the value of the GNU Make `--ignore-errors` (or `-i`) flag",
58 NULL,
59 &ignore_errors_flag, true, 1},
60 { "keep-going",
61 "Show the value of the GNU Make `--keep-going` (or `-k`) flag",
62 NULL,
63 &keep_going_flag,
64 true, 1},
65 { "silent",
66 "Show the value of the GNU Make `--silent` (or `-s`) flag",
67 NULL,
68 &silent_flag,
69 true, 1},
70 #ifdef FIXED
71 { "trace",
72 "Value of GNU Make `--trace` (or `-t`) flag",
73 NULL,
74 &no_shell_trace,
75 true, 1},
76 #endif
77 { "version",
78 "Show the remake version.\n"
79 "\n"
80 "The first number part of the version is the GNU Make base version.\n"
81 "After that comes a remake-specific value which indicates its release iteration."
82 ,
83 NULL,
84 NULL,
85 false, 1},
86 { "warranty", "Various kinds of warranty you do not have.",
87 NULL,
88 NULL,
89 false, 1},
90 { NULL, NULL, NULL, NULL,
91 false, 0}
92 };
93
94 extern debug_return_t
95 dbg_cmd_show(char *psz_arg)
96 {
97 if (!psz_arg || 0==strlen(psz_arg)) {
98 unsigned int i;
99 for (i=0; show_subcommands[i].name; i++) {
100 if ( 0 == strcmp(show_subcommands[i].name, "warranty") ||
101 0 == strcmp(show_subcommands[i].name, "history"))
102 continue;
103 dbg_help_subcmd_entry("show", "%-10s -- %s",
104 &(show_subcommands[i]), false);
105 }
106 } else {
107 if (is_abbrev_of (psz_arg, "args", 3)) {
108 print_cmdline();
109 } else if (is_abbrev_of (psz_arg, "basename", 4)) {
110 printf("basename is %s.\n", var_to_on_off(basename_filenames));
111 } else if (is_abbrev_of (psz_arg, "debug", 3)) {
112 printf("debug is 0x%x.\n", (unsigned int) db_level);
113 print_db_level(db_level);
114 } else if (is_abbrev_of (psz_arg, "commands", 3)) {
115 dbg_cmd_show_command(psz_arg);
116 } else if (is_abbrev_of (psz_arg, "ignore-errors", 3)) {
117 printf("ignore-errors is %s.\n", var_to_on_off(ignore_errors_flag));
118 } else if (is_abbrev_of (psz_arg, "keep-going", 4)) {
119 printf("keep-going is %s.\n", var_to_on_off(keep_going_flag));
120 } else if (is_abbrev_of (psz_arg, "silent", 3)) {
121 printf("silent is %s.\n", var_to_on_off(silent_flag));
122 } else if (is_abbrev_of (psz_arg, "version", 3)) {
123 printf("version: %s\n", version_string);
124 } else if (is_abbrev_of (psz_arg, "warranty", 3)) {
125 printf("warranty: ");
126 printf("%s", WARRANTY);
127 } else {
128 printf("Undefined command \"%s\". Try \"help show\"\n", psz_arg);
129 }
130 }
131
132 return debug_readloop;
133 }
134
135
136 /*
137 * Local variables:
138 * eval: (c-set-style "gnu")
139 * indent-tabs-mode: nil
140 * End:
141 */