cpc_seterrfn man page on SmartOS

Man page or keyword search:  
man Server   16655 pages
apropos Keyword Search (all sections)
Output format
SmartOS logo
[printable version]

CPC_SETERRFN(3CPC)					    CPC_SETERRFN(3CPC)

NAME
       cpc_seterrfn - control libcpc error reporting

SYNOPSIS
       cc [ flag... ] file... −lcpc [ library... ]
       #include <libcpc.h>

       typedef void (cpc_errfn_t)(const char *fn, const char *fmt, va_list ap);

       void cpc_seterrfn(cpc_errfn_t *errfn);

DESCRIPTION
       For  the	 convenience  of programmers instrumenting their code, several
       libcpc(3LIB) functions automatically emit to stderr error messages that
       attempt	to  provide  a more detailed explanation of their error return
       values.	While this can be useful for simple  programs,	some  applica‐
       tions  may  wish	 to  report their errors differently—for example, to a
       window or to a log file.

       The cpc_seterrfn() function allows the caller to provide	 an  alternate
       function	 for reporting errors; the type signature is shown above.  The
       fn argument is passed the  library  function  name  that	 detected  the
       error,  the  format  string  fmt	 and argument pointer ap can be passed
       directly to vsnprintf(3C) or similar varargs-based routine for  format‐
       ting.

       The  default  printing  routine	can be restored by calling the routine
       with an errfn argument of NULL.

EXAMPLES
       Example 1 Debugging example.

       This example produces error messages only when  debugging  the  program
       containing  it,	or when the  cpc_strtoevent() function is reporting an
       error when parsing an event specification

	 int debugging;
	 void
	 myapp_errfn(const char *fn, const char *fmt, va_list ap)
	 {
		 if (strcmp(fn, "strtoevent") != 0 && !debugging)
		     return;
		 (void) fprintf(stderr, "myapp: cpc_%s(): ", fn);
		 (void) vfprintf(stderr, fmt, ap);
	 }

ATTRIBUTES
       See attributes(5) for descriptions of the following attributes:

       ┌────────────────────┬─────────────────┐
       │  ATTRIBUTE TYPE    │ ATTRIBUTE VALUE │
       ├────────────────────┼─────────────────┤
       │MT-Level	    │ Unsafe	      │
       ├────────────────────┼─────────────────┤
       │Interface Stability │ Obsolete	      │
       └────────────────────┴─────────────────┘

SEE ALSO
       cpc(3CPC),    cpc_seterrhndlr(3CPC),    libcpc(3LIB),	vsnprintf(3C),
       attributes(5)

NOTES
       The  cpc_seterrfn()  function  exists  for  binary  compatibility only.
       Source containing this function will  not  compile.  This  function  is
       obsolete	 and might be removed in a future release. Applications should
       use cpc_seterrhndlr(3CPC) instead.

				 Mar 28, 2005		    CPC_SETERRFN(3CPC)
[top]

List of man pages available for SmartOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net