diff --git a/src/init.c b/src/init.c index 2bbb2b45..0bf5c07c 100644 --- a/src/init.c +++ b/src/init.c @@ -40,6 +40,7 @@ #include "expr.h" #include "err.h" +static void ProcessLongArg(char const *arg); /*************************************************************** * * Command line options recognized: @@ -243,6 +244,11 @@ void InitRemind(int argc, char const *argv[]) while(*arg) arg++; break; + case '-': + ProcessLongArg(arg); + while(*arg) arg++; + break; + case '@': UseVTColors = 1; if (*arg) { @@ -958,3 +964,12 @@ AddTrustedUser(char const *username) NumTrustedUsers++; } +static void +ProcessLongArg(char const *arg) +{ + if (!strcmp(arg, "version")) { + printf("%s\n", VERSION); + exit(0); + } + fprintf(ErrFp, "%s: Unknown long option --%s\n", ArgV[0], arg); +} diff --git a/tests/test-rem b/tests/test-rem index 9916b5b0..8166df07 100644 --- a/tests/test-rem +++ b/tests/test-rem @@ -437,6 +437,9 @@ rm -rf include_dir/ww # This segfaulted in 04.02.03 ../src/remind -h '-imsgprefix(x)="foo"' /dev/null >> ../tests/test.out 2>&1 +# Test --version long option +../src/remind --version >> ../tests/test.out 2>&1 + # Remove references to SysInclude, which is build-specific grep -F -v '$SysInclude' < ../tests/test.out > ../tests/test.out.1 && mv -f ../tests/test.out.1 ../tests/test.out cmp -s ../tests/test.out ../tests/test.cmp diff --git a/tests/test.cmp b/tests/test.cmp index 3984f0e7..76627e72 100644 --- a/tests/test.cmp +++ b/tests/test.cmp @@ -11695,3 +11695,4 @@ Can't open file: include_dir/ww Error reading include_dir/ww: Can't open file SECURITY: Won't read world-writable file or directory! Error reading include_dir/ww: No files matching *.rem +04.02.06