if (argc < 3)
{
- XDBG_REPLY ("Error : Too few arguments.\n");
+ REPLY ("Error : Too few arguments.\n");
return FALSE;
}
policy_type = DENY;
else
{
- XDBG_REPLY ("Error : Unknown policy : [%s].\n Policy should be ALLOW or DENY.\n", policy);
+ REPLY ("Error : Unknown policy : [%s].\n Policy should be ALLOW or DENY.\n", policy);
return FALSE;
}
result = rulechecker_add_rule (rc, policy_type, rule);
if (result == RC_ERR_TOO_MANY_RULES)
{
- XDBG_REPLY ("Error : Too many rules were added.\n");
+ REPLY ("Error : Too many rules were added.\n");
return FALSE;
}
else if (result == RC_ERR_PARSE_ERROR)
{
- XDBG_REPLY ("Error : An error occured during parsing the rule [%s]\n", rule);
+ REPLY ("Error : An error occured during parsing the rule [%s]\n", rule);
return FALSE;
}
- XDBG_REPLY ("The rule was successfully added.\n\n");
+ REPLY ("The rule was successfully added.\n\n");
rulechecker_print_rule (rc, reply);
return TRUE;
}
if (argc < 2)
{
- XDBG_REPLY ("Error : Too few arguments.\n");
+ REPLY ("Error : Too few arguments.\n");
return FALSE;
}
{
rulechecker_destroy (rc);
rc = rulechecker_init();
- XDBG_REPLY ("Every rules were successfully removed.\n");
+ REPLY ("Every rules were successfully removed.\n");
}
else
{
int index = atoi (remove_idx);
if (isdigit (*remove_idx) && rulechecker_remove_rule (rc, index) == 0)
- XDBG_REPLY ("The rule [%d] was successfully removed.\n", index);
+ REPLY ("The rule [%d] was successfully removed.\n", index);
else
- XDBG_REPLY ("Rule remove fail : No such rule [%s].\n", remove_idx);
+ REPLY ("Rule remove fail : No such rule [%s].\n", remove_idx);
}
}
rulechecker_print_rule (rc, reply);
}
else if (!_strcasecmp (command, "help"))
{
- XDBG_REPLY ("%s", rulechecker_print_usage());
+ REPLY ("%s", rulechecker_print_usage());
return TRUE;
}
- XDBG_REPLY ("%s\nUnknown command : [%s].\n\n", rulechecker_print_usage(), command);
+ REPLY ("%s\nUnknown command : [%s].\n\n", rulechecker_print_usage(), command);
return TRUE;
}
RETURN_IF_FAIL (evinfo->type >= 0 && (sizeof (evt_dir) / sizeof (char*)));
RETURN_IF_FAIL (evinfo->type >= 0 && (sizeof (evt_type) / sizeof (char*)));
- XDBG_REPLY ("[%10.3f][%5ld] %22s(%2d:%5d) %s %s",
+ REPLY ("[%10.3f][%5ld] %22s(%2d:%5d) %s %s",
evinfo->time / 1000.0,
evinfo->time - prev,
xDbgEvlogGetCmd (evinfo->client.command),
if (evinfo->type == REQUEST)
{
- XDBG_REPLY ("(");
+ REPLY ("(");
reply = xDbgEvlogReqeust (evinfo, reply, len);
- XDBG_REPLY (")");
+ REPLY (")");
}
else if (evinfo->type == EVENT)
{
- XDBG_REPLY ("(");
+ REPLY ("(");
reply = xDbgEvlogEvent (evinfo, reply, len);
- XDBG_REPLY (")");
+ REPLY (")");
}
else
{
evlog_name = evinfo->req.name;
else if (evinfo->type == EVENT)
evlog_name = evinfo->evt.name;
- XDBG_REPLY ("(%s)", evlog_name);
+ REPLY ("(%s)", evlog_name);
}
- XDBG_REPLY ("\n");
+ REPLY ("\n");
prev = evinfo->time;
}
case X_PutImage:
{
xPutImageReq *stuff = (xPutImageReq *)req;
- XDBG_REPLY (": XID(%lx) size(%dx%d) dst(%d,%d)",
+ REPLY (": XID(%lx) size(%dx%d) dst(%d,%d)",
stuff->drawable,
stuff->width,
stuff->height,
case X_ShmPutImage:
{
xShmPutImageReq *stuff = (xShmPutImageReq *)req;
- XDBG_REPLY (": XID(%lx) size(%dx%d) src(%d,%d %dx%d) dst(%d,%d)",
+ REPLY (": XID(%lx) size(%dx%d) src(%d,%d %dx%d) dst(%d,%d)",
stuff->drawable,
stuff->totalWidth,
stuff->totalHeight,
if (!_EvlogRequestGetExtentionEntry ())
return reply;
- XDBG_REPLY ("%s", req.name);
+ REPLY ("%s", req.name);
if (xReq->reqType < EXTENSION_BASE)
{
#define XDBG_GOTO_IF_FAIL(cond, dst) {if (!(cond)) { ErrorF ("[%s] '%s' failed.\n", __FUNCTION__, #cond); goto dst; }}
#define XDBG_GOTO_IF_ERRNO(cond, dst, errno) {if (!(cond)) { ErrorF ("[%s] '%s' failed. (err=%s(%d))\n", __FUNCTION__, #cond, strerror(errno), errno); goto dst; }}
+#define XDBG_REPLY(fmt, ARG...) \
+ do { \
+ if (reply && len && *len > 0) \
+ { \
+ int s = snprintf (reply, *len, fmt, ##ARG); \
+ reply += s; \
+ *len -= s; \
+ } \
+ } while (0)
+
unsigned int xDbgLogGetModule (char *name);
#define _C(b,s) (((b) >> (s)) & 0xFF)