+/* tools.c - NeonServ v5.1
+ * Copyright (C) 2011 Philipp Kreil (pk910)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "tools.h"
#include "UserNode.h"
#include "ChanNode.h"
table->length = length;
table->width = width;
table->flags = flags;
- table->col_flags = calloc(length, sizeof(int));
+ table->col_flags = calloc(width, sizeof(int));
table->entrys = 0;
- table->maxwidth = calloc(length, sizeof(int));
+ table->maxwidth = calloc(width, sizeof(int));
table->table_lines = NULL;
return table;
}
if(!(table->col_flags[col] & TABLE_FLAG_COL_CONTENTS)) continue;
if(table->col_flags[col] & TABLE_FLAG_COL_BOLD)
table->table_lines[row][pos++] = '\002';
- for(i = 0; i < strlen(table->contents[row][col]); i++) {
- table->table_lines[row][pos++] = table->contents[row][col][i];
+ i = 0;
+ if(table->contents[row][col]) {
+ for(; i < strlen(table->contents[row][col]); i++) {
+ table->table_lines[row][pos++] = table->contents[row][col][i];
+ }
}
if(col < table->width-1) {
for(;i < table->maxwidth[col]; i++) {
char modeStr[MAXMODES+3];
int modePos = 0;
char paramStr[MAXLEN];
+ *paramStr = '\0';
int paramPos = 0;
int i;
if(modeBuf->addCount) {