diff options
author | Mike Frysinger <vapier@gentoo.org> | 2021-01-03 02:52:11 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-01-04 17:41:23 -0500 |
commit | 19b1c38562f49ed79e57385e8a2cb7ab72b60a2e (patch) | |
tree | 0e857449c158c880d8d251aa440c42d70ff03dca /sim/common/sim-options.c | |
parent | dbed468bcb8dc3c85fcf30ebae7ba67cbe7dc19c (diff) | |
download | gdb-19b1c38562f49ed79e57385e8a2cb7ab72b60a2e.zip gdb-19b1c38562f49ed79e57385e8a2cb7ab72b60a2e.tar.gz gdb-19b1c38562f49ed79e57385e8a2cb7ab72b60a2e.tar.bz2 |
sim: common: add a version output helper w/copyright+license info
This mirrors the existing sim_print_help function, and the behavior
of all other GNU tools with their --version.
Diffstat (limited to 'sim/common/sim-options.c')
-rw-r--r-- | sim/common/sim-options.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c index 3064dfc..1d8abda 100644 --- a/sim/common/sim-options.c +++ b/sim/common/sim-options.c @@ -388,7 +388,7 @@ standard_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt, break; case OPTION_VERSION: - sim_io_printf (sd, "GNU simulator %s%s\n", PKGVERSION, version); + sim_print_version (sd, is_command); if (STATE_OPEN_KIND (sd) == SIM_OPEN_STANDALONE) exit (0); break; @@ -817,6 +817,26 @@ sim_print_help (SIM_DESC sd, int is_command) } } +/* Print version information. */ + +void +sim_print_version (SIM_DESC sd, int is_command) +{ + sim_io_printf (sd, "GNU simulator %s%s\n", PKGVERSION, version); + + sim_io_printf (sd, "Copyright (C) 2021 Free Software Foundation, Inc.\n"); + + /* Following the copyright is a brief statement that the program is + free software, that users are free to copy and change it on + certain conditions, that it is covered by the GNU GPL, and that + there is no warranty. */ + + sim_io_printf (sd, "\ +License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>\ +\nThis is free software: you are free to change and redistribute it.\n\ +There is NO WARRANTY, to the extent permitted by law.\n"); +} + /* Utility of sim_args_command to find the closest match for a command. Commands that have "-" in them can be specified as separate words. e.g. sim memory-region 0x800000,0x4000 |