Added new IBT system for Ideas, Bugs and Typos (thanks Frenze)

This commit is contained in:
JamDog 2009-10-24 13:34:21 +00:00
parent baf644d031
commit 71fbf510ba
14 changed files with 389 additions and 121 deletions

View file

@ -684,71 +684,6 @@ ACMD(do_display)
send_to_char(ch, "%s", CONFIG_OK);
}
ACMD(do_gen_write)
{
FILE *fl;
char *tmp;
const char *filename;
struct stat fbuf;
time_t ct;
switch (subcmd) {
case SCMD_BUG:
filename = BUG_FILE;
break;
case SCMD_TYPO:
filename = TYPO_FILE;
break;
case SCMD_IDEA:
filename = IDEA_FILE;
break;
default:
return;
}
ct = time(0);
tmp = asctime(localtime(&ct));
if (IS_NPC(ch)) {
send_to_char(ch, "Monsters can't have ideas - Go away.\r\n");
return;
}
skip_spaces(&argument);
delete_doubledollar(argument);
if (!*argument) {
send_to_char(ch, "That must be a mistake...\r\n");
return;
}
mudlog(NRM, LVL_GOD, FALSE, "%s %s: %s", GET_NAME(ch), CMD_NAME, argument);
if (stat(filename, &fbuf) < 0) {
perror("SYSERR: Can't stat() file");
/* SYSERR_DESC: This is from do_gen_write() and indicates that it cannot
* call the stat() system call on the file required. The error string at
* the end of the line should explain what the problem is. */
return;
}
if (fbuf.st_size >= CONFIG_MAX_FILESIZE) {
send_to_char(ch, "Sorry, the file is full right now.. try again later.\r\n");
return;
}
if (!(fl = fopen(filename, "a"))) {
perror("SYSERR: do_gen_write");
/* SYSERR_DESC: This is from do_gen_write(), and will be output if the file
* in question cannot be opened for appending to. The error string at the
* end of the line should explain what the problem is. */
send_to_char(ch, "Could not open the file. Sorry.\r\n");
return;
}
fprintf(fl, "%-8s (%6.6s) [%5d] %s\n", GET_NAME(ch), (tmp + 4),
GET_ROOM_VNUM(IN_ROOM(ch)), argument);
fclose(fl);
send_to_char(ch, "Okay. Thanks!\r\n");
}
#define TOG_OFF 0
#define TOG_ON 1
ACMD(do_gen_tog)