Defining a putmsg
script function turns off logging and
printing of error messages because it is assumed that the function
will completely handle the error, logging it (or not) as the programmer
sees fit. However, with the <PUTMSG>
directive
(here) and the vxcp
function
(here), logging and/or printing during a putmsg
function call can be re-enabled. This saves the hassle of writing a
log function inside <putmsg>
to save the errors. These calls
can also be used to ignore messages only during certain sections of
code (e.g. calling an error-prone but benign <EXEC>
program)
without having to write an explicit <putmsg>
function to
handle the errors:
...
<vxcp putmsg all off><$sav = $ret> <!-- ignore errors -->
<EXEC /usr/bin/my/buggy/program></EXEC>
<vxcp putmsg all $sav> <!-- restore error handling -->
...