vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 6bf76e7fa90b918252bb41ff683d846a831a18ce
parent a05a67d7ee826479d6db869d8fe56970eb94a371
Author: Christian Hesse <mail@eworm.de>
Date:   Wed, 22 Apr 2015 13:59:48 +0200

make vis print version with command option -v

The man page states this is possible, so add the code.

Signed-off-by: Christian Hesse <mail@eworm.de>

Diffstat:
Mvis.c | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/vis.c b/vis.c @@ -2013,9 +2013,12 @@ int main(int argc, char *argv[]) { for (int i = 1; i < argc; i++) { if (argv[i][0] == '-') { switch (argv[i][1]) { - /* handle command line arguments */ - default: - break; + case 'v': + die("vis %s, compiled " __DATE__ " " __TIME__ "\n", VERSION); + break; + default: + die("Unknown command option: %s\n", argv[i]); + break; } } else if (argv[i][0] == '+') { cmd = argv[i] + (argv[i][1] == '/' || argv[i][1] == '?');