/***************************************************** ** _________ __ ** ** \_ ___ \_____|__| _____ ________ ___ ** ** / \ \/_ __ \ |/ \/ ___/_ \/ \ ** ** \ \___| | \/ | | | \___ \ / ) | \ ** ** \______ /__| |__|__|_| /____ \__/__| / ** ** ____\/____ _ \/ ___ \/ \/ ** ** \______ \ |_____ __| _/___ ** ** | | _/ |\__ \/ __ | __ \ ** ** | | \ |_/ __ \ / | ___/_ ** ** |_____ /__/____ /_ /___ / ** ** \/Antipode\/ \/ \/ ** ****************************************************** ****************************************************** ** Copyright 2000-2003 Crimson Blade ** ****************************************************** ** Contributors: Noplex, Krowe, Emberlyna, Lanthos ** ******************************************************/ /* * Website: http://www.crimson-blade.org/ * File: changelog.c * Name: Player account module * Author: John 'Noplex' Bellone (jbellone@comcast.net) * Terms: * File may be modified or redistributed as long as the author is * contacted via email or other means. Description may be altered * to fit the needs. This header should be kept intact as it is * except for the option to alter the description. * Description: * One line appending change(s) log. */ /***************************************************************** ** PHP script (displays changes on web with number sequencing **** ****************************************************************** 0) { $j--; continue; } if(($i <= 9)) { if($bg == true) { $color = "#333333"; $bg = false; } else if($bg == false) { $color = "#000000"; $bg = true; } ?>
1
*****************************************************************/ #include #include #include #include "mud.h" #define CHANGES_FILE SYSTEM_DIR "changes.dat" void append_changes( CHAR_DATA *ch, char *str ); static char *timestamp(void); /* stamp that time! -Nopey */ static char *timestamp(void) { static char buf[MAX_STRING_LENGTH]; struct tm *t = localtime(¤t_time); sprintf( buf, "%04d-%02d-%02d", t->tm_year+1900, t->tm_mon+1, t->tm_mday ); return buf; } /* append changes to the changes.dat file inside /system/ -Nopey */ void append_changes( CHAR_DATA *ch, char *str ) { FILE *fp; if ( IS_NPC(ch) || str[0] == '\0' ) return; if ( ( fp = fopen( CHANGES_FILE, "a" ) ) == NULL ) { perror( CHANGES_FILE ); send_to_char( "Could not open the file!\n\r", ch ); } else { fprintf( fp, "[ %s ] %s: %s\n", timestamp(), capitalize(ch->name), str ); FCLOSE( fp ); } return; } /* The changes function :o -Nopey */ void do_changes(CHAR_DATA *ch, char *argument) { if(IS_NPC(ch)) { send_to_char("Huh?\n\r", ch); return; } if(*argument == '\0' || !argument || !IS_IMMORTAL(ch)) { set_char_color(AT_WHITE, ch); show_file(ch, CHANGES_FILE); return; } else if(IS_IMMORTAL(ch)) { append_changes(ch, argument); send_to_char("Changes log appended.\n\r", ch); return; } }