Commit 0f1702ab authored by Stewart Brodie's avatar Stewart Brodie
Browse files

Added verbose (-v) option.

Detail:
  Usually, numeric statistics with a value of zero are suppressed from
    the output (excepting TX and RX frame counts).  With this option,
    those fields are displayed, and the DCI SWI base is shown for each
    DIB too.
Admin:
  Requires RISC_OSLib 4.93 or later (for exported stdbool.h header)
    (RiscOS/Sources/Lib/RISC_OSLib  tag: RISC_OSLib-4_93 or later)

Version 0.01. Tagged as 'showstat-0_01'
parent ac5aee17
......@@ -5,10 +5,11 @@ static const char *application_banner =
"Copyright (C) Element 14 Ltd. 1999. All rights reserved.\n";
static const char *application_help =
"Syntax: showstat [-help] [-file <filename>] [-type <type>] "
"Syntax: showstat [-help] [-v] [-file <filename>] [-type <type>] "
"[[<device>|<interface>] ...]\n"
"\n"
"-help Shows this help message\n"
"-v Verbose mode - shows more detail\n"
"-file Send output to <filename>\n"
"-type Show extended statistics for <type> modules only. Types known:\n"
" 0: general modules\n"
......@@ -97,8 +98,8 @@ static const char *standard_msgs[] = {
"RX frames",
"RX bytes",
"RX general errors",
"Last RX source"
"Last RX source",
"Driver SWI base"
};
static const char *unknown_message = "*UNKNOWN MESSAGE (code %d)*";
......
/* (0.00)
/* (0.01)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 0.00
#define Module_MajorVersion_CMHG 0.01
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 19 May 1999
#define Module_Date_CMHG 24 May 1999
#define Module_MajorVersion "0.00"
#define Module_Version 0
#define Module_MajorVersion "0.01"
#define Module_Version 1
#define Module_MinorVersion ""
#define Module_Date "19 May 1999"
#define Module_Date "24 May 1999"
#define Module_FullVersion "0.00"
#define Module_FullVersion "0.01"
......@@ -48,6 +48,9 @@
#include "msgs.h"
#include "main.h"
/* A few global options */
static bool verbose = false;
/**********
*
* This section is the only place which knows about the output device for this
......@@ -117,7 +120,7 @@ static void stat_opt_long_numeric(bool show_if_zero, size_t index, sp *p, msg_id
if (p->vp.lp[index] != 0) {
const unsigned long value = p->vp.lp[index] & p->p.lp[index];
if (value != 0 || show_if_zero) {
if (value != 0 || show_if_zero || verbose) {
stat_long_numeric(mid, value);
}
}
......@@ -263,17 +266,21 @@ static void showstat_driver(struct dib *dib)
{
static char extra_buffer[BUFSIZ];
showstat_heading(msgs_get(msg_DRIVER_NAME), dib->dib_name);
showstat_heading_mid(msg_DRIVER_NAME, dib->dib_name);
sprintf(extra_buffer, "%d", dib->dib_unit);
showstat_heading(msgs_get(msg_UNIT_NUMBER), extra_buffer);
showstat_heading_mid(msg_UNIT_NUMBER, extra_buffer);
if (format_mac_address((struct ether_addr *) dib->dib_address, extra_buffer, ':')) {
showstat_heading(msgs_get(msg_HW_ADDRESS), extra_buffer);
showstat_heading_mid(msg_HW_ADDRESS, extra_buffer);
}
showstat_heading_mid(msg_PHYS_LOC, dib->dib_location);
showstat_heading_mid(msg_DRIVER_MODULE, dib->dib_module);
if (verbose) {
sprintf(extra_buffer, "%#x", dib->dib_swibase);
showstat_heading_mid(msg_SWI_BASE, extra_buffer);
}
showstat_heading(msgs_get(msg_PHYS_LOC), dib->dib_location);
showstat_heading(msgs_get(msg_DRIVER_MODULE), dib->dib_module);
showstat_display_interface_features(dib->dib_inquire);
sprintf(extra_buffer, "%d", showstat_get_mtu(dib));
showstat_heading(msgs_get(msg_MTU), extra_buffer);
showstat_heading_mid(msg_MTU, extra_buffer);
showstat_get_stats(dib);
}
......@@ -524,6 +531,9 @@ int main(int argc, char *argv[])
++argv;
stat_providers_mask = 1UL << strtoul(argv[1], NULL, 10);
}
else if (strcmp(arg, "v") == 0) {
verbose = true;
}
else {
/* Unknown option */
}
......
......@@ -62,7 +62,8 @@ typedef enum {
msg_RX_FRAMES,
msg_RX_BYTES,
msg_RX_GENERAL_ERRORS,
msg_RX_LAST_SOURCE
msg_RX_LAST_SOURCE,
msg_SWI_BASE
} msg_id;
extern const char *msgs_get(msg_id);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment