/*****************************************************************************/ /* WasdWatchScript.c A convenience function that can be built stand-alone and called with either a null-terminated string and a NULL descriptor or a NULL null-terminated string and a string descriptor. The string is made available to the WATCH [x]script item. BUILD DETAILS ------------- $ CC /NAMES=AS_IS /PREFIX=ALL WASDWATCHSCRIPT.C and link object module into application. COPYRIGHT --------- Copyright (C) 2010 Mark G.Daniel This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the conditions of the GNU GENERAL PUBLIC LICENSE, version 3, or any later version. http://www.gnu.org/licenses/gpl.txt VERSION HISTORY --------------- 15-MAR-2010 MGD v1.0.0, initial */ /*****************************************************************************/ /* standard C header files */ #include #include #include /* VMS-related header files */ #include /*****************************************************************************/ /* */ void WasdWatchScript ( char *cString, struct dsc$descriptor *dString ) { static char *CgiPlusEsc = NULL, *CgiPlusEot = NULL; int len; char *sptr; /*********/ /* begin */ /*********/ if (cString) { len = strlen(cString); sptr = cString; } else if (dString) { len = dString->dsc$w_length; sptr = dString->dsc$a_pointer; } else return; if (CgiPlusEsc == NULL) CgiPlusEsc = getenv("CGIPLUSESC"); if (CgiPlusEot == NULL) CgiPlusEot = getenv("CGIPLUSEOT"); fflush (stdout); fputs (CgiPlusEsc, stdout); fflush (stdout); /* the leading '!' indicates we're not going to read the response */ fprintf (stdout, "!WATCH: %*.*s", len, len, sptr); fflush (stdout); fputs (CgiPlusEot, stdout); fflush (stdout); } /*****************************************************************************/