ARPDAS_QNX6 1.0
nlresp.c
Go to the documentation of this file.
00001 /* nlresp.c defines nl_response.
00002  * nl_response defines how nortlib routines respond to error situations.
00003  * In most cases, an error is considered fatal, but in certain cases
00004  * an error can be tolerated. The nortlib routines will in general
00005  * support both responses based on the setting of nl_response.
00006  * If nl_response is NLRSP_DIE, errors result in termination
00007  * via nl_error(3, ...). If nl_response is NLRSP_WARN, errors
00008  * will result in nl_error(1, ...), but the defined error return
00009  * will occur. If nl_response is NLRSP_QUIET, no error message
00010  * will be printed, just the error return value.
00011  * The values chosen for NLRSP_* are arbitrarily chosen to match
00012  * the type codes to nl_error.
00013  */
00014 #include "nortlib.h"
00015 char rcsid_nlresp_c[] =
00016   "$Header: /cvsroot/arp-das/nortlib2/src/nlresp.c,v 1.3 1998/01/06 18:36:56 nort Done $";
00017 
00018 int nl_response = NLRSP_DIE;
00019 
00020 int set_response(int newval) {
00021   int oldval;
00022   
00023   oldval = nl_response;
00024   nl_response = newval;
00025   return(oldval);
00026 }
00027 /*
00028 =Name nl_response: Error Response Code
00029 =Subject Nortlib
00030 =Name set_response(): Modify Error Response Code
00031 =Subject Nortlib
00032 =Synopsis
00033 
00034 #include "nortlib.h"
00035 int nl_response;
00036 int set_response(int newval);
00037 
00038 =Description
00039 
00040   The nl_response setting determines how most all nortlib
00041   functions react to errors. nl_response may be set to any value
00042   acceptable as a level argument to =nl_error=() or msg(). By
00043   default, nl_response is set to 3, which means any error in a
00044   nortlib function will be considered a fatal error. By changing
00045   the setting to 1, an error will simply be reported as a
00046   warning.<P>
00047   
00048   The philosophy here is that if you have not taken steps to
00049   handle an error condition, then the error condition cannot be
00050   tolerated. This makes it possible to write simple programs
00051   simply and to find out if more sophisticated error handling is
00052   required. In many cases, additional error handling will not be
00053   required; If your program need to communicate with a particular
00054   server and the server cannot be located, that probably should
00055   be a fatal error, and no further programming is required to
00056   make it so. Additional code is only required when you wish to
00057   selectively tolerate specific errors.<P>
00058   
00059   set_response() is a convenient way to manipulate nl_response.
00060   It sets nl_response to a new value and returns the old value so
00061   that it can be saved and restored after the current operation
00062   is completed.<P>
00063 
00064 =Returns
00065   set_response() returns the old value of nl_response so that it
00066   can be saved and restored.
00067 
00068 =SeeAlso
00069   =nl_error=().
00070 
00071 =End
00072 */
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines