Fixed bug with unallowed characters
[ArenaLive.git] / common.c
blob46ec3f746fa809b1a9e03453984e90439f6c3446
1 /*
2 * (C) Copyright 2009 ZeXx86 (zexx86@gmail.com)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 * Based on GLugin http://exa.czweb.org/repos/glugin.tar.bz2
19 * Big thanks for "exa"
23 #include <stdio.h>
24 #include <ctype.h>
25 #include <stdarg.h>
27 void Log (const char *c, ...)
29 #ifdef ENABLE_LOG
30 va_list al;
32 FILE *f = fopen ("~/glugin.log", "a");
34 if (!f)
35 return;
37 va_start (al, c);
38 vfprintf (f, c, al);
39 va_end (al);
41 fputc ('\n', f);
42 fclose (f);
43 #endif
46 /* replace unallowed characters with space */
47 void conparam_verify (char *str, unsigned len)
49 unsigned i;
50 for (i = 0; i < len; i ++) {
51 if (str[i] == '$' || str[i] == '(' || str[i] == ')' || str[i] == ';' || str[i] == '|' || str[i] == '<' || str[i] == '>')
52 str[i] = ' ';