49 const char *xsep =
"";
55 if (!estr) estr =
"reason unknown";
56 else if (isupper(
static_cast<int>(*estr)))
57 {
strlcpy(ebuff, estr,
sizeof(ebuff));
58 *ebuff =
static_cast<char>(tolower(
static_cast<int>(*estr)));
64 if (!etxt2) etxt2 = esep =
"";
65 if (xtra) xsep =
"\nAdditional context: ";
70 n = snprintf(buff, blen,
"Unable to %s%s%s; %s%s%s",etxt1,esep,etxt2,estr,
72 return (n < blen ? n : blen-1);
80 const char *esfx,
int ecode,
81 const char *etxt1,
const char *etxt2)
88 elen =
Format(ebuff,
sizeof(ebuff), ecode, etxt1, etxt2);
92 if (elog) elog->
Emsg(esfx, ebuff);
93 if (estrm) estrm->
Put(ebuff, elen);
97 if (ecode)
return (ecode < 0 ? ecode : -ecode);
static int Format(char *buff, int blen, int ecode, const char *etxt1, const char *etxt2=0, const char *xtra=0)
static int Route(XrdSysError *elog, XrdOucStream *estrm, const char *esfx, int ecode, const char *etxt1, const char *etxt2=0)
int Put(const char *data, const int dlen)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
static const char * ec2text(int ecode)