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