Add --version as a pcre2test option, and add a comment to config.
This commit is contained in:
parent
2a1dc104ed
commit
200ca3f1b4
|
@ -143,16 +143,31 @@ FIXME: This needs re-design.
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* The hackery in setting "v" below is to cope with the case when
|
||||||
|
PCRE2_PRERELEASE is set to an empty string (which it is for real releases).
|
||||||
|
If the second alternative is used in this case, it does not leave a space
|
||||||
|
before the date. On the other hand, if all four macros are put into a single
|
||||||
|
XSTRING when PCRE2_PRERELEASE is not empty, an unwanted space is inserted.
|
||||||
|
There are problems using an "obvious" approach like this:
|
||||||
|
|
||||||
|
XSTRING(PCRE2_MAJOR) "." XSTRING(PCRE_MINOR)
|
||||||
|
XSTRING(PCRE2_PRERELEASE) " " XSTRING(PCRE_DATE)
|
||||||
|
|
||||||
|
because, when PCRE2_PRERELEASE is empty, this leads to an attempted expansion
|
||||||
|
of STRING(). The C standard states: "If (before argument substitution) any
|
||||||
|
argument consists of no preprocessing tokens, the behavior is undefined." It
|
||||||
|
turns out the gcc treats this case as a single empty string - which is what
|
||||||
|
we really want - but Visual C grumbles about the lack of an argument for the
|
||||||
|
macro. Unfortunately, both are within their rights. As there seems to be no
|
||||||
|
way to test for a macro's value being empty at compile time, we have to
|
||||||
|
resort to a runtime test. */
|
||||||
|
|
||||||
case PCRE2_CONFIG_VERSION:
|
case PCRE2_CONFIG_VERSION:
|
||||||
{
|
{
|
||||||
PCRE2_UCHAR *t = (PCRE2_UCHAR *)where;
|
PCRE2_UCHAR *t = (PCRE2_UCHAR *)where;
|
||||||
/*
|
|
||||||
const char *v = (XSTRING(Z PCRE2_PRERELEASE)[1] == 0)?
|
const char *v = (XSTRING(Z PCRE2_PRERELEASE)[1] == 0)?
|
||||||
XSTRING(PCRE2_MAJOR.PCRE2_MINOR PCRE2_DATE) :
|
XSTRING(PCRE2_MAJOR.PCRE2_MINOR PCRE2_DATE) :
|
||||||
XSTRING(PCRE2_MAJOR.PCRE2_MINOR) XSTRING(PCRE2_PRERELEASE PCRE2_DATE);
|
XSTRING(PCRE2_MAJOR.PCRE2_MINOR) XSTRING(PCRE2_PRERELEASE PCRE2_DATE);
|
||||||
*/
|
|
||||||
const char *v = XSTRING(PCRE2_MAJOR.PCRE2_MINOR)
|
|
||||||
XSTRING(PCRE2_PRERELEASE PCRE2_DATE);
|
|
||||||
if (strlen(v) >= BYTES2CU(length) - 1) return PCRE2_ERROR_BADLENGTH;
|
if (strlen(v) >= BYTES2CU(length) - 1) return PCRE2_ERROR_BADLENGTH;
|
||||||
while (*v != 0) *t++ = *v++;
|
while (*v != 0) *t++ = *v++;
|
||||||
*t = 0;
|
*t = 0;
|
||||||
|
|
|
@ -4678,18 +4678,18 @@ printf(" -32 use the 32-bit library\n");
|
||||||
#endif
|
#endif
|
||||||
printf(" -b set default pattern control 'fullbincode'\n");
|
printf(" -b set default pattern control 'fullbincode'\n");
|
||||||
printf(" -C show PCRE2 compile-time options and exit\n");
|
printf(" -C show PCRE2 compile-time options and exit\n");
|
||||||
printf(" -C arg show a specific compile-time option and exit\n");
|
printf(" -C arg show a specific compile-time option and exit with its\n");
|
||||||
printf(" with its value if numeric (else 0). The arg can be:\n");
|
printf(" value if numeric (else 0). The arg can be:\n");
|
||||||
printf(" bsr \\R type [ANYCRLF, ANY]\n");
|
printf(" bsr \\R type [ANYCRLF, ANY]\n");
|
||||||
printf(" ebcdic compiled for EBCDIC character code [0,1]\n");
|
printf(" ebcdic compiled for EBCDIC character code [0,1]\n");
|
||||||
printf(" ebcdic-nl NL code if compiled for EBCDIC\n");
|
printf(" ebcdic-nl NL code if compiled for EBCDIC\n");
|
||||||
printf(" jit just-in-time compiler supported [0, 1]\n");
|
printf(" jit just-in-time compiler supported [0, 1]\n");
|
||||||
printf(" linksize internal link size [2, 3, 4]\n");
|
printf(" linksize internal link size [2, 3, 4]\n");
|
||||||
printf(" newline newline type [CR, LF, CRLF, ANYCRLF, ANY]\n");
|
printf(" newline newline type [CR, LF, CRLF, ANYCRLF, ANY]\n");
|
||||||
printf(" pcre8 8 bit library support enabled [0, 1]\n");
|
printf(" pcre8 8 bit library support enabled [0, 1]\n");
|
||||||
printf(" pcre16 16 bit library support enabled [0, 1]\n");
|
printf(" pcre16 16 bit library support enabled [0, 1]\n");
|
||||||
printf(" pcre32 32 bit library support enabled [0, 1]\n");
|
printf(" pcre32 32 bit library support enabled [0, 1]\n");
|
||||||
printf(" utf Unicode Transformation Format supported [0, 1]\n");
|
printf(" utf Unicode Transformation Format supported [0, 1]\n");
|
||||||
printf(" -d set default pattern control 'debug'\n");
|
printf(" -d set default pattern control 'debug'\n");
|
||||||
printf(" -help show usage information\n");
|
printf(" -help show usage information\n");
|
||||||
printf(" -i set default pattern control 'info'\n");
|
printf(" -i set default pattern control 'info'\n");
|
||||||
|
@ -4701,6 +4701,7 @@ printf(" -t [<n>] time compilation and execution, repeating <n> times\n");
|
||||||
printf(" -tm [<n>] time execution (matching) only, repeating <n> times\n");
|
printf(" -tm [<n>] time execution (matching) only, repeating <n> times\n");
|
||||||
printf(" -T same as -t, but show total times at the end\n");
|
printf(" -T same as -t, but show total times at the end\n");
|
||||||
printf(" -TM same as -tm, but show total time at the end\n");
|
printf(" -TM same as -tm, but show total time at the end\n");
|
||||||
|
printf(" -version show PCRE2 version and exit\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5014,6 +5015,15 @@ while (argc > 1 && argv[op][0] == '-')
|
||||||
usage();
|
usage();
|
||||||
goto EXIT;
|
goto EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Show version */
|
||||||
|
|
||||||
|
else if (strcmp(arg, "-version") == 0 ||
|
||||||
|
strcmp(arg, "--version") == 0)
|
||||||
|
{
|
||||||
|
print_version(stdout);
|
||||||
|
goto EXIT;
|
||||||
|
}
|
||||||
|
|
||||||
/* The following options save their data for processing once we know what
|
/* The following options save their data for processing once we know what
|
||||||
the running mode is. */
|
the running mode is. */
|
||||||
|
|
Loading…
Reference in New Issue