ARPDAS_QNX6 1.0
nl_error.c
Go to the documentation of this file.
00001 /* nl_error.c provides a default error routine for nortlib routines.
00002  */
00003 #include <stdio.h>
00004 #include <stdlib.h>
00005 #include <stdarg.h>
00006 #include "nortlib.h"
00007 char rcsid_nl_error_c[] =
00008   "$Header: /cvsroot/arp-das/nortlib2/src/nl_error.c,v 1.6 2009/03/02 17:11:29 ntallen Exp $";
00009 
00010 int nl_err(int level, const char *s, ...) {
00011   va_list arg;
00012 
00013   va_start(arg, s);
00014   nl_verror(stderr, level, s, arg);
00015   va_end(arg);
00016   return(level);
00017 }
00018 
00019 int (*nl_error)(int level, const char *s, ...) = nl_err;
00020 /*
00021 =Name nl_error(): Standard error message function
00022 =Subject Nortlib
00023 =Name nl_err(): Default nl_error function
00024 =Subject Nortlib
00025 =Synopsis
00026 #include "nortlib.h"
00027 int (*nl_error)(int level, char *s, ...);
00028 int nl_err(int level, char *s, ...);
00029 
00030 =Description
00031 
00032   nl_error() is a retargettable standard error message function.
00033   It is actually a function pointer which may be modified either
00034   statically or dynamically as the application requires.<P>
00035   
00036   nl_error() functions provide standard printf-style formatting
00037   for status messages. The level argument determines how the
00038   message is handled:
00039   
00040   <UL>
00041         <LI>0: Informational Message
00042         <LI>1: Warning Message
00043         <LI>2: Error Message
00044         <LI>3: Fatal Error Message
00045         <LI>4: Internal Fatal Error Message
00046         <LI>-1: Normal Exit with Message
00047         <LI>-2: Debug level 1 Message
00048         <LI>-3: Debug level 2 Message
00049   </UL>
00050 
00051   Debug messages normally do not appear, but you can adjust the
00052   debug level to see some or all of your debugging messages. For
00053   the default functions nl_err() and nl_verror(), the current
00054   debug level is stored in the variable nl_debug_level, which may
00055   be adjustable by command line flags. For msg(), the debug level
00056   is controlled via the -l flag and does not use
00057   nl_debug_level.<P>
00058 
00059   The nortlib library provides a default function, nl_err(),
00060   which reports warnings to stderr and normal messages to stdout.
00061   The default function is included in the same module with the
00062   default definition of the nl_error pointer. In order to
00063   override the default, you must include your own definition of
00064   nl_error and initialize it to point to your own function.<P>
00065   
00066   This is done automatically for programs developed using the ARP
00067   Data Acquisition Systems architecture, where nl_error is mapped
00068   to the msg() function, which routes messages to a central memo
00069   utility. nl_error is also retargetted for many of our compilers
00070   to a function which prints out the current input file name and
00071   line number. It is then dynamically remapped to the default
00072   when input processing is completed. RTG and other QNX
00073   Windows-based programs remap nl_error to a function which pops
00074   up a window.<P>
00075   
00076   The point here is that library functions can count on calling a
00077   standard error message routine, and their messages will be
00078   mapped to the correct output processor depending on the
00079   application they are linked into.
00080   
00081 =Returns
00082 
00083   For non-fatal errors, returns the error level code.
00084 
00085 =SeeAlso
00086   =nl_response=, =nl_verror=().
00087 =End
00088 */
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines