DCE Application Programming Guide

Sample Application Listings
HP NonStop DCE Application Programming Guide429551-003
A-4
The Server File
The Server File
The server file is shown in Figure A-4 on page A-5.
Figure A-3. The Error Macro File in a Straight Port
/*
* (c) Copyright 1993 Harold W. Lockhart and Frederic M. Oldfield
* ALL RIGHTS RESERVED
*
* Permission is hereby granted to use, copy, modify and freely
* distribute this software for any purpose without fee, provided
* that the above copyright notice and this permission notice are
* retained in it.
*
* The authors make no representations about the suitability of
* this software for any purpose. It is provided "as is" without
* express or implied warranty. The authors assume no liability,
* direct or consequential, resulting from its use.
*/
#include <dce/dce_error.h>
#define ERROR(msg)\
{fprintf (stderr, "Error: %s in file: %s at line %d.\n", \
msg, __FILE__, __LINE__);\
exit (1);}
#define WARN(msg)\
{fprintf (stderr, "Warning: %s in file: %s at line %d.\n", \
msg, __FILE__, __LINE__);}
#define ERR_CHK(stat, msg) if (stat !=rpc_s_ok)\
{dce_error_string_t _dcemsg_; int _st_;\
dce_error_inq_text( stat, _dcemsg_, &_st_ );\
fprintf (stderr, "Error: %s in file: %s at line %d.\nDCE Error: %s\n", \
msg, __FILE__, __LINE__, _dcemsg_);\
exit (1);}
#define WRN_CHK(stat, msg) if (stat != rpc_s_ok)\
{dce_error_string_t _dcemsg_; int _st_;\
dce_error_inq_text( stat, _dcemsg_, &_st_ );\
fprintf (stderr, "Warning: %s in file: %s at line %d.\nDCE Error: %s\n",\
msg, __FILE__, __LINE__,_dcemsg_);}
#define CND_CHK(cond, msg) if ((cond))\
{fprintf (stderr, "Error: %s in file: %s at line %d.\n", \
msg, __FILE__, __LINE__);\
exit (1);}