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