2 * IRC - Internet Relay Chat, common/support.c
3 * Copyright (C) 1990, 1991 Armin Gruner
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 1, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include "ircd_chattr.h"
28 #include "sprintf_irc.h"
31 #include <signal.h> /* kill */
40 void dumpcore(const char *pattern, ...)
43 static time_t lastd = 0;
49 va_start(vl, pattern);
55 else if (now - lastd < 60 && dumps > 2)
56 server_die("too many core dumps");
70 sprintf_irc(corename, "core.%d", p);
71 rename("core", corename);
72 Debug((DEBUG_FATAL, "Dumped core : core.%d", p));
73 sendto_ops("Dumped core : core.%d", p);
74 vdebug(DEBUG_FATAL, pattern, vl);
75 vsendto_ops(pattern, vl);
78 server_die("debug core dump");
83 int check_if_ipmask(const char *mask)
88 for (p = mask; *p; ++p)
89 if (*p != '*' && *p != '?' && *p != '.')
99 /* Moved from logf() in whocmds.c to here. Modified a
100 * bit and used for most logging now.
101 * -Ghostwolf 12-Jul-99
104 extern void write_log(const char *filename, const char *pattern, ...)
108 static char logbuf[1024];
110 logfile = fbopen(filename, "a");
114 va_start(vl, pattern);
115 vsprintf_irc(logbuf, pattern, vl);
118 fbputs(logbuf, logfile);