1 /*
2  **      $Id: error.c 884 2006-03-15 16:20:27Z boote $
3  */
4 /************************************************************************
5  *                                                                      *
6  *                             Copyright (C)  2002                      *
7  *                                Internet2                             *
8  *                             All Rights Reserved                      *
9  *                                                                      *
10  ************************************************************************/
11 /*
12  **        File:        error.c
13  **
14  **        Author:      Jeff W. Boote
15  **                     Anatoly Karp
16  **
17  **        Date:        Fri Mar 29 15:36:44  2002
18  **
19  **        Description:
20  */
21 #include <owampP.h>
22 
23 #include <stdio.h>
24 #include <stdarg.h>
25 
26 void
OWPError_(OWPContext ctx,OWPErrSeverity severity,OWPErrType etype,const char * fmt,...)27 OWPError_(
28         OWPContext      ctx,
29         OWPErrSeverity  severity,
30         OWPErrType      etype,
31         const char      *fmt,
32         ...
33         )
34 {
35     va_list                ap;
36 
37     va_start(ap,fmt);
38 
39     if(ctx && ctx->eh){
40         I2ErrLogVT(ctx->eh,(int)severity,etype,fmt,ap);
41     }
42     else{
43         char    buff[_OWP_ERR_MAXSTRING];
44 
45         vsnprintf(buff,sizeof(buff),fmt,ap);
46         fwrite(buff,sizeof(char),strlen(buff),stderr);
47         fwrite("\n",sizeof(char),1,stderr);
48     }
49     va_end(ap);
50 
51     return;
52 }
53