int query_windows(){ string arch = lower_case(architecture()); #ifdef __WIN32__ return 1; #else if(grepp(arch,"windows") || grepp(arch,"cygwin")) return 1; #endif return 0; }
mixed compile_object(string file) { string *path; object ob; int x, y, z, elements; if(grepp(file, "/user_") || grepp(file, "/object_")){ ob = new("/domains/learning/virtual/void"); if(!ob){ return "No void room available."; } return ob; }
string query_os_type(){ string config_file, s1, s2, s3; if(function_exists("architecture",load_object("/secure/sefun/sefun"))){ string arch = lower_case(architecture()); if(grepp(arch,"windows") || grepp(arch,"cygwin")) return "windows"; else return "unix"; } if(!file_exists("/secure/cfg/mudos.cfg")) return "unknown"; config_file = read_matching_line("/secure/cfg/mudos.cfg","mudlib directory :"); if(!config_file) return ""; if(sscanf(config_file,"%s:%s:%s",s1,s2,s3) == 3){ return "windows"; } else return "unix"; }
void * listener() { signal(SIGINT,sighandler); sockfd=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP); if (sockfd == -1) { fprintf(stderr,"Cannot create socket on listener()\n"); exit(EXIT_FAILURE); } struct mesg_t *msg=malloc(sizeof(struct mesg_t)); memset(msg,0,sizeof(struct mesg_t)); struct sockaddr_in serv_addr, client_addr; // memset(&serv_addr,0,sizeof(serv_addr)); memset(&client_addr,0,sizeof(client_addr)); serv_addr.sin_family=AF_INET; serv_addr.sin_addr.s_addr=inet_addr("0.0.0.0"); serv_addr.sin_port=htons(SERVER_PORT); int rb=bind(sockfd,(struct sockaddr *)&serv_addr,sizeof(serv_addr)); if (rb<0) { fprintf(stderr,"Cannot bind socket on listener()\n"); exit(EXIT_FAILURE); } socklen_t sendsize=sizeof(client_addr); while (1) { int recl=recvfrom(sockfd,msg,sizeof(struct mesg_t),0,(struct sockaddr *)&client_addr,&sendsize); if (recl >= 0) { grepp(*msg,client_addr); } } return (void*)1; }
varargs int cmd(string str){ string tmp, thing, file, *inheriteds; object ob; if(!str || sscanf(str,"%s %s",file,thing) != 2){ write("Syntax: inherits FILE THING"); return 1; } ob = get_object(thing); if(!ob){ write("Sorry I can't find that thing."); return 1; } thing = (ob->GetShort() || thing); if(last(file,2) == ".c") file = truncate(file,2); tmp = DEFINES_D->GetDefine(file); if(tmp) file = tmp; write("Checking " + identify(ob) + " for inheritance of " + file + " , just a moment..."); if(file){ if(inherits(file, ob)){ write(thing+" inherits "+file+"."); return 1; } inheriteds = deep_inherit_list(ob); foreach(string item in inheriteds){ if(!grepp(item, file)) inheriteds -= ({ item }); } }
mixed cmd(string args){ if(args == "clear"){ write("Resetting the converter variables."); RELOAD_D->eventReload(this_object(),0); return 1; } if(grepp(args,"-r ")){ args = replace_string(args,"-r ",""); return this_object()->Report(args); } return this_object()->ConvertArea(args); }
string convert_name(string str) { string a, b, ret; if(!str || str == "") return ""; if(!grepp(str,"@")){ str = replace_string(str, " ", ""); str = replace_string(str, "'", ""); return lower_case(replace_string(str, "-", "")); } ret = INTERMUD_D->GetMudName(b); if(sscanf(str, "%s@%s", a, b) == 2 && ret) return a+"@"+ret; else return str; }
mixed eventFall(){ string rvoid = ROOMS_D->GetVoid(this_object()); object env = environment(); mixed rumbo = 0; mixed tmprumbo = 0; string name = this_object()->GetName(); if(!living(this_object())) name = this_object()->GetShort(); if(!env || !(rumbo = env->GetExit("down"))){ if(!sizeof((rumbo = env->GetSinkRoom()))){ return 0; } } if(env == rumbo){ return 0; } if(env->GetMedium() != MEDIUM_AIR){ send_messages("crash", "$agent_name $agent_verb down!", this_object(), 0, env); if(living(this_object())) this_object()->SetPosition(POSITION_LYING); return 1; } else { mixed err; if(!rumbo){ return 0; } tmprumbo = rumbo; if(stringp(rumbo)){ if(grepp(rumbo, "#")) err = "Let's not load a clone."; else err = catch(rumbo = load_object(rumbo)); } if(err || !rumbo){ log_file("runtime","\n"+timestamp()+" "+identify(this_object())+ " could not load "+identify(rumbo)+" to fall into.\n"); err = catch(rumbo = load_object(rvoid)); } if(err || !rumbo){ this_object()->eventMove(ROOM_START); return 0; } tell_object(this_object(),"You plummet downward!"); if(err = this_object()->eventMove(rumbo)){ tell_room(rumbo,capitalize(name)+" plummets in from above.", ({ this_object() }));
mixed cmd(string args) { string *lines; string buff, file, clone, base; int scr, ret; object ob; if( !args ) return "You must specify a file to destruct."; sscanf(args, "%s#%s", base, clone); if(clone){ ob = find_object(args); if(!ob){ write(args + " was not found."); return 1; } ret = ob->eventDestruct(); if(!ret || ob) destruct(ob); if(ob){ write("Failed to destruct "+args); return 1; } write(args + " destructed."); return 1; } file = absolute_path(this_player()->query_cwd(), args); if(!(ob = find_object(file)) && !grepp(args, "/")){ file = DEFINES_D->GetDefine(args); } if(!(ob = find_object(file))) return "Object " + args + " not found."; ret = ob->eventDestruct(); if(!ret || ob) destruct(ob); if(ob){ write(args + " could not be destructed."); } else { write(args + " destructed."); } return 1; }