1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
/*
* debug.c -- controll the values of x_debug.
*
* Written by Jeremy Nelson
* Copyright 1997 EPIC Software Labs
* See the COPYRIGHT file for more information
*/
#include "irc.h"
#include "struct.h"
#include "ircaux.h"
#include "output.h"
#include "misc.h"
unsigned long x_debug = 0;
struct debug_opts
{
char *command;
int flag;
};
static struct debug_opts opts[] =
{
{ "LOCAL_VARS", DEBUG_LOCAL_VARS },
{ "CTCPS", DEBUG_CTCPS },
{ "DCC_SEARCH", DEBUG_DCC_SEARCH },
{ "OUTBOUND", DEBUG_OUTBOUND },
{ "INBOUND", DEBUG_INBOUND },
{ "DCC_XMIT", DEBUG_DCC_XMIT },
{ "WAITS", DEBUG_WAITS },
{ "MEMORY", DEBUG_MEMORY },
{ "SERVER_CONNECT", DEBUG_SERVER_CONNECT },
{ "CRASH", DEBUG_CRASH },
{ "COLOR", DEBUG_COLOR },
{ "NOTIFY", DEBUG_NOTIFY },
{ "REGEX", DEBUG_REGEX },
{ "REGEX_DEBUG", DEBUG_REGEX_DEBUG },
{ "BROKEN_CLOCK", DEBUG_BROKEN_CLOCK },
{ "UNKNOWN", DEBUG_UNKNOWN },
{ "ALL", DEBUG_ALL },
{ NULL, 0 },
};
BUILT_IN_COMMAND(xdebugcmd)
{
int cnt;
int remove = 0;
char *this_arg;
if (!args || !*args)
{
char buffer[540];
char *q;
int i = 0;
buffer[0] = 0;
strmcat(buffer, "[-][+][option(s)] ", 511);
q = &buffer[strlen(buffer)];
for (i = 0; opts[i].command; i++)
{
if (q)
strmcat(q, ", ", 511);
strmcat(q, opts[i].command, 511);
}
userage("XDEBUG", buffer);
return;
}
while (args && *args)
{
this_arg = upper(next_arg(args, &args));
if (*this_arg == '-')
remove = 1, this_arg++;
else if (*this_arg == '+')
this_arg++;
for (cnt = 0; opts[cnt].command; cnt++)
{
if (!strncmp(this_arg, opts[cnt].command, strlen(this_arg)))
{
if (remove)
x_debug &= ~opts[cnt].flag;
else
x_debug |= opts[cnt].flag;
break;
}
}
if (!opts[cnt].command)
say("Unrecognized XDEBUG option '%s'", this_arg);
}
}
|