Commit e26bf489 authored by Peter Pentchev's avatar Peter Pentchev

Add the -V/--version command-line option.

parent 9292faa5
......@@ -5,6 +5,7 @@ Change log for hexer, the multi-view binary editor
- exit with status 0 if -h/--help is specified
- output the usage message to the standard error stream if
an invalid command-line option is specified
- add the -V/--version command-line option
1.0.4 2018/03/24
- allow hexer to be cross-built: if CC_FOR_BUILD is defined in
......
......@@ -41,7 +41,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.TH HEXER 1 "June 15, 2018" "Hexer 1.0.5"
.TH HEXER 1 "August 28, 2018" "Hexer 1.0.5"
.\"
.\" --- Section -- NAME -------------------------------------------------------
.\"
......@@ -99,7 +99,10 @@ specify multiple commands on the command line:
Turn off the usage of the termcap/terminfo ti/te sequence.
.TP
.B \-h,\ \-\-help
Print out a short help message and exit.
Display a short help message and exit.
.TP
.B \-V,\ \-\-version
Display program version information and exit.
.TP
.BI + command
This is equivalent to the
......
......@@ -88,7 +88,9 @@ usage: hexer [options] [file [...]]\n\
-t/--tite\n\
Turn off the usage of the termcap/terminfo ti/te sequence.\n\
-h/--help\n\
Print out a short help message and exit.\n\
Display a short help message and exit.\n\
-V/--version\n\
Display program version information and exit.\n\
+command\n\
This is equivalent to the -c option.\n\
Note: The long options are not available on all systems.\n";
......@@ -102,11 +104,12 @@ static struct option longopts[] = {
* buffer. */
{ "help", 0, 0, 'h' }, /* print a short help message to `stdout'. */
{ "tite", 0, 0, 't' }, /* tite - turn off the ti/te sequence. */
{ "version", 0, 0, 'V' }, /* print program version information. */
{ 0, 0, 0, 0 }
};
#endif /* HEXER_LONG_OPTIONS */
static const char *shortopts = "Rvr:c:dth";
static const char *shortopts = "Rvr:c:dthV";
static int hexer_readonly;
......@@ -164,6 +167,10 @@ process_args(const int argc, char * const argv[])
puts(usage_message);
exit_f = 1;
break;
case 'V':
puts("hexer " HEXER_VERSION);
exit_f = 1;
break;
default:
fputs(usage_message, stderr);
exit_f = 2;
......
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