1#if HAVE_CONFIG_H
2#include <config.h>
3#endif
4
5#include <stdio.h>
6#include <stdlib.h>
7#include <string.h>
8#include <compat/dcerpc.h>
9#include "misc.h"
10
11void
12chk_dce_err(ecode, where, why, fatal)
13     error_status_t ecode;
14     const char * where;
15     const char * why;
16     unsigned int fatal;
17{
18
19  dce_error_string_t errstr;
20  int error_status;
21
22  if (ecode != error_status_ok)
23  {
24       dce_error_inq_text(ecode, errstr, &error_status);
25       if (error_status == error_status_ok)
26	 printf("ERROR.  where = <%s> why = <%s> error code = 0x%x"
27		"reason = <%s>\n",
28		where, why, (unsigned32)ecode, errstr);
29       else
30	 printf("ERROR.  where = <%s> why = <%s> error code = 0x%x\n",
31		where, why, (unsigned32)ecode);
32
33       if (fatal) exit(1);
34    }
35}
36