int main(string arg) { string status; int time; status = SHUTDOWN_D->getStatus(); if(!adminp(previous_object())) return notify_fail("Error [shutdown]: Access denied.\n"); if(!arg) { if(status) write("Shutdown: " + status); else write("There is no shutdown or reboot currently in progress.\n"); return 1; } if(arg == "stop") { if(!status) return notify_fail("Error: There is no shutdown or reboot currently in progress.\n"); else SHUTDOWN_D->stop(); log_file(LOG_SHUTDOWN, capitalize(this_player()->query_name()) + " canceled the sequence (" + time + "m) on " + ctime(time()) + "\n"); return 1; } else { if(arg == "now") time = 0; else time = to_int(arg); if(time == 0 && arg != "now" && arg != "0") return notify_fail("SYNTAX: shutdown [<stop>||<time>/now]\n"); log_file(LOG_SHUTDOWN, capitalize(this_player()->query_name()) + " started shutdown sequence (" + time + "m) on " + ctime(time()) + "\n"); SHUTDOWN_D->start(time, 1); return 1; } }
int jump(object watcher) { int num = 1 + random(10); if( environment(watcher)!=this_object()) return 1; if(!watcher->query_temp("foguang")) return 1;//没有嘛,就return好了 if (watcher->query("cps") < 10) { message("vision", "\n你身不由己纵身往崖下跳去!\n", watcher); message("vision","\n" + watcher->name() + "神色一片迷茫,纵身往崖下跳去!\n", this_object(), watcher); watcher->set("宿命B/黄山_佛光", num); log_file("riddle/FATE_LOG", sprintf("%s(%s) 得到"+FATEMARK+" "+num+"。 %s \n", watcher->name(1), geteuid(watcher), ctime(time()) )); watcher->start_busy(4); if(random(watcher->query("kar"))>10) call_out("bird", 2, watcher); else { watcher->set_temp("last_damage_from","在黄山坠崖身死。\n"); watcher->die(); } } else { message("vision", "\n一阵山风吹来,你神志略微清醒,距离悬崖一不到一步之遥,不远处的五彩光环似乎\n", watcher); message("vision", "在引诱你往那里走。你可以选择跳或不跳。(jump)\n", watcher); message("vision", "\n一阵山风吹来," + watcher->name() + "神志清醒了过来。\n", this_object(), watcher); watcher->set_temp("佛光跳崖", 1); log_file("riddle/FATE_LOG", sprintf("%s(%s) 得到"+FATEMARK+" "+num+"。 %s \n", watcher->name(1), geteuid(watcher), ctime(time()) )); } watcher->delete_temp("foguang"); }
void event_evening() { object area,who; mixed file,dir; int amount,i; dir=get_dir("/data/city/"); if(!dir) return; for(i=0;i<sizeof(dir);i++) if( sscanf(dir[i], "%s.o", file) ) { area=new("/obj/area1.c"); area->create(file); if(area->query("no_use")) { destruct(area); continue; } if(area->query("owner")) { amount=area->query("people")*(area->query("farm")+area->query("trade"))*area->query("tax")/1000; if(amount <=0) return; who=find_player(area->query("owner")); if(who) { who->add("balance",amount); if(!who->save()) { log_file("city_log","Failed to return "+amount+ " coin to "+area->query("owner")+"\n"); return; } log_file("city_log","pay "+amount+" to "+area->query("owner")+"\n"); tell_object(who,area->query("short")+"税收"+MONEY_D->money_str(amount)+",已经存入你的户头。\n"); } else { who=new(USER_OB); who->set("id",area->query("owner")); if(!who->restore()) { log_file("city_log","Failed to return "+amount+ " coin to "+area->query("owner")+"\n"); destruct(who); return; } else { who->add("balance",amount); if(!who->save(1)) { // save(1) will not erase autoload. log_file("city_log","Failed to return "+amount+ " coin to "+area->query("owner")+"\n"); destruct(who); return; } log_file("city_log","pay "+amount+" to "+area->query("owner")+"\n"); destruct(who); } } } }
static void logSource(FILE *outFile) { log_file(outFile, lastLine.file1, lastLine.nr1); if (lastLine.nr2) { log(outFile, "| ---- [%u] ----\n", lastLine.nr2); log_file(outFile, lastLine.file2, lastLine.nr2); } }
// This is called when there is a driver segmentation fault or a bus error, // etc. As it's static it can't be called by anything but the driver (and // master). static void crash(string error, object command_giver, object current_object) { efun::shout("风云核心发生系统错误!\n"); efun::shout("重新启动风云系统。\n"); log_file("static/CRASHES", MUD_NAME + " crashed on: " + ctime(time()) + ", error: " + error + "\n"); if (command_giver) log_file("static/CRASHES", sprintf( "this_player: %O\n", command_giver)); if (current_object) log_file("static/CRASHES", sprintf( "this_object: %O\n", current_object)); }
// This is called when there is a driver segmentation fault or a bus error, // etc. As it's static it can't be called by anything but the driver (and // master). static void crash(string error, object command_giver, object current_object) { efun::shout("系统核心发出一声惨叫:哇─哩─咧─\n"); efun::shout("系统核心告诉你:要当机了,自己保重吧!\n"); log_file("static/CRASHES", MUD_NAME + " crashed on: " + ctime(time()) + ", error: " + error + "\n"); if (command_giver) log_file("static/CRASHES", sprintf( "this_player: %O\n", command_giver)); if (current_object) log_file("static/CRASHES", sprintf( "this_object: %O\n", current_object)); }
void Log::new_log_file(const std::time_t& current) { if(file_) { file_->close(); // Gzip log file utils::System("gzip " + log_file(interval_)); delete file_; } interval_ = current; file_ = new std::ofstream(log_file(interval_)); }
int main(object me, string arg) { int i; string direc,*dir, roomname; string status; object room; if(!me->query("env/yesiknow")) return notify_fail("╒т╕Ў╓╕┴ю╥╤╛н▒╗╖╧│¤┴╦гб\n"); status = wizhood(me); if( me!=this_player(1) || wiz_level(me) < wiz_level(status) ) return notify_fail("─у├╗╙╨╚и┴ж╩╣╙├╒т╕Ў╓╕┴юбг\n"); if( !arg ) return notify_fail(SYNTAX); if( sscanf(arg, "%s", direc)!=1 ) return notify_fail(SYNTAX); seteuid(getuid()); dir = get_dir(arg+"/"); for(i=0; i<sizeof(dir); i++) { if( sscanf(dir[i],"%s.c", roomname) != 1) continue; if( room = find_object(arg+"/"+roomname+".c")) destruct(room); room = load_object(arg+"/"+roomname+".c"); if(!room->query("coor")) log_file("LEAK",sprintf("%s/%s\n",arg,roomname)); } return 1; }
int main(int argc, char **argv) { byte buf[1024], *c; log_init("logger"); if (argc < 3 || argc > 4 || strlen(argv[2]) != 1) die("Usage: logger [<logname>:]<progname> <level> [<text>]"); if (c = strchr(argv[1], ':')) { *c++ = 0; log_init(c); log_file(argv[1]); } else log_init(argv[1]); uns level = 0; while (level < L_MAX && LS_LEVEL_LETTER(level) != argv[2][0]) level++; if (level >= L_MAX) die("Unknown logging level `%s'", argv[2]); if (argc > 3) msg(level, argv[3]); else while (fgets(buf, sizeof(buf), stdin)) { c = strchr(buf, '\n'); if (c) *c = 0; msg(level, buf); } return 0; }
int main(object me, string arg) { object ob; me=this_player(); seteuid(geteuid(me)); if( !arg ) { if( objectp(ob = query_snooping(me)) ) write("你现在正在监听" + ob->query("name") + "所收到的讯息。\n"); return 1; } else if( arg=="none" ) { if( objectp(ob = query_snooping(me))) message_vision (HIW + "$N停止监听$n所收到的讯息。\n"+ NOR,me,ob); snoop(me,); write("Ok.\n"); return 1; } ob = find_player(arg); if (!ob) ob = find_player(arg); if(!ob || (!ob->visible(ob))) return notify_fail("没有这个人。\n"); if (!interactive(ob)) return notify_fail("不能监听断线中的使用者所收到的讯息。\n"); if(wizhood(ob)=="(admin)"||wizhood(ob)=="(manager)") return notify_fail("你不能窃听大神。\n"); if( me==ob ) return notify_fail("请用 snoop none 解除监听。\n"); snoop(me, ob); if( userp(ob) ) log_file("SNOOP_PLAYER", sprintf("%s(%s) snoops %s on %s.\n", me->name(1), geteuid(me), ob->name(1), ctime(time()) ) ); write (HIW"你开始监听"+ob->name()+"所收到的讯息。\n" + NOR); tell_object(ob, HIW + me->name(1) + "开始监听你所收到的讯息。\n" + NOR); return 1; }
void restore_autoload() { int i; object ob; string file, param, err; if(!pointerp(autoload)) { return; } for(i=0; i<sizeof(autoload); i++) { if( sscanf(autoload[i], "%s:%s", file, param)!=2 ) { file = autoload[i]; param = 0; } err = catch(ob = new(file)); if( err || !objectp(ob) ) { write("你觉得似乎失落了什麽重要的东西,最好通知一下巫师。\n"); log_file("AUTOLOAD", sprintf("Fail to autoload %s of %s, error %s\n", file, this_object()->query("name"), err)); continue; } export_uid(ob); ob->move(this_object()); ob->autoload(param); } clean_up_autoload(); // To save memory. }
void skill_improved(object me) { //if stage increased, give bonus...? int level = (int)me->query_skill("ningxie-force", 1); if ( stage(level) == stage(level-1) + 1) { //this is to prevent ppls from abondoning skill to get bonus. if( (int)me->query("nx-force_bonus") < stage(level) ) { me->set("nx-force_bonus", stage(level)); // me->set("max_force", (int)me->query("max_force") + stage(level)*50 ); // mon 12/13/98 me->set("maximum_force", (int)me->query("maximum_force") + stage(level)*50 ); me->save(); log_file("ningxie-force-bonus", ctime( time() )+": " +me->query("name")+"("+me->query("id")+")" +" got neili "+(stage(level)*50)+".\n"); message_vision(HIW "$N突然觉得真气冲顶,飘然欲飞。原来是$N的冰谷凝血功进入了第"+chinese_number(stage(level))+"重境界!\n" NOR, me); } } }
/* Start logging */ static void open_log_file(GapIO *io, char *fn) { char log_buf[1024]; char *user; char *logfn; struct passwd *pw; int uid = getuid(); size_t name_len = strlen(fn); pw = getpwuid(uid); user = pw ? pw->pw_name : "unknown"; snprintf(log_buf, sizeof(log_buf), "opening %s r%c by %s(%d)", fn, io->read_only ? 'o' : 'w', user, uid); logfn = malloc(name_len + 5); if (NULL != logfn) { memcpy(logfn, fn, name_len + 1); if (0 == strcmp(logfn + name_len - 4, ".g5d") || 0 == strcmp(logfn + name_len - 4, ".g5x")) { /* chop off suffix */ name_len -= 4; } strcpy(logfn + name_len, ".log"); log_file(logfn, log_buf); free(logfn); } }
void sure_to_suicide(string pa) { // mixed er; string pass, str; object ob; if(((pass = (string)this_player()->query_password()) != oldcrypt(pa, pass)) && ((string)this_player()->query_password() != crypt(pa, pass))) { message("info", "Suicide failed.", this_player()); return 0; } ob = this_player(); str = (string)ob->query_name(); if (!str) return; message("info", "You terminate your existance on Primal Darkness.",ob); CHAT_D->do_raw_chat("system", "Suicide <system> "+this_player()->query_name()+" suicided."); seteuid(UID_LOG); log_file("suicide", "[ " + ctime(time()) + " ] " + capitalize(str) + " suicided from IP: " + ob->query_ip() + "\n"); seteuid(getuid()); seteuid(UID_USERSAVE); rename(DIR_USERS+"/"+str[0..0]+"/"+str+".o",DIR_USERS+"/rid/"+str+".o"); seteuid(geteuid()); IDENTITY_D->manage_identity(0, this_player(), "deleting"); MSQL_D->msql_delete_player("pd", "player_t", (string)ob->query_name()); BANK_D->remove_all_bank_accounts((string)ob->query_name()); if(file_exists("/adm/save/boats/"+(string)ob->query_name()+".o")) rm("/adm/save/boats/"+(string)ob->query_name()+".o"); ob->remove(); if (ob) destruct(ob); return; }
void HKWindow::logProgress(ProgressType progress_type, QString message) { QString final_message = QTime::currentTime().toString() + ": "; QString log_file_message = final_message + message; switch (progress_type) { case ProgressNormal: final_message += QString("<font color=\"White\">LOG: " + message + "</font>"); break; case ProgressSuccess: final_message += QString("<font color=\"Green\">SUCCESS: " + message + "</font>"); break; case ProgressError: final_message += QString("<font color=\"DarkOrange\">ERROR: " + message + "</font>"); break; case ProgressWarning: final_message += QString("<font color=\"Gold\">WARNING: " + message + "</font>"); break; case ProgressFatal: final_message += QString("<font color=\"Red\">ERROR: " + message + "</font>"); break; } te_progress->appendHtml(final_message); te_progress->verticalScrollBar()->setValue(te_progress->verticalScrollBar()->maximum()); // Log to file as well QFile log_file(LogPath); log_file.open(QIODevice::WriteOnly | QIODevice::Append); QTextStream stream(&log_file); stream << log_file_message << endl << flush; QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents); }
//---------------------------------------------------------------------------------------------------------------------- // init_logfile //---------------------------------------------------------------------------------------------------------------------- static bool init_logfile() { VOGL_FUNC_TRACER dynamic_string log_file(g_command_line_params().get_value_as_string_or_empty("logfile")); dynamic_string log_file_append(g_command_line_params().get_value_as_string_or_empty("logfile_append")); if (log_file.is_empty() && log_file_append.is_empty()) return true; dynamic_string filename(log_file_append.is_empty() ? log_file : log_file_append); // This purposely leaks, don't care g_vogl_pLog_stream = vogl_new(cfile_stream); if (!g_vogl_pLog_stream->open(filename.get_ptr(), cDataStreamWritable, !log_file_append.is_empty())) { vogl_error_printf("%s: Failed opening log file \"%s\"\n", VOGL_FUNCTION_NAME, filename.get_ptr()); return false; } else { vogl_message_printf("Opened log file \"%s\"\n", filename.get_ptr()); console::set_log_stream(g_vogl_pLog_stream); } return true; }
int cmd_call( string a ) { string str, *exp_a; mixed objs, funcs, args, tmp, ret, rets; object ob; int i, s, fi, fs; if( !a ) { notify_fail( SYNTAX ); return 0; } if((string)previous_object()->query_position() == "ambassador") return 0; seteuid( geteuid( previous_object() ) ); // In general logging calls is a bad idea since the effect can be duplicated // very easily by eval or by an object in the wizards directory // *shrug* Nightmare wanted it however, so I've #ifdef'ed it. #ifdef THIS_MUD if( THIS_MUD == "nightmare" ) { log_file( "calls", this_player()-> query_name() + " under euid " + geteuid() + " " + ctime( time() ) + "\n" + a + "\n" ); } #endif /* THIS_MUD */ exp_a = explode( a, ";" ); s = sizeof( exp_a ); objs = exp_a[0]; if( s > 1 ) funcs = exp_a[1]; else funcs = FUNC_LIST; if( s == 3 ) args = ({ exp_a[2] });
int main(object me, string arg) { object ob; mapping my; if (! SECURITY_D->valid_grant(me, "(immortal)")) return 0; seteuid(getuid(me)); if (! arg) ob = me; else { ob = present(arg, environment(me)); if (! ob) ob = find_player(arg); if (! ob) ob = find_living(arg); } if (! ob) return notify_fail("你要恢复谁的状态?\n"); if (ob != me) { if (wiz_level(me) < wiz_level("(wizard)")) return notify_fail("你没有权限恢复" + ob->name() + "。\n"); if (! me->is_admin()) message_system(sprintf("%s(%s)为%s(%s)恢复了状态。\n", me->name(1), me->query("id"), ob->name(1), ob->query("id"))); } my = ob->query_entire_dbase(); my["jing"] = my["eff_jing"] = my["max_jing"]; my["jingli"] = my["eff_jingli"] = my["max_jingli"]; my["qi"] = my["eff_qi"] = my["max_qi"]; my["neili"] = my["max_neili"]; my["food"] = ob->max_food_capacity(); my["water"] = ob->max_water_capacity(); if (me == ob) { message_vision(HIY "$N" HIY "口中念念有词,不一会儿就变得" "精神焕发,神采奕奕。\n" NOR, me); if (me->is_ghost()) me->reincarnate(); me->clear_condition(); } else { message_vision(HIY "$N" HIY "伸手一指,$n" HIY "立刻精神焕" "发,神采奕奕。\n" NOR, me, ob); if (! living(ob)) ob->revive(); if (ob->is_ghost()) ob->reincarnate(); ob->clear_condition(); log_file("static/recover", sprintf("%s %s recover %s(%s)\n", log_time(), log_id(me), ob->name(1), ob->query("id"))); } return 1; }
void vmessage_tagged(const char *tag, const char *fmt, ...) { char buf[8192], *bufp = buf; int len; va_list args; va_start(args, fmt); /* Use static buffer for small output */ if ((len = vflen(fmt, args)) > 8192) { if (NULL == (bufp = (char *)xmalloc(len))) { verror(ERR_FATAL, "vmessage", "out of memory"); return; } } vsprintf(bufp, fmt, args); if (log_vmessage_st) log_file(NULL, bufp); tout_update_stream(1, bufp, 0, tag); va_end(args); if (bufp != buf) { xfree(bufp); } }
int main(object me, string file) { seteuid(geteuid(me)); write("rmdir 命令 v0.1 \nWrite By Lxh@Xxy\n"+ "邮件:[email protected]\n"); if (!file) return notify_fail("你要删除那个档案?\n"); file=resolve_path(me->query("cwd"),file); log_file("cmds/xrm.log", sprintf("%s(%s) 删除 %s on %s\n", me->name(1), //记录使用命令的人名 geteuid(me), //记录使用命令的ID file, //记录删除的文件路径 ctime(time()) ) ); //记录使用命令的时间 flag=0; switch(file_size(file)) { case -1: write("对不起,你无权删除这个目录(或文件)。\n"); break; case -2: write("删除目录(文件)中...\n"); if(rmDir(file)==0) write("删除失败。\n"); else write("删除成功。\n"); break; default: if(rm(file) ) write("删除完成。\n"); else write("你没有删除这个档案的权利。\n"); } return 1; }
void log_user(char *msg) { char filename[200]; sprintf(filename, BBSHOME "/home/%c/%s/USERLOG", cuser.userid[0], cuser.userid); log_file(filename, msg); }
int main(object me, string arg) { string name, reason; string status; int day; status = wizhood(me); if( me!=this_player(1) || wiz_level(me) < wiz_level(status) ) return notify_fail("你没有权力使用这个指令。\n"); if( !arg ) return notify_fail(SYNTAX); if( sscanf(arg, "%d", day) && day >= 0) return do_purge_players(day); if( sscanf(arg, "%s because %s", name, reason)!=2 ) return notify_fail(SYNTAX); seteuid(getuid()); if( file_size(DATA_DIR + "login/" + name[0..0] + "/" + name + SAVE_EXTENSION)<0 ) return notify_fail("没有这位使用者。\n"); rm(DATA_DIR + "login/" + name[0..0] + "/" + name + SAVE_EXTENSION); rm(DATA_DIR + "user/" + name[0..0] + "/" + name + SAVE_EXTENSION); write( "使用者 " + capitalize(name) + " 删除掉了。\n"); log_file("static/PURGE", sprintf("[%s] %s purged %s because %s.\n", ctime(time())[0..15], geteuid(this_player(1)), name, reason)); return 1; }
void restore_autoload() { int i; object ob; string file, *autodir, param, err; if( !pointerp(autoload) ) return; for(i=0; i<sizeof(autoload); i++) { printf ("autoload %d = %s\n", i+1, autoload[i]); if( sscanf(autoload[i], "%s:%s", file, param)!=2 ) { file = autoload[i]; param = 0; } autodir = explode (file, "/"); #ifndef SAVEEQ if (autodir[0] != "obj" && (autodir[0] != "data" || autodir[1] != "autoload")) { write ("你有一个自动载入的物件没放在该放的地方:"+file+"\n"); continue; } #endif err = catch(ob = new(file)); if( err || !ob ) { write("你觉得似乎失落了什么重要的东西,最好通知一下巫师。\n"); log_file("AUTOLOAD", sprintf("Fail to autoload %s of %s, error %s\n", file, this_object()->query("name"), err)); continue; } export_uid(ob); ob->move(this_object()); ob->autoload(param); } clean_up_autoload(); // To save memory. }
void report_system_object_msg (object ob, string msg) { CHANNEL_D->do_channel(this_object(), "sys", ob->name() + "(" + capitalize(ob->query("id")) + ")" + msg); log_file("monitord","["+ctime(time())+"] "+ ob->name()+"("+capitalize(ob->query("id"))+")"+msg+"\n"); }
int cmd_economy(string str) { string type, key; float rate, infl, wt; if(!str) { message("info", "Currency what?", this_player()); return 1; } if(!archp(this_player())) return 0; if(member_group(geteuid(previous_object()), "approval") == 0) { message("info", "You do not have access to this..",this_player()); return 1; } seteuid(UID_LOG); log_file("economy", geteuid(previous_object())+": "+str+" ("+ctime(time())+")\n"); seteuid(getuid()); if(sscanf(str, "add %s %f %f %f", type, rate, infl, wt) == 4) { seteuid(UID_APPROVAL); ECONOMY_D->add_currency(type, rate, infl, wt); seteuid(getuid()); message("info", "Currency "+type+" added!", this_player()); } else if(sscanf(str, "change %s for %s to %f", key, type, wt) == 3) { seteuid(UID_APPROVAL); ECONOMY_D->change_currency(type, key, wt); seteuid(getuid()); message("info", "Changed: "+key+" for "+type+" to "+wt, this_player()); } else return 0; return 1; }
object restore_data(string name) { object link; if (find_player(name) && interactive(find_player(name))) { return (object)find_player(name)->query_link(); } link = new(CONNECTION); seteuid(name); export_uid(link); seteuid(ROOT_UID); link->set("name", name); if (link->restore()) { return link; } // If this fails, then let's clean up afterwards... link->remove(); // Some names like .foo weren't getting away. if(link) destruct(link); if(link) log_file("fingerdest",sprintf("Connection of %s not dested"+ " by finger daemon, on %s.\n", name, ctime(time()))); return 0; }
void update_ads_phase() { int i; int ads_count = 0; object* all; remove_call_out("update_ads_phase"); if(current_ads_phase==0) { init_ads_phase(); } current_ads_phase = (++current_ads_phase) % sizeof(ads_phase); message("channel:ads", "【广告】" + ads_phase[current_ads_phase]["time_msg"] + "\n", users()); all = users(); for(i=0;i<sizeof(all);i++) { if( member_array("ads", all[i]->query("channels"))==-1 ) continue; else ads_count++; } if(ads_count >=1) { // message( "channel:wiz", sprintf("【巫师】%d 个玩家接收此广告。\n", ads_count), users()); log_file("ADS", sprintf("[%s] \"" + ads_phase[current_ads_phase]["time_msg"] + "\" 被 [%d] 个玩家接收\n", ctime(time()), ads_count)); } this_object()->event_common(); call_out("update_ads_phase", ads_phase[current_ads_phase]["length"]); }
mixed cmd(string str) { if(!TP->query_creator() && !TP->query_property("emoteall")) { return notify_fail(NOT_ALLOWED); } if(!str || str == "") { return notify_fail("Syntax : emoteall <string>\n"); } if(!TP->query_creator() && TP->adjust_sp(-EMOTEALL_COST*((strlen(str)/10)+1)+100) < 0) { return notify_fail(NO_POWER); } str = replace(str, BEEP, ""); if (TP->query_volume(D_ALCOHOL)) { str = TP->drunk_speech(str); } log_file("ECHOS", ctime(time())+" "+TP->query_name()+" emotes "+ "to all: "+str+"\n"); str += "%^RESET%^"; my_mess("You emoteall : ", TP->query_cap_name()+" " + str); TP->comm_event(users(), "player_emote_all", "%^BOLD%^%^RED%^" + TP->query_cap_name() + " " + str + "\n"); return 1; }
/* * Set up a log for storing io patterns. */ static int init_iolog_write(struct thread_data *td) { struct fio_file *ff; FILE *f; unsigned int i; f = fopen(td->o.write_iolog_file, "a"); if (!f) { perror("fopen write iolog"); return 1; } /* * That's it for writing, setup a log buffer and we're done. */ td->iolog_f = f; td->iolog_buf = malloc(8192); setvbuf(f, td->iolog_buf, _IOFBF, 8192); /* * write our version line */ if (fprintf(f, "%s\n", iolog_ver2) < 0) { perror("iolog init\n"); return 1; } /* * add all known files */ for_each_file(td, ff, i) log_file(td, ff, FIO_LOG_ADD_FILE); return 0; }
/* * Function name: bad_object * Description: Dispose of bad objects * Arguments: obj - The object. * logfile - Where to log the event. * logmess - What to log. */ static void bad_object(object obj, string logfile, string logmess) { write("The " + obj->query_name() + " dissolves in a puff of black smoke!\n"); log_file(logfile, logmess); obj->remove_object(); }