Set PCRE2GREP_RC to the pcre2grep exit status when running under VMS.

This commit is contained in:
Philip.Hazel 2017-10-11 16:49:10 +00:00
parent 6f4ee08469
commit aa0c168332
2 changed files with 20 additions and 0 deletions

View File

@ -26,6 +26,10 @@ the public names in pcre2_convert.c.
8. Added two casts to compile.c and one to match.c to avoid compiler warnings.
9. Added code to pcre2grep when compiled under VMS to set the symbol
PCRE2GREP_RC to the exit status, because VMS does not distinguish between
exit(0) and exit(1).
Version 10.30 14-August-2017
----------------------------

View File

@ -520,6 +520,22 @@ Returns: does not return
static void
pcre2grep_exit(int rc)
{
/* VMS does exit codes differently: both exit(1) and exit(0) return with a
status of 1, which is not helpful. To help with this problem, define a symbol
(akin to an environment variable) called "PCRE2GREP_RC" and put the exit code
therein. */
#ifdef __VMS
#include descrip
#include lib$routines
char val_buf[4];
$DESCRIPTOR(sym_nam, "PCRE2GREP_RC");
$DESCRIPTOR(sym_val, val_buf);
sprintf(val_buf, "%d", rc);
sym_val.dsc$w_length = strlen(val_buf);
lib$set_symbol(&sym_nam, &sym_val);
#endif
if (resource_error)
{
fprintf(stderr, "pcre2grep: Error %d, %d, %d or %d means that a resource "