toolcmd.c-Dateireferenz

#include "tool.h"
Include-Abhängigkeitsdiagramm für toolcmd.c:
Dieser Graph zeigt, welche Datei direkt oder indirekt diese Datei enthält:

gehe zum Quellcode dieser Datei

Funktionen

int Xcall (string str)
int Xcallouts (string str)
int Xcat (string str)
int Xcd (string str)
int Xclean (string str)
int Xclone (string str)
int Xuclone (string str)
int Xcmds (string str)
int Xdbg (string str)
int Xdclean (string str)
int Xddes (string str)
int Xdes (string str)
int Xdlook (string str)
int Xdo (string str)
int Xdupdate (string str)
int Xecho (string str)
int Xeval (string str)
int Xforall (string str)
int Xgoto (string str)
int Xgrep (string str)
int Xhbeats (string str)
int Xhead (string str)
int Xhelp (string str)
int Xids (string str)
int Xinfo (string str)
int Xinherit (string str)
int Xinventory (string str)
int Xlag (string str)
int Xlight (string str)
int Xload (string str)
int Xlook (string str)
int Xlpc (string str)
int Xman (string str)
int Xmore (string str)
int Xmove (string str)
int Xmsg (string str)
int Xmtp (string str)
int Xproc (string str)
int Xprof (string str)
int Xprops (string str)
int Xquit (string str)
int Xscan (string str)
int Xset (string str)
int Xsh (string str)
int Xsort (string str)
int Xtail (string str)
int Xtool (string str)
int Xtrace (string str)
int Xtrans (string str)
int Xupdate (string str)
int Xuptime (string str)
int Xwc (string str)
int cmdavg_compare (string a, string b)
int Xwho (string opt)

Dokumentation der Funktionen

int cmdavg_compare ( string  a,
string  b 
)

Definiert in Zeile 1982 der Datei toolcmd.c.

Benutzt x.

01983 {
01984   int x,y;
01985   string dum;
01986   sscanf(a,"%s cmdavg: %d",dum,x);
01987   sscanf(b,"%s cmdavg: %d",dum,y);
01988   return x==y?0:(x>y?1:-1);
01989 }

int Xcall ( string  str  ) 

Definiert in Zeile 17 der Datei toolcmd.c.

Benutzt cloner, ctime(), Destruct(), ENV, ERR_FILE, error(), FALSE, file(), LPC_FILE, MAX_RECURSION, mixed_to_string(), PIPE_DELETE, pipe_of, pipe_out, PRIVATE_HEADER, rusage(), SECURE2, TK(), TOOL_LOG, TRUE, USAGE2, variable, W, WDLN, WLN und XFindObj().

00018 {
00019   object obj, callobj;
00020   string file, callstr, callfun, callexpr, error, errlog;
00021   int *ru1, *ru2, xtime;
00022   mixed res;
00023   
00024   SECURE2(TRUE);
00025   USAGE2(str, "xcall <object>-><function>(<arguments>)");
00026   TK("Xcall: str: "+(str?str:"(NULL)"));
00027   if(sscanf(str, "%s->%s(%s", callstr, callfun, callexpr)!=3)
00028     return FALSE;
00029   if(!(callobj=XFindObj(callstr)))
00030     return TRUE;
00031   else
00032   {
00033 #if 0
00034     write_file(TOOL_LOG,
00035                        sprintf("%s (%s) xcall %s (env: %s)\n",ctime(time()),
00036                                        getuid(cloner),str,object_name(environment(cloner))));
00037 #endif
00038     file=LPC_FILE+".c";
00039     if(file_size(file)>0)
00040       rm(file);
00041     if(obj=find_object(LPC_FILE))
00042       Destruct(obj);
00043     obj=0;
00044     write_file(file,
00045                        "#include <properties.h>\n"+
00046                        "#include <thing/properties.h>\n"+
00047                        "#include <defines.h>\n"+
00048                        "#include <wizlist.h>\n"+
00049                        "#include <moving.h>\n"+
00050                        "#include \"/secure/wizlevels.h\"\n"+
00051                        (file_size(PRIVATE_HEADER)>=0?"#include \""+PRIVATE_HEADER+"\"\n":"")+
00052                        "mixed get(string str){return previous_object()->XFindObj(str);}\n"+
00053                        "mixed eval(object obj,mixed me,mixed here){return obj->"+callfun+"("+callexpr+";}\n");
00054     errlog = ERR_FILE;
00055     if(file_size(errlog)>0)
00056       rm(errlog);
00057     if(error=catch((LPC_FILE)->__nixgibts__()))
00058       W("Error: "+error[1..]);
00059     else
00060     {
00061       obj=find_object(LPC_FILE);
00062       ru1=rusage();
00063       error=catch(res=(mixed)obj->eval(callobj, cloner, ENV(cloner)));
00064       ru2=rusage();
00065       if(error)
00066                 W("Error: "+error[1..]);
00067       else
00068       {
00069                 xtime=ru2[0]-ru1[0]+ru2[1]-ru1[1];
00070                 WDLN("Evaluation time: "+(xtime<0 ? 0 : xtime)+" ms");
00071                 PIPE_DELETE(pipe_of);
00072                 if(pipe_out&&pipe_of)
00073                   write_file(pipe_of,mixed_to_string(res, MAX_RECURSION)+"\n");
00074                 else
00075                 WLN("Result: "+mixed_to_string(res, MAX_RECURSION));
00076                 if(objectp(res))
00077                   variable=insert_alist("result", res, variable);
00078       }
00079     }
00080     rm(file);
00081   }
00082   if(obj) Destruct(obj);
00083   return TRUE;
00084 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xcallouts ( string  str  ) 

Definiert in Zeile 86 der Datei toolcmd.c.

Benutzt call_out_info(), delay, file(), i, MAX_RECURSION, mixed_to_string(), PIPE_DELETE, pipe_of, pipe_out, SECURE2, TK(), TMP_FILE, TRUE, USAGE1, WDLN und WLN.

00087 {
00088   object obj;
00089   mixed callouts, args;
00090   string fun, tmp, file;
00091   int delay, i, s;
00092   
00093   SECURE2(TRUE);
00094   TK("Xcallouts: str: "+(str?str:"(NULL)"));
00095   if(!pipe_out)
00096   {
00097     USAGE1(str, "xcallo(uts) [search pattern]");
00098     file=TMP_FILE;
00099     if(file_size(file)>0)
00100       rm(file);
00101     if(!str)
00102       str="^\\[~/";
00103     else if(!regexp(({"dummy"}), str))
00104     {
00105       WDLN("Bad regular expression");
00106       return TRUE;
00107     } 
00108   }
00109   else
00110   {
00111     USAGE1(str, "xcallo(uts)");
00112     if(str&&str!="")
00113     {
00114       WDLN("More arguments than expected");
00115       return TRUE;
00116     }
00117   }
00118   callouts=call_out_info();
00119   s=sizeof(callouts);
00120   PIPE_DELETE(pipe_of);
00121   for(i=0; i<s; i++)
00122   {
00123     if(callouts[i]&&pointerp(callouts[i]))
00124     {
00125       tmp=sprintf("%O %Os %O (%s)",callouts[i][0],callouts[i][2],
00126                                   callouts[i][1],(sizeof(callouts[i])>3?
00127                                                                   mixed_to_string(callouts[i][3],
00128                                                                                                   MAX_RECURSION):"0"));
00129       if(pipe_out&&pipe_of)
00130                 write_file(pipe_of,tmp+"\n");
00131       else
00132                 if(sizeof(regexp(({tmp}), str)))
00133                   WLN(tmp);
00134     }
00135   }
00136   return TRUE;
00137 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xcat ( string  str  ) 

Definiert in Zeile 139 der Datei toolcmd.c.

Benutzt file(), old_explode(), PIPE_FILE, pipe_if, pipe_in, PIPE_MAX, pipe_of, pipe_out, SECURE2, TK(), TRUE, USAGE2, USAGE3, WDLN, WLN und XFindFile().

00140 {
00141   string *tmp,file;
00142   int s;
00143 
00144   SECURE2(TRUE);
00145   TK("Xcat: str: "+str);
00146   if(!pipe_in)
00147   {
00148     USAGE2(str, "xcat <file>");
00149     if(!(file=XFindFile(str)))
00150     {
00151       WDLN("Can't find file");
00152       return TRUE;
00153     }
00154   }
00155   else
00156   {
00157     if(str&&str!="-")
00158       USAGE3("xcat -");
00159 
00160     if (file_size(file=pipe_if)<0)
00161     {
00162       WDLN("Missing input to xcat");
00163       return TRUE;
00164     }
00165   }
00166   tmp=old_explode(read_file(file,0,PIPE_MAX),"\n");
00167   if(pipe_in&&pipe_if==PIPE_FILE)
00168     rm(PIPE_FILE);
00169   if (pipe_out&&pipe_of)
00170     write_file(pipe_of,implode(tmp,"\n")+"\n");
00171   else
00172     WLN(implode(tmp,"\n"));
00173   return TRUE;
00174 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xcd ( string  str  ) 

Definiert in Zeile 176 der Datei toolcmd.c.

Benutzt cloner, dest(), old_explode(), path, PL, SECURE2, TK(), TRUE, USAGE1 und XFindObj().

00177 {
00178   object dest;
00179   string path;
00180   
00181   SECURE2(TRUE);
00182   USAGE1(str, "xcd [object]");
00183   TK("Xcd: str: "+(str?str:"(NULL)"));
00184   if(!str)
00185   {
00186     if(!(path=(string)cloner->QueryProp("start_home")))
00187       path="/";
00188   }
00189   else if((dest=XFindObj(str,1)))
00190     path="/"+implode(old_explode(object_name(dest),"/")[0..<2],"/");
00191   else
00192     path="";
00193 
00194   TK("Xcd: path: "+(path?path:"(NULL)"));
00195   if(!strlen(path))
00196     path=str;
00197   PL->_cd(path);
00198 
00199   return TRUE;
00200 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xclean ( string  str  ) 

Definiert in Zeile 202 der Datei toolcmd.c.

Benutzt cloner, ENV, env(), ME, PrintShort(), SECURE2, TK(), TRUE, USAGE1 und XFindObj().

00203 {
00204   object env;
00205   
00206   SECURE2(TRUE);
00207   USAGE1(str, "xcle(an) [object]");
00208   TK("Xclean: str: "+(str?str:"(NULL)"));
00209   if(!str)
00210     env=ENV(cloner);
00211   if(env||(env=XFindObj(str)))
00212   {
00213     PrintShort("Cleaning: ", env);
00214     filter(filter(all_inventory(env), #'is_not_player),//'
00215                                  "Destruct", ME);
00216   }
00217   return TRUE;
00218 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xclone ( string  str  ) 

Definiert in Zeile 220 der Datei toolcmd.c.

Benutzt cloner, ENV, ERR_FILE, error(), file(), MoveObj(), SECURE2, short_path(), TRUE, USAGE2, variable, W, WDLN, WLN und XFindFile().

00221 {
00222   object obj;
00223   string file, errlog, error;
00224   
00225   SECURE2(TRUE);
00226   USAGE2(str, "xclo(ne) <filename>");
00227   if(!(file=XFindFile(str))) return TRUE;
00228   errlog=ERR_FILE;
00229   if(file_size(errlog)>0) rm(errlog);
00230   WLN("Clone: "+short_path(file));
00231   if(!(error=catch(obj=clone_object(file))))
00232   {
00233     variable=insert_alist("clone", obj, variable);
00234     if(!MoveObj(obj, ENV(cloner), TRUE))
00235       WDLN("Cannot move object into this room");
00236     else if(!obj->QueryNoGet())
00237     {
00238       if(!MoveObj(obj, cloner, TRUE))
00239                 WDLN("Cannot move object into your inventory");
00240     }
00241   }
00242   else
00243     W("Error: "+error[1..]);
00244   return TRUE;
00245 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xcmds ( string  str  ) 

Definiert in Zeile 279 der Datei toolcmd.c.

Benutzt ALEFT, cloner, cmds, ENV, i, PIPE_DELETE, pipe_of, pipe_out, SECURE2, TK(), TRUE, USAGE1, WDLN, WLN und XFindObj().

00280 {
00281   object obj;
00282   mixed *cmds;
00283   int i, s;
00284 
00285   SECURE2(TRUE);
00286   USAGE1(str, "xcm(ds) [object]");
00287   TK("Xcmds: str: "+(str?str:"(NULL)"));
00288   if(!str)
00289     obj=ENV(cloner);
00290   else if(!(obj=XFindObj(str)))
00291   {
00292     WDLN("Can't find object");
00293     return TRUE;
00294   }
00295   s=sizeof(cmds=query_actions(cloner,1|2|4|8|16));
00296   PIPE_DELETE(pipe_of);
00297   for(i=0; i<s; i+=5)
00298     if(cmds[i+3]==obj)
00299       if(pipe_out&&pipe_of)
00300                 write_file(pipe_of,ALEFT(cmds[i]+" ", 15, ".")+
00301                                    (cmds[i+2] ? " * " : " . ")+cmds[i+4]+"()\n");
00302       else
00303                 WLN(ALEFT(cmds[i]+" ", 15, ".")+
00304                     (cmds[i+2] ? " * " : " . ")+cmds[i+4]+"()");
00305   return TRUE;
00306 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xdbg ( string  str  ) 

Definiert in Zeile 308 der Datei toolcmd.c.

Benutzt debug_info(), SECURE2, TK(), TRUE, USAGE2 und XFindObj().

00309 {
00310   object obj;
00311   
00312   SECURE2(TRUE);
00313   USAGE2(str, "xdb(g) <object>");
00314   TK("Xdbg: str: "+(str?str:"(NULL)"));
00315   if((obj=XFindObj(str)))
00316   {
00317     debug_info(1, obj);
00318     debug_info(0, obj);
00319   }
00320   return TRUE;
00321 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xdclean ( string  str  ) 

Definiert in Zeile 323 der Datei toolcmd.c.

Benutzt cloner, ENV, env(), ME, PrintShort(), SECURE2, TK(), TRUE, USAGE1 und XFindObj().

00324 {
00325   object env;
00326   
00327   SECURE2(TRUE);
00328   USAGE1(str, "xdc(lean) [object]");
00329   TK("Xdclean: str: "+(str?str:"(NULL)"));
00330   if(!str)
00331     env=ENV(cloner);
00332   if(env||(env=XFindObj(str)))
00333   {
00334     PrintShort("Deep cleaning: ", env);
00335     filter(filter(all_inventory(env), #'is_not_player, ME),//'
00336                                  "DeepClean", ME);
00337   }
00338   return TRUE;
00339 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xddes ( string  str  ) 

Definiert in Zeile 341 der Datei toolcmd.c.

Benutzt Destruct(), ME, PrintShort(), SECURE2, TK(), TRUE, USAGE2 und XFindObj().

00342 {
00343   object obj;
00344   
00345   SECURE2(TRUE);
00346   USAGE2(str, "xdd(es) <object>");
00347   TK("Xddes: str: "+(str?str:"(NULL)"));
00348   if((obj=XFindObj(str)))
00349   {
00350     PrintShort("Deep destruct: ", obj);
00351     filter(deep_inventory(obj), "Destruct", ME);
00352     Destruct(obj);
00353   }
00354   return TRUE;
00355 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xdes ( string  str  ) 

Definiert in Zeile 357 der Datei toolcmd.c.

Benutzt Destruct(), PrintShort(), SECURE2, TK(), TRUE, USAGE2 und XFindObj().

00358 {
00359   object obj;
00360   
00361   SECURE2(TRUE);
00362   USAGE2(str, "xde(s) <object>");
00363   TK("Xdes: str: "+(str?str:"(NULL)"));
00364   if((obj=XFindObj(str)))
00365   {
00366     PrintShort("Destruct: ",obj);
00367     Destruct(obj);
00368   }
00369   return TRUE;
00370 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xdlook ( string  str  ) 

Definiert in Zeile 372 der Datei toolcmd.c.

Benutzt cloner, DeepPrintShort(), NULL, PIPE_DELETE, pipe_of, pipe_out, SECURE2, TK(), TRUE, USAGE1 und XFindObj().

00373 {
00374   object obj;
00375   
00376   SECURE2(TRUE);
00377   USAGE1(str, "xdl(ook) [object]");
00378   TK("Xdlook: str: "+(str?str:"(NULL)"));
00379   if(!str)
00380     obj=cloner;
00381   if(obj||(obj=XFindObj(str)))
00382   {
00383     PIPE_DELETE(pipe_of);
00384     DeepPrintShort(obj,NULL,NULL,(pipe_out&&pipe_of)?pipe_of:"");
00385   }
00386   return TRUE;
00387 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xdo ( string  str  ) 

Definiert in Zeile 389 der Datei toolcmd.c.

Benutzt Command(), FALSE, i, SECURE2, strip_explode(), TRUE und USAGE2.

00390 {
00391   int i, n, s;
00392   string *strs, cmd;
00393   
00394   SECURE2(TRUE);
00395   USAGE2(str, "xdo [<number1>#]<command1>[;[<number2>#]<command2>] ...");
00396   if(!str||str==""||!(s=sizeof(strs=strip_explode(str, ";"))))
00397     return FALSE;
00398   for(i=0; i<s; i++)
00399   {
00400     if(strs[i])
00401     {
00402       switch(sscanf(strs[i], "%d#%s", n, cmd))
00403       {
00404                 case 0:
00405                 if(!Command(strs[i])) return TRUE;
00406                 break;
00407                 case 1:
00408                 if(cmd&&(!Command(cmd))) return TRUE;
00409                 break;
00410                 case 2:
00411                 n= n<1 ? 1 : n;
00412                 if(cmd)
00413                 {
00414                   while(n--)
00415                     if(!Command(cmd)) return TRUE;
00416                 }
00417                 break;
00418       }
00419     }
00420   }
00421   return TRUE;
00422 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xdupdate ( string  str  ) 

Definiert in Zeile 424 der Datei toolcmd.c.

Benutzt Destruct(), file(), i, list, PrintShort(), SECURE2, SUBSTR, TRUE, USAGE2, XFindFile() und XFindObj().

00425 {
00426   int i, s;
00427   object obj;
00428   string file, *list;
00429   
00430   SECURE2(TRUE);
00431   USAGE2(str, "xdu(pdate) <filename>");
00432   if(!(file=XFindFile(str)))
00433     return TRUE;
00434   if(SUBSTR(file, -2, -1)==".c")
00435     file=SUBSTR(file, 0, -3);
00436   if(obj=XFindObj(file))
00437   {
00438     PrintShort("Deep updating: ", obj);
00439     list=inherit_list(obj);
00440     for(s=sizeof(list); i<s; i++)
00441     {
00442       if(obj=find_object(list[i]))
00443                 Destruct(obj);
00444     }
00445   }
00446   return TRUE;
00447 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xecho ( string  str  ) 

Definiert in Zeile 449 der Datei toolcmd.c.

Benutzt TK(), TRUE und WLN.

00450 {
00451   TK("Xecho: str: "+(str?str:"(NULL)"));
00452   WLN(str);
00453   return TRUE;
00454 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xeval ( string  str  ) 

Definiert in Zeile 456 der Datei toolcmd.c.

Benutzt cloner, ctime(), Destruct(), ENV, error(), file(), LPC_FILE, MAX_RECURSION, mixed_to_string(), PIPE_DELETE, pipe_of, pipe_out, PRIVATE_HEADER, rusage(), SECURE2, TOOL_LOG, TRUE, USAGE2, variable, W, WDLN und WLN.

00457 {
00458   object obj;
00459   string file, error;
00460   int *ru1, *ru2, xtime;
00461   mixed res;
00462   
00463   SECURE2(TRUE);
00464   USAGE2(str, "xev(al) <expression>");
00465   file=LPC_FILE+".c";
00466   if(file_size(file)>0)
00467     rm(file);
00468   if(obj=find_object(LPC_FILE))
00469     Destruct(obj);
00470 #if 0
00471   write_file(TOOL_LOG,
00472                      sprintf("%s (%s) xeval %s\n",
00473                                      ctime(time()),getuid(cloner),str));
00474 #endif
00475   write_file(file,
00476                      "#include <properties.h>\n"+
00477                      "#include <thing/properties.h>\n"+
00478                      "#include <defines.h>\n"+
00479              "#include <wizlist.h>\n"+
00480                      "#include <moving.h>\n"+
00481                      "#include \"/secure/wizlevels.h\"\n"+
00482                      (file_size(PRIVATE_HEADER)>=0?"#include \""+PRIVATE_HEADER+"\"\n":"")+
00483                      "get(str){return previous_object()->XFindObj(str);}\n"+
00484                      "eval(me,here){return "+str+";}");
00485   if(error=catch(obj=clone_object(file)))
00486     W("Error: "+error[1..]);
00487   else
00488   {
00489     ru1=rusage();
00490     error=catch(res=(mixed)obj->eval(cloner, ENV(cloner)));
00491     ru2=rusage();
00492     if(error)
00493       W("Error: "+error[1..]);
00494     else
00495     {
00496       xtime=ru2[0]-ru1[0]+ru2[1]-ru1[1];
00497       WDLN("Evaluation time: "+(xtime<0 ? 0 : xtime)+" ms");
00498       PIPE_DELETE(pipe_of);
00499       if(pipe_out&&pipe_of)
00500                 write_file(pipe_of,mixed_to_string(res,MAX_RECURSION)+"\n");
00501       else
00502                 WLN("Result: "+mixed_to_string(res, MAX_RECURSION));
00503       if(objectp(res))
00504                 variable=insert_alist("result", res, variable);
00505     }
00506   }
00507   rm(file);
00508   if(obj)
00509     Destruct(obj);
00510   return TRUE;
00511 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xforall ( string  str  ) 

Definiert in Zeile 513 der Datei toolcmd.c.

Benutzt Command(), FALSE, i, long_get_dir(), old_explode(), SECURE2, string_replace, TRUE, USAGE2 und WDLN.

00514 {
00515   int i, s, t, u;
00516   string pat, cmd, arg, *strs, *files, fh, fr, fe, ft, ff;
00517   
00518   SECURE2(TRUE);
00519   USAGE2(str, "xfo(rall) <filepattern> <command>");
00520   if(sscanf(str, "%s %s", pat, arg)!=2)
00521     return FALSE;
00522   files=long_get_dir(pat, FALSE);
00523   if(!(s=sizeof(files)))
00524   {
00525     WDLN("No matching files found");
00526     return TRUE;
00527   }
00528   strs=old_explode(files[0], "/");
00529   fh="/";
00530   if(t=sizeof(strs)-1)
00531     fh+=implode(strs[0..t-1], "/");
00532   for(i=0; i<s; i++)
00533   {
00534     ft=old_explode(files[i], "/")[t];
00535     if((u=sizeof(strs=old_explode(ft, ".")))&&--u)
00536     {
00537       ff=implode(strs[0..u-1], ".");
00538       fr=fh+"/"+ff;
00539       fe=strs[u];
00540     }
00541     else
00542     {
00543       fe="";
00544       ff=ft;
00545       fr=files[i];
00546     }
00547     cmd=string_replace(arg, "!!", files[i]);
00548     cmd=string_replace(cmd, "!e", fe);
00549     cmd=string_replace(cmd, "!f", ff);
00550     cmd=string_replace(cmd, "!h", fh);
00551     cmd=string_replace(cmd, "!r", fr);
00552     cmd=string_replace(cmd, "!t", ft);
00553     if(!(Command(cmd)))
00554       break;
00555   }
00556   return TRUE;
00557 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xgoto ( string  str  ) 

Definiert in Zeile 559 der Datei toolcmd.c.

Benutzt cloner, ENV, M_TPORT, SECURE2, TRUE, USAGE1, XFindFile() und XFindObj().

00560 {
00561   object obj, tmp;
00562   
00563   SECURE2(TRUE);
00564   USAGE1(str, "xgo(to) [object]");
00565   if(!str) str="~/workroom";
00566   if(!(obj=XFindObj(str)))
00567   {
00568     if(!(str=XFindFile(str)))
00569       return TRUE;
00570     if(catch(call_other(str, "???")))
00571       return TRUE;
00572     obj=find_object(str);
00573   }
00574   tmp=obj;
00575   while(obj&&living(obj))
00576     obj=ENV(obj);
00577   cloner->move(obj ? obj : tmp, M_TPORT);
00578   return TRUE;
00579 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xgrep ( string  str  ) 

Definiert in Zeile 581 der Datei toolcmd.c.

Benutzt FALSE, i, long_get_dir(), old_explode(), PIPE_DELETE, pipe_if, pipe_in, PIPE_MAX, pipe_of, pipe_out, pipe_ovr, SECURE2, TK(), TMP_FILE, TRUE, USAGE2, USAGE3, W, WDLN, WLN, XFile(), XGREP_ICASE, XGREP_REVERT und XGrepFile().

00582 {
00583   int i, s, t, mode;
00584   string *files, *ts;
00585   
00586   SECURE2(TRUE);
00587   TK("Xgrep: str: "+(str?str:"(NULL)"));
00588   mode=0;
00589   if(!pipe_in)
00590   {
00591     USAGE2(str, "xgr(ep) [-i] [-v] <regexp> <filepattern>");
00592     if(!(ts=old_explode(str, " "))||!(s=sizeof(ts)))
00593       return FALSE;
00594     while(ts[0][0]=='-')
00595     {
00596       if(s<3)
00597       {
00598                 WDLN("Too few arguments to xgrep");
00599                 return FALSE;
00600       }
00601       switch(ts[0])
00602       {
00603                 case "-v":
00604                   mode|=XGREP_REVERT;
00605                   ts=ts[1..];
00606                   s--;
00607                   break;
00608                 case "-i":
00609                   mode|=XGREP_ICASE;
00610                   ts=ts[1..];
00611                   s--;
00612                   break;
00613                 case "-vi":
00614                 case "-iv":
00615                   mode|=XGREP_REVERT;
00616                   mode|=XGREP_ICASE;
00617                   ts=ts[1..];
00618                   s--;
00619                   break;
00620                 default:
00621                   WDLN("Unknown option "+ts[0]+" given to xgrep");
00622                   return FALSE;
00623       }
00624     }
00625     str=implode(ts[0..s-2], " ");
00626   }
00627   else
00628   {
00629     if(!((ts=old_explode(str, " "))&&(s=sizeof(ts))))
00630       USAGE3("xgr(ep) [-i] [-v] <regexp>");
00631     while(ts[0][0]=='-')
00632     {
00633       if(s<2)
00634       {
00635                 WDLN("Too few arguments to xgrep");
00636                 return FALSE;
00637       }
00638       switch(ts[0])
00639       {
00640                 case "-v":
00641                   mode|=XGREP_REVERT;
00642                   ts=ts[1..];
00643                   s--;
00644                   break;
00645                 case "-i":
00646                   mode|=XGREP_ICASE;
00647                   ts=ts[1..];
00648                   s--;
00649                   break;
00650                 case "-iv":
00651                 case "-vi":
00652                   mode|=XGREP_REVERT;
00653                   mode|=XGREP_ICASE;
00654                   ts=ts[1..];
00655                   s--;
00656                   break;
00657                 default:
00658                   WDLN("Unknown option "+ts[0]+" given to xgrep");
00659                   return FALSE;
00660       }
00661     }
00662     str=implode(ts[0..s-1], " ");
00663   }
00664   
00665   if(mode&XGREP_ICASE)
00666     str=lower_case(str);
00667   if(!(regexp(({"dummy"}), str)))
00668   {
00669     WDLN("Bad regular expression");
00670     return TRUE;
00671   }
00672   if(!pipe_in)
00673   {
00674     if(file_size(TMP_FILE)>0)
00675       rm(TMP_FILE);
00676     if((t=sizeof(files=long_get_dir(XFile(ts[s-1]), FALSE)))&&
00677        (file_size(files[0])>=0))
00678     {
00679       for(i=0; i<t; i++)
00680                 XGrepFile(str, files[i], mode);
00681       if(pipe_out&&pipe_of)
00682       {
00683                 PIPE_DELETE(pipe_of);
00684                 if(!pipe_ovr)
00685                 {
00686                   write_file(pipe_of,read_file(TMP_FILE,0,PIPE_MAX));
00687                   rm(TMP_FILE);
00688                 }
00689                 else
00690                   rename(TMP_FILE,pipe_of);
00691       }
00692       else
00693       {
00694                 W(read_file(TMP_FILE,0,PIPE_MAX));
00695                 rm(TMP_FILE);
00696       }
00697     }
00698     else
00699       WDLN("Cannot read file(s)");
00700   }
00701   else
00702   {
00703     string *tmp;
00704     if(file_size(pipe_if)<0)
00705     {
00706       WDLN("Missing input to xgrep");
00707       return TRUE;
00708     }
00709     TK("Xgrep: str: "+str+" mode: "+mode);
00710     s=sizeof(tmp=old_explode(read_file(pipe_if,0,PIPE_MAX),"\n"));
00711     PIPE_DELETE(pipe_of);
00712     for(i=0;i<s;i++)
00713     {
00714       // TK(tmp[i]+"<->"+str);
00715       if(sizeof(regexp(({(mode&XGREP_ICASE?lower_case(tmp[i]):tmp[i])}),str)))
00716       {
00717                 // TK("Xgrep: matched!");
00718                 if(!(mode&XGREP_REVERT))
00719                   if(pipe_out&&pipe_of)
00720                     write_file(pipe_of,tmp[i]+"\n");
00721                   else
00722                     WLN(tmp[i]);
00723       }
00724       else
00725                 if(mode&XGREP_REVERT)
00726                   if(pipe_out&&pipe_of)
00727                     write_file(pipe_of,tmp[i]+"\n");
00728                   else
00729                     WLN(tmp[i]);
00730     }
00731   }
00732   return TRUE;
00733 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xhbeats ( string  str  ) 

Definiert in Zeile 735 der Datei toolcmd.c.

Benutzt cloner, file(), ObjFile(), PIPE_DELETE, pipe_of, pipe_out, RNAME, SECURE2, TK(), TRUE, USAGE1, WDLN und WLN.

00736 {
00737   object obj;
00738   object *hbeatinfo;
00739   string tmp, file;
00740   int i, s;
00741   
00742   SECURE2(TRUE);
00743   TK("Xhbeats: str: "+(str?str:"(NULL)"));
00744   if(!pipe_out)
00745   {
00746     USAGE1(str, "xhb(eats) [search pattern]");
00747     if(!str)
00748       str=RNAME(cloner);
00749     else if(!regexp(({"dummy"}), str))
00750     {
00751       WDLN("Bad regular expression");
00752       return TRUE;
00753     }
00754   }
00755   else
00756   {
00757     USAGE1(str,"xhb(eats)");
00758     if(str&&str!="")
00759     {
00760       WDLN("More arguments than expected");
00761       return TRUE;
00762     }
00763   }
00764   s=sizeof(hbeatinfo=heart_beat_info());
00765   PIPE_DELETE(pipe_of);
00766   for(i=0; i<s; i++)
00767     if(hbeatinfo[i]&&objectp(hbeatinfo[i]))
00768     {
00769       tmp=ObjFile(hbeatinfo[i]);
00770       if(sizeof(regexp(({tmp}), str)))
00771                 if(pipe_out&&pipe_of)
00772                   write_file(pipe_of, tmp+"\n");
00773                 else
00774                   WLN(tmp);
00775     }
00776   return TRUE;
00777 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xhead ( string  str  ) 

Definiert in Zeile 779 der Datei toolcmd.c.

Benutzt FALSE, file(), lines, old_explode(), PIPE_DELETE, PIPE_FILE, pipe_if, pipe_in, PIPE_MAX, pipe_of, pipe_out, SECURE2, TK(), TRUE, USAGE2, WDLN und XFindFile().

00780 {
00781   int lines;
00782   string *tmp, file;
00783 
00784   SECURE2(TRUE);
00785   TK("Xhead: str: "+(str?str:"(NULL)"));
00786   if(!pipe_in)
00787   {
00788     USAGE2(str, "xhead <-#> <file>");
00789     if(sscanf(str,"-%d %s",lines,file)!=2)
00790                 return FALSE;
00791     if(!(file=XFindFile(file)))
00792       return FALSE;
00793   }
00794   else
00795   {
00796     USAGE2(str, "xhead <-#>");
00797     if(sscanf(str,"-%d",lines)!=1)
00798       return FALSE;
00799     if (file_size(file=pipe_if)<0)
00800     {
00801       WDLN("Missing input to xhead");
00802       return TRUE;
00803     }
00804   }
00805   tmp=old_explode(read_file(file,0,PIPE_MAX),"\n")[0..lines-1];
00806   if(pipe_in&&pipe_if==PIPE_FILE)
00807     rm(PIPE_FILE);
00808   if (pipe_out&&pipe_of)
00809   {
00810     PIPE_DELETE(pipe_of);
00811     write_file(pipe_of,implode(tmp,"\n")+"\n");
00812   }
00813   else
00814     WDLN(implode(tmp,"\n"));
00815   return TRUE;
00816 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xhelp ( string  str  ) 

Definiert in Zeile 818 der Datei toolcmd.c.

Benutzt FALSE, SECURE2, TOOL_MANPAGE, TRUE, USAGE1 und XMoreFile().

00819 {
00820   SECURE2(TRUE);
00821   USAGE1(str, "xhe(lp)");
00822   XMoreFile(TOOL_MANPAGE, FALSE);
00823   return TRUE;
00824 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xids ( string  str  ) 

Definiert in Zeile 826 der Datei toolcmd.c.

Benutzt SECURE2, TK(), TRUE, USAGE2, WLN und XFindObj().

00827 {
00828   object obj;
00829   
00830   SECURE2(TRUE);
00831   USAGE2(str, "xid(s) <object>");
00832   TK("Xids: str: "+(str?str:"(NULL)"));
00833   if((obj=XFindObj(str)))
00834     WLN("UID=\""+getuid(obj)+"\" / EUID=\""+geteuid(obj)+"\"");
00835   return TRUE;
00836 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xinfo ( string  str  ) 

Definiert in Zeile 838 der Datei toolcmd.c.

Benutzt FALSE, is_player(), PlayerDomain(), PlayerIP(), PlayerMail(), PlayerRace(), PlayerSnoop(), PlayerStats(), PlayerWho(), SECURE2, TK(), TRUE, USAGE2, WDLN, WLN und XFindObj().

00839 {
00840   object obj;
00841   
00842   SECURE2(TRUE);
00843   USAGE2(str, "xinf(o) <object>");
00844   TK("Xinfo: str: "+(str?str:"(NULL)"));
00845   if((obj=XFindObj(str)))
00846   {
00847     if(is_player(obj))
00848     {
00849       WLN(PlayerWho(obj));
00850       WLN(PlayerMail(obj, FALSE));
00851       WLN(PlayerIP(obj, FALSE));
00852       WLN(PlayerRace(obj, FALSE));
00853       WLN(PlayerDomain(obj, FALSE));
00854       WLN(PlayerStats(obj, FALSE));
00855       WLN(PlayerSnoop(obj, FALSE));
00856     }
00857     else
00858       WDLN("Sorry, this is not a player");
00859   }
00860   return TRUE;
00861 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xinherit ( string  str  ) 

Definiert in Zeile 863 der Datei toolcmd.c.

Benutzt FALSE, Inheritance(), PIPE_DELETE, pipe_of, SECURE2, strip_explode(), TK(), TRUE, USAGE2, WDLN und XFindObj().

00864 {
00865   int s;
00866   object obj;
00867   string *strs, *inlist;
00868   
00869   SECURE2(TRUE);
00870   USAGE2(str, "xinh(erit) <object> [function]");
00871   TK("Xinherit: str: "+str);
00872   if(!(strs=strip_explode(str, " ")))
00873     return FALSE;
00874   if(obj=XFindObj(strs[0]))
00875   {
00876     inlist=inherit_list(obj);
00877     s=sizeof(inlist);
00878     while(s--)
00879     {
00880       if(catch(call_other(inlist[s], "???")))
00881       {
00882                 WDLN("Failed to load all inheritance objects");
00883                 return TRUE;
00884       }
00885     }
00886     obj=find_object(inlist[0]);
00887     PIPE_DELETE(pipe_of);
00888     if(sizeof(strs)==1)
00889       Inheritance(obj ,0 ,"");
00890     else
00891       Inheritance(obj, strs[1], "");
00892   }
00893   return TRUE;
00894 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xinventory ( string  str  ) 

Definiert in Zeile 896 der Datei toolcmd.c.

Benutzt ARIGHT, cloner, FALSE, FORALL, item, PIPE_DELETE, pipe_of, pipe_out, PrintShort(), SECURE2, short(), TK(), TRUE, USAGE1, WESSEN, who, WLN und XFindObj().

00897 {
00898   int i, short;
00899   object item;
00900   mixed who;
00901   
00902   SECURE2(TRUE);
00903   USAGE1(str, "xi [-s] [player]");
00904   TK("Xinventory: str: "+str);
00905   short=0;
00906   who=cloner;
00907   if(str&&str!="")
00908   {
00909     if(str=="-s")
00910     {
00911       short=1;
00912       who=cloner;
00913     }
00914     else if(sscanf(str,"-s %s",who))
00915     {
00916       short=1;
00917       who=XFindObj(who);
00918     }
00919     else if(sscanf(str,"%s",who))
00920     {
00921       short=0;
00922       who=XFindObj(who);
00923     }
00924     else
00925       who=cloner;
00926   }
00927   if(!who)
00928     return FALSE;
00929   PIPE_DELETE(pipe_of);
00930   if(!(pipe_out&&pipe_of))
00931     WLN(who->name(WESSEN)+" Inventory:"+(short?" (short)":""));
00932   if(!short)
00933     if(pipe_out&&pipe_of)
00934       FORALL(item, who) PrintShort(ARIGHT(++i+". ", 4, " "), item, pipe_of);
00935     else
00936       FORALL(item, who) PrintShort(ARIGHT(++i+". ", 4, " "), item);
00937   else
00938     if(pipe_out&&pipe_of)
00939       FORALL(item, who) write_file(pipe_of,++i+". ["+object_name(item)+"]\n");
00940     else
00941       FORALL(item, who) WLN(++i+". ["+object_name(item)+"]");
00942   return TRUE;
00943 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xlag ( string  str  ) 

Definiert in Zeile 945 der Datei toolcmd.c.

Benutzt LAG_O_DAEMON, round(), TRUE und WLN.

00946 {
00947   int i;
00948   float *lag;
00949   object daemon;
00950   string lags;
00951 
00952   if(file_size(LAG_O_DAEMON+".c")<=0)
00953   {
00954     WLN("Sorry, lag-o-daemon is missing!");
00955     return TRUE;
00956   }
00957   
00958   LAG_O_DAEMON->MachHin();
00959   if(!(daemon=find_object(LAG_O_DAEMON)))
00960     lag=({-1.0,-1.0,-1.0});
00961   else
00962     lag=(float *)daemon->read_lag_data();
00963   lags="Letzte 60 min: ";
00964   if(lag[0]>=0.0)
00965   {
00966     for(i=round(lag[0])-1;i>=0;i--)
00967       lags+="#";
00968     lags+=" ("+sprintf("%.1f",lag[0])+"%)";
00969   }
00970   else
00971     lags+="N/A";
00972   lags+="\nLetzte 15 min: ";
00973   if(lag[1]>=0.0)
00974   {
00975     for(i=round(lag[1])-1;i>=0;i--)
00976       lags+="#";
00977     lags+=" ("+sprintf("%.1f",lag[1])+"%)";
00978   }
00979   else
00980     lags+="N/A";
00981   lags+="\nLetzte Minute: ";
00982   if(lag[2]>=0.0)
00983   {
00984     for(i=round(lag[2])-1;i>=0;i--)
00985       lags+="#";
00986     lags+=" ("+sprintf("%.1f",lag[2])+"%)";
00987   }
00988   else
00989     lags+="N/A";
00990   WLN(lags);
00991   return TRUE;
00992 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xlight ( string  str  ) 

Definiert in Zeile 994 der Datei toolcmd.c.

Benutzt cloner, ENV, FALSE, SECURE2, TOOL_NAME, TRUE, USAGE1, WDLN und xlight.

00995 {
00996   int s, addlight;
00997 
00998   SECURE2(TRUE);
00999   USAGE1(str, "xli(ght) [light]");
01000   if(str)
01001   {
01002     if(!sscanf(str, "%d", addlight))
01003       return FALSE;
01004     xlight+=addlight;
01005     cloner->AddIntLight(addlight);
01006   }
01007   WDLN("Current light levels: "+TOOL_NAME+"="+xlight+", room="+
01008        ENV(cloner)->QueryIntLight());
01009   return TRUE;
01010 }

int Xload ( string  str  ) 

Definiert in Zeile 1012 der Datei toolcmd.c.

Benutzt Destruct(), ERR_FILE, error(), file(), inv(), MoveObj(), SECURE2, TRUE, USAGE2, VOID, W, WDLN, WLN und XFindFile().

01013 {
01014   int i, f;
01015   object obj, *inv, vroom;
01016   string file, errlog, error, *strs;
01017   
01018   SECURE2(TRUE);
01019   USAGE2(str, "xloa(d) <filename>");
01020   if(!(file=XFindFile(str)))
01021     return TRUE;
01022   errlog=ERR_FILE;
01023   if(file_size(errlog)>0)
01024     rm(errlog);
01025   if(obj=find_object(file))
01026   {
01027     if(catch(call_other(VOID, "???")))
01028     {
01029       WDLN("Error: cannot find "+VOID+" to rescue players");
01030       return TRUE;
01031     }
01032     else
01033       vroom = find_object(VOID);
01034     if(inv=filter(all_inventory(obj), #'is_player, ME))//'
01035       for(i=0; i<sizeof(inv); i++)
01036                 MoveObj(inv[i], vroom, TRUE);
01037     Destruct(obj);
01038     WLN("Update and load: "+file);
01039   }
01040   else
01041     WLN("Load: "+file);
01042   if(error=catch(call_other(file, "???")))
01043   {
01044     W("Error: "+error[1..]);
01045     if(vroom)
01046       tell_object(vroom, "*** Failed to load room. You are in the void!\n");
01047   }
01048   else if(inv)
01049   {
01050     obj=find_object(file);
01051     for(i=0; i<sizeof(inv); i++)
01052       if(inv[i])
01053                 MoveObj(inv[i], obj, TRUE);
01054   }
01055   return TRUE;
01056 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xlook ( string  str  ) 

Definiert in Zeile 1058 der Datei toolcmd.c.

Benutzt cloner, ENV, file(), PIPE_DELETE, pipe_of, pipe_out, PrintObj(), SECURE2, TK(), TRUE, USAGE1 und XFindObj().

01059 {
01060   object obj;
01061   string st;
01062   string file;
01063   
01064   SECURE2(TRUE);
01065   USAGE1(str, "xloo(k) [object]");
01066   TK("Xlook: str: "+str);
01067   PIPE_DELETE(pipe_of);
01068   file = pipe_out&&pipe_of ? pipe_of : "";
01069   if(str&&str!="")
01070   {
01071     if((obj=XFindObj(str)))
01072       PrintObj(obj,file);
01073   }
01074   else
01075   {
01076     obj=ENV(cloner);
01077     PrintObj(obj,file);
01078   }
01079   return TRUE;
01080 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xlpc ( string  str  ) 

Definiert in Zeile 1082 der Datei toolcmd.c.

Benutzt cloner, Destruct(), ENV, error(), file(), LPC_FILE, MAX_RECURSION, mixed_to_string(), PRIVATE_HEADER, rusage(), SECURE2, TRUE, USAGE2, variable, W, WDLN und WLN.

01083 {
01084   object obj;
01085   string file, error;
01086   int *ru1, *ru2, time;
01087   mixed res;
01088   
01089   SECURE2(TRUE);
01090   USAGE2(str, "xlp(c) <lpc code>");
01091   file=LPC_FILE+".c";
01092   if(file_size(file)>0)
01093     rm(file);
01094   if(obj=find_object(LPC_FILE))
01095     Destruct(obj);
01096   write_file(file,
01097                                   "#include <properties.h>\n"+
01098                                   "#include <thing/properties.h>\n"+
01099                                   "#include <defines.h>\n"+
01100                   "#include <wizlist.h>\n"+
01101                                   "#include <moving.h>\n"+
01102                                   "#include \"/secure/wizlevels.h\"\n"+
01103                                   (file_size(PRIVATE_HEADER)>=0?"#include \""+PRIVATE_HEADER+"\"\n":"")+
01104                      "get(str){return previous_object()->XFindObj(str);}\n"+
01105                      "eval(me,here){"+str+"}");
01106   if(error=catch(obj=clone_object(file)))
01107     W("Error: "+error[1..0]);
01108   else
01109   {
01110     ru1=rusage();
01111     error=catch(res=(mixed)obj->eval(cloner, ENV(cloner)));
01112     ru2=rusage();
01113     if(error)
01114       W("Error: "+error[1..]);
01115     else
01116     {
01117       time=ru2[0]-ru1[0]+ru2[1]-ru1[1];
01118       WDLN("Evaluation time: "+(time<0 ? 0 : time)+" ms");
01119       WLN("Result: "+mixed_to_string(res, MAX_RECURSION));
01120       if(objectp(res))
01121                 variable=insert_alist("result", res, variable);
01122     }
01123   }
01124   rm(file);
01125   if(obj)
01126     Destruct(obj);
01127   return TRUE;
01128 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xman ( string  str  ) 

Definiert in Zeile 1130 der Datei toolcmd.c.

Benutzt FALSE, manpath, SECURE2, TRUE, USAGE2, W, WLN und XMoreFile().

01131 {
01132   string manpage;
01133   int i, found;
01134   
01135   SECURE2(TRUE);
01136   USAGE2(str, "xma(n) <manpage>");
01137   W("Man: ");
01138   for(i=0, found=0; i<sizeof(manpath); i++)
01139   {
01140     manpage=manpath[i]+str;
01141     if(file_size(manpage)>=0)
01142     {
01143       WLN(manpage);
01144       XMoreFile(manpage, FALSE);
01145       found=1;
01146       break;
01147     }
01148   }
01149   if(!found)
01150     WLN("- no help available -");
01151   return TRUE;
01152 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xmore ( string  str  ) 

Definiert in Zeile 1154 der Datei toolcmd.c.

Benutzt FALSE, file(), moreoffset, pipe_if, pipe_in, SECURE2, strip_explode(), TK(), TRUE, USAGE2, USAGE3, WDLN, XFindFile() und XMoreFile().

01155 {
01156   string *args, file;
01157   int line;
01158   
01159   SECURE2(TRUE);
01160   TK("Xmore: str: "+str);
01161   if (!pipe_in)
01162   {
01163     USAGE2(str, "xmor(e) <filename> [start]");
01164     switch(sizeof(args=strip_explode(str, " ")))
01165     {
01166       case 1:
01167       moreoffset=1;
01168       break;
01169       case 2:
01170       sscanf(args[1], "%d", line);
01171       moreoffset= line>0 ? line : 1;
01172       break;
01173       default:
01174       return FALSE;
01175     }
01176     if(file=XFindFile(args[0]))
01177       XMoreFile(file, TRUE);
01178   }
01179   else
01180   {
01181     if(file_size(pipe_if)<0)
01182     {
01183       WDLN("Missing input to xmore");
01184       return TRUE;
01185     }
01186     if (!str||str=="")
01187       line=1;
01188     else if (sscanf(str, "%d", line)!=1)
01189       USAGE3("xmor(e) [start]");
01190     moreoffset= line>0 ? line : 1;
01191     XMoreFile(pipe_if, TRUE);
01192   }
01193   return TRUE;
01194 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xmove ( string  str  ) 

Definiert in Zeile 1196 der Datei toolcmd.c.

Benutzt FALSE, MoveObj(), SECURE2, TRUE, USAGE2 und XFindObj().

01197 {
01198   object obj1, obj2;
01199   string what, into;
01200   
01201   SECURE2(TRUE);
01202   USAGE2(str, "xmov(e) <object> into <object>");
01203   if((sscanf(str, "%s into %s", what, into)==2)&&
01204      (obj1=XFindObj(what))&&(obj2=XFindObj(into)))
01205     MoveObj(obj1, obj2, FALSE);
01206   return TRUE;
01207 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xmsg ( string  str  ) 

Definiert in Zeile 1209 der Datei toolcmd.c.

Benutzt cloner, CRNAME, FALSE, input_to(), msgto, pipe_if, pipe_in, PIPE_MAX, PrintShort(), SECURE2, shout(), TK(), TRUE, USAGE1, WDLN und XFindObj().

01210 {
01211   string tmp;
01212   
01213   SECURE2(TRUE);
01214   TK("Xmsg: str: "+str);
01215   USAGE1(str, "xms(g) [to <object>|all]");
01216   if(!str||str=="")
01217   {
01218     WDLN("Send message into room");
01219     say("Message from "+CRNAME(cloner)+":\n");
01220     if(pipe_in&&pipe_if)
01221       say(read_file(pipe_if,0,PIPE_MAX));
01222     else
01223     {
01224       WDLN("End message with \".\" or \"**\"");
01225       input_to("XMsgSay");
01226     }
01227     return TRUE;
01228   }
01229   else if(sscanf(str, "to %s", tmp))
01230   {
01231     if(msgto=XFindObj(tmp))
01232     {
01233       PrintShort("Send message to: ", msgto);
01234       tell_object(msgto, "Message from "+CRNAME(cloner)+" to you:\n");
01235       if(pipe_in&&pipe_if)
01236                 tell_object(msgto,read_file(pipe_if,0,PIPE_MAX));
01237       else
01238       {
01239                 WDLN("End message with \".\" or \"**\"");
01240                 input_to("XMsgTell");
01241       }
01242     }
01243     return TRUE;
01244   }
01245   else if(str=="all")
01246   {
01247     WDLN("Send message to all players");
01248     shout("Message from "+CRNAME(cloner)+" to all:\n");
01249     if(pipe_in&&pipe_if)
01250       shout(read_file(pipe_if,0,PIPE_MAX));
01251     else
01252     {
01253       WDLN("End message with \".\" or \"**\"");
01254       input_to("XMsgShout");
01255     }
01256     return TRUE;
01257   }
01258   return FALSE;
01259 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xmtp ( string  str  ) 

Definiert in Zeile 1261 der Datei toolcmd.c.

Benutzt FALSE, file(), MASTER, ME, old_explode(), SECURE2, TRUE, USAGE2, WDLN und XmtpScript().

01262 {
01263   int s;
01264   string *strs, opt, dir, file;
01265 
01266   SECURE2(TRUE);
01267   USAGE2(str, "xmt(p) [options] <directory> <filename>");
01268   s=sizeof(strs=old_explode(str, " "));
01269   if(s<2)
01270     return FALSE;
01271   else if(s==2)
01272     opt="";
01273   else
01274     opt=implode(strs[0..s-3], " ");
01275   if(!(dir="/"+(string)MASTER->valid_read(strs[s-2], geteuid(),
01276                                                                                   "get_dir", ME))) {
01277     WDLN("No permission to open directory for reading");
01278     return TRUE;
01279   }
01280   if(!(file="/"+(string)MASTER->valid_write(strs[s-1], geteuid(),
01281                                                                                     "write_file", ME))) {
01282     WDLN("No permission to open script file for writing");
01283     return TRUE;
01284   }
01285   if(file_size(dir)!=-2 || file_size(file)==-2)
01286     return FALSE;
01287   XmtpScript(dir, file, opt);
01288   WDLN("Done");
01289   return TRUE;
01290 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xproc ( string  str  ) 

Definiert in Zeile 1292 der Datei toolcmd.c.

Benutzt old_explode(), SECURE2, TOOL_PATH, TRUE, USAGE1 und WLN.

01293 {
01294   int s;
01295   string *strs;
01296 
01297   SECURE2(TRUE);
01298   USAGE1(str, "xproc [-c] [-l] [-m] [-u] [-v]");
01299 
01300   if(file_size(TOOL_PATH+"/proc")!=-2)
01301   {
01302     WLN("Sorry, no /proc information available!");
01303     return TRUE;
01304   }
01305   
01306   if(!str||str==""||!(s=sizeof(strs=old_explode(str, " "))))
01307   {
01308     WLN("Load averages:");
01309     cat(TOOL_PATH+"/proc/loadavg");
01310     return TRUE;
01311   }
01312   
01313   while(s=sizeof(strs))
01314   {
01315     switch(strs[0])
01316     {
01317       case "-c":
01318       WLN("CPU info:");
01319       cat(TOOL_PATH+"/proc/cpuinfo");
01320       break;
01321       case "-l":
01322       WLN("Load averages:");
01323       cat(TOOL_PATH+"/proc/loadavg");
01324       break;
01325       case "-m":
01326       WLN("Memory usage:");
01327       cat(TOOL_PATH+"/proc/meminfo");
01328       break;
01329       case "-u":
01330       WLN("Uptime:");
01331       cat(TOOL_PATH+"/proc/uptime");
01332       break;
01333       case "-v":
01334       WLN("Version:");
01335       cat(TOOL_PATH+"/proc/version");
01336       break;
01337       default:
01338       WLN("Unknown option: "+strs[0]);
01339     }
01340     strs=strs[1..];
01341   }
01342   return TRUE;
01343 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xprof ( string  str  ) 

Definiert in Zeile 1345 der Datei toolcmd.c.

Benutzt ALEFT, ARIGHT, data, Destruct(), FALSE, ME, SECURE2, TMP_FILE, TRUE, USAGE2, WDLN, XFindFile(), XFindObj(), XMoreFile(), XPROF_FILE und XPROF_MACRO.

01346 {
01347   string *funcs, inh, tmp;
01348   mixed *data, *d;
01349   mapping xpr;
01350   object obj;
01351   int i, rn;
01352 
01353   SECURE2(TRUE);
01354   USAGE2(str, "xprof <<-c>|<-C> <file>>|<object>");
01355   if(str[0..2]=="-c "||str[0..2]=="-C ")
01356   {
01357     rn=(str[1]=='C');
01358     if(str=XFindFile(str[3..]))
01359     {
01360       inh=str=str[0..<3];
01361       if(obj=find_object(inh))
01362                 Destruct(obj);
01363       if(catch(call_other(inh,"???")))
01364                 return TRUE;
01365       obj=find_object(inh);
01366       if(rn)
01367       {
01368                 inh+=".xprof.c";
01369                 rm(inh);
01370                 str+=".c";
01371                 rename(str, inh);
01372       }
01373       else
01374       {
01375                 str=XPROF_FILE;
01376                 rm(str);
01377       }
01378       tmp="inherit \""+inh+"\";\n#include \""+XPROF_MACRO+"\"\n";
01379       funcs=m_indices(mkmapping(functionlist(obj, 0x08000001)))-({"__INIT"});
01380       for(i=sizeof(funcs); i--;)
01381                 tmp+="F("+funcs[i]+",\""+funcs[i]+"\","+
01382                   "(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9))\n";
01383       write_file(str, tmp);
01384       WDLN("Done");
01385     }
01386   }
01387   else if(obj=XFindObj(str))
01388   {
01389     if(xpr=(mapping)obj->__query_xprof_data__())
01390     {
01391       funcs=m_indices(xpr);
01392       data=m_values(xpr);
01393       rm(TMP_FILE);
01394       str="Evaluation cost per function:\nNAME                                     "+
01395                 " CALLS |  TOT.EXCL.  TOT.INCL. | REL.EXCL. REL.INCL.\n";
01396       for(i=sizeof(funcs); i--;)
01397       {
01398                 if(d=data[i]) {
01399                   funcs[i]=ALEFT(""+funcs[i]+" ",25,".")+ARIGHT(" "+d[0], 6,".")+" | "+
01400                     ARIGHT(" "+d[1],10,".")     +" "+ARIGHT(" "+d[3],10,".")+" | "+
01401                     ARIGHT(" "+d[1]/d[0],9,".") +" "+ARIGHT(" "+d[3]/d[0],9,".");
01402                 }
01403       }
01404       str+=implode(sort_array(funcs, "string_compare", ME),"\n")+"\n";
01405       write_file(TMP_FILE,str);
01406       str="\nElapsed time per function:\nNAME                                     "+
01407                 " CALLS |  TOT.EXCL.  TOT.INCL. | REL.EXCL. REL.INCL.\n";
01408       funcs=m_indices(xpr);
01409       for(i=sizeof(funcs); i--;)
01410       {
01411                 if(d=data[i])
01412                 {
01413                   funcs[i]=ALEFT(""+funcs[i]+" ",25,".")+ARIGHT(" "+d[0], 6,".")+" | "+
01414                     ARIGHT(" "+(d[2]+5)/10+"ms",10,".")+" "+
01415                     ARIGHT(" "+(d[4]+5)/10+"ms",10,".")+" | "+
01416                     ARIGHT(" "+d[2]/d[0]+"us",9,".")+" "+
01417                     ARIGHT(" "+d[4]/d[0]+"us",9,".");
01418                 }
01419       }
01420       str+=implode(sort_array(funcs, "string_compare", ME),"\n")+"\n";
01421       write_file(TMP_FILE,str);
01422       XMoreFile(TMP_FILE, FALSE);
01423     }
01424     else
01425       WDLN("No profiling information available");
01426   }
01427   return TRUE;
01428 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xprops ( string  str  ) 

Definiert in Zeile 1430 der Datei toolcmd.c.

Benutzt DumpProperties(), flag, old_explode(), SECURE2, TK(), TRUE, USAGE2 und XFindObj().

01431 {
01432   int i, s, flag;
01433   object obj;
01434   string *tmp;
01435   
01436   SECURE2(TRUE);
01437   USAGE2(str, "xprop(s) [-f|-m] <object>");
01438   TK("Xprops: str: "+str);
01439   tmp=old_explode(str," ");
01440   switch(tmp[0])
01441   {
01442     case "-f":
01443     {
01444       flag = 1;
01445       tmp=tmp[1..];
01446       break;
01447     }
01448     case "-m":
01449     {
01450       flag = 2;
01451       tmp=tmp[1..];
01452       break;
01453     }
01454   }
01455   str=implode(tmp," ");
01456   if((obj=XFindObj(str)))
01457     DumpProperties(obj,flag);
01458   return TRUE;
01459 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xquit ( string  str  ) 

Definiert in Zeile 1461 der Datei toolcmd.c.

Benutzt cloner, ENV, SECURE2, TRUE und USAGE1.

01462 {
01463   SECURE2(TRUE);
01464   USAGE1(str, "xqu(it)");
01465   str=object_name(ENV(cloner));
01466   if(member(str, '#')<0)
01467     cloner->set_home(str);
01468   cloner->quit();
01469   return TRUE;
01470 }

int Xscan ( string  str  ) 

Definiert in Zeile 1472 der Datei toolcmd.c.

Benutzt FALSE, SECURE2, TRUE, USAGE1, VarCheck(), variable, W und WLN.

01473 {
01474   int i, s;
01475   string *oldvars, *desvars;
01476   
01477   SECURE2(TRUE);
01478   USAGE1(str, "xsc(an)");
01479   W("Destructed variable(s): ");
01480   oldvars=(string*)variable[0];
01481   VarCheck(FALSE);
01482   desvars=oldvars-(string*)variable[0];
01483   s=sizeof(desvars);
01484   for(i=0; i<s; i++)
01485   {
01486     W("$"+desvars[i]);
01487     if(i<s-1)
01488       W(", ");
01489   }
01490   WLN("");
01491   return TRUE;
01492 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xset ( string  str  ) 

Definiert in Zeile 1494 der Datei toolcmd.c.

Benutzt cloner, ENV, FALSE, member_array(), name, ObjFile(), remove_alist(), SECURE2, TRUE, USAGE1, VarCheck(), variable, WDLN, WLN und XFindObj().

01495 {
01496   int i;
01497   mixed obj;
01498   string name, tmp;
01499   
01500   SECURE2(TRUE);
01501   USAGE1(str, "xse(t) [$<name>=<object>]");
01502   if(str) {
01503     if(member_array(str,({"$me","$m","$here","$h"}))!=-1)
01504       WDLN("Sorry, this is a reserved variable ["+str+"]");
01505     else if(sscanf(str, "$%s=%s", name, tmp))
01506     {
01507       if(obj=XFindObj(tmp))
01508       {
01509                 variable=insert_alist(name, obj, variable);
01510                 WLN(" $"+name+"="+ObjFile(obj));
01511       }
01512     }
01513     else
01514       return FALSE;
01515   }
01516   else
01517   {
01518     VarCheck(FALSE);
01519     WLN("Current settings:");
01520     for(i=0; i<sizeof(variable[0]); i++) {
01521       if(variable[1][i])
01522                 WLN(" $"+variable[0][i]+"="+ObjFile(variable[1][i]));
01523       else variable=remove_alist(variable[0][i--], variable);
01524     }
01525     WLN(" $me="+ObjFile(cloner));
01526     WLN(" $here="+ObjFile(ENV(cloner)));
01527   }
01528   return TRUE;
01529 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xsh ( string  str  ) 

Definiert in Zeile 1531 der Datei toolcmd.c.

Benutzt NULL, old_explode(), scriptline, scriptsize, SECURE2, TRUE, USAGE1, WDLN, XExecFile() und XFindFile().

01532 {
01533   SECURE2(TRUE);
01534   USAGE1(str, "xsh <filename>");
01535   if(scriptline)
01536   {
01537     WDLN("Cannot execute another script file until last execution has ended");
01538     return TRUE;
01539   }
01540   if(!(str=XFindFile(str)))
01541     return TRUE;
01542   str=read_file(str, 1, 1000);
01543   if(!(scriptline=old_explode(str, "\n")))
01544   {
01545     WDLN("Bad script file");
01546     return TRUE;
01547   }
01548   scriptsize=sizeof(scriptline);
01549   XExecFile(NULL);
01550   return TRUE;
01551 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xsort ( string  str  ) 

Definiert in Zeile 1553 der Datei toolcmd.c.

Benutzt FALSE, file(), old_explode(), PIPE_FILE, pipe_if, pipe_in, PIPE_MAX, pipe_of, pipe_out, SECURE2, TK(), TRUE, USAGE2, USAGE3, WDLN und XFindFile().

01554 {
01555   string *tmp,file;
01556   int s,reverse;
01557 
01558   SECURE2(TRUE);
01559   TK("Xsort: str: "+str);
01560   if(!pipe_in)
01561   {
01562     USAGE2(str, "xso(rt) [-r] [file]");
01563     if(!(tmp=old_explode(str, " "))||(s=sizeof(tmp))>2)
01564       return FALSE;
01565     if(tmp[0]=="-r")
01566       if(s==1)
01567                 return FALSE;
01568       else
01569       {
01570                 reverse=TRUE;
01571                 tmp=tmp[1..];
01572       }
01573     else if(s>1)
01574       return FALSE;
01575     if(!(file=XFindFile(tmp[0])))
01576     {
01577       WDLN("Can't find file");
01578       return TRUE;
01579     }
01580   }
01581   else
01582   {
01583     if(str&&str!="")
01584       if(str=="-r")
01585                 reverse=TRUE;
01586       else
01587                 USAGE3("xso(rt) [-r]");
01588     if (file_size(file=pipe_if)<0)
01589     {
01590       WDLN("Missing input to xsort");
01591       return TRUE;
01592     }
01593   }
01594   tmp=old_explode(read_file(file,0,PIPE_MAX),"\n");
01595   if(pipe_in&&pipe_if==PIPE_FILE)
01596     rm(PIPE_FILE);
01597   tmp=sort_array(tmp,reverse?#'<:#'>);
01598     if (pipe_out&&pipe_of)
01599       write_file(pipe_of,implode(tmp,"\n")+"\n");
01600     else
01601       WDLN(implode(tmp,"\n"));
01602   return TRUE;
01603 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xtail ( string  str  ) 

Definiert in Zeile 1605 der Datei toolcmd.c.

Benutzt file(), lines, old_explode(), PIPE_FILE, pipe_if, pipe_in, PIPE_MAX, pipe_of, pipe_out, SECURE2, TK(), TRUE, WDLN, WLN und XFindFile().

01606 {
01607   string *tmp,file,sign;
01608   int lines;
01609 
01610   if (!str) {
01611     WDLN("Missing input to xtail");
01612     return TRUE;
01613   }
01614 
01615   sign="-";
01616   lines=10;
01617   SECURE2(TRUE);
01618   TK("Xtail: str: "+str);
01619   if(!pipe_in)
01620   {
01621     if(sscanf(str,"-%d %s",lines,file)==2)
01622       sign="-";
01623     else if(sscanf(str,"+%d %s",lines,file)==2)
01624       sign="+";
01625     else
01626       file=str;
01627 
01628     if(!(file=XFindFile(file)))
01629     {
01630       WDLN("Can't find file");
01631       return TRUE;
01632     }
01633   }
01634   else
01635   {
01636     if(sscanf(str,"-%d",lines)==1)
01637       sign="-";
01638     else if(sscanf(str,"+%d",lines)==1)
01639       sign="+";
01640     if (file_size(file=pipe_if)<0)
01641     {
01642       WDLN("Missing input to xtail");
01643       return TRUE;
01644     }
01645   }
01646 
01647   if(sign=="-")
01648   {
01649     if(!lines)
01650       return TRUE;
01651   }
01652 
01653   if(file_size(file)>50000)
01654   {
01655     WDLN("File too large");
01656     return TRUE;
01657   }
01658 
01659   if(sign=="+")
01660     tmp=old_explode(read_file(file,0,PIPE_MAX),"\n")[lines..];
01661   else
01662     tmp=old_explode(read_file(file,0,PIPE_MAX),"\n")[<lines..];
01663   if(pipe_in&&pipe_if==PIPE_FILE)
01664     rm(PIPE_FILE);
01665   if (pipe_out&&pipe_of)
01666     write_file(pipe_of,implode(tmp,"\n")+"\n");
01667   else
01668     WLN(implode(tmp,"\n"));
01669   return TRUE;
01670 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xtool ( string  str  ) 

Definiert in Zeile 1672 der Datei toolcmd.c.

Benutzt AUTOLOAD_ARGS, cloner, destruct(), Destruct(), FALSE, ME, MODE, MODE_ECHO, MODE_FIRST, MODE_INVCHECK, MODE_OFF, MODE_ON, MODE_PROTECT, MODE_SCANCHK, MODE_SHORT, MODE_VARCHECK, morelines, move(), restore_object(), SAVE_FILE, save_object(), SECURE2, TK(), TOOL_NAME, TOOL_NEWS, TOOL_PATH, TOOL_TITLE, TRUE, USAGE1, VarCheck(), WDLN, WLN und XMoreFile().

01673 {
01674   int m;
01675   string tmp;
01676   object obj;
01677   
01678   SECURE2(TRUE);
01679   TK("Xtool: str: "+str);
01680   USAGE1(str, "xto(ol) [update|first=<on|off>|protect=<on|off>|"+
01681                  "invcheck=<on|off>|\n"+
01682                  "\t\tvarcheck=<on|off>|scanchk=<on|off>|short=<on|off>|\n"+
01683                  "\t\techo=<on|off>|more=<amount>|kill|news|save|load|reset]");
01684   if(str&&str!="")
01685   {
01686     if(sscanf(str, "more=%d", m))
01687     {
01688       if(m<5)
01689                 WDLN("Sorry, amount of lines should be more then 5");
01690       else
01691       {
01692                 WDLN("Setting amount of displayed lines to "+m);
01693                 morelines=m;
01694       }
01695     }
01696     else
01697       switch(str)
01698       {
01699                 case "update":
01700                 if(obj=find_object(TOOL_PATH))
01701                   Destruct(obj);
01702                 if(catch(obj=clone_object(TOOL_PATH)))
01703                   WLN("Updating "+TOOL_TITLE+" failed!");
01704                 else
01705                   obj->update_tool(AUTOLOAD_ARGS, cloner);
01706                 return TRUE;
01707                 break;
01708                 case "first=on":
01709                 MODE_ON(MODE_FIRST);
01710                 move(cloner);
01711                 WDLN("Automatic moving into pole position of inventory turned on");
01712                 break;
01713                 case "first=off":
01714                 MODE_OFF(MODE_FIRST);
01715                 WDLN("Automatic moving into pole position of inventory turned off");
01716                 break;
01717                 case "protect=on":
01718                 MODE_ON(MODE_PROTECT);
01719                 WDLN("Protection from forces and illegal moves turned on");
01720                 break;
01721                 case "protect=off":
01722                 MODE_OFF(MODE_PROTECT);
01723                 WDLN("Protection from forces and illegal moves turned off");
01724                 break;
01725                 case "invcheck=on":
01726                 MODE_ON(MODE_INVCHECK);
01727                 WDLN("Automatic checking for new objects in inventory turned on");
01728                 break;
01729                 case "invcheck=off":
01730                 MODE_OFF(MODE_INVCHECK);
01731                 WDLN("Automatic checking for new objects in inventory turned off");
01732                 break;
01733                 case "varcheck=on":
01734                 MODE_ON(MODE_VARCHECK);
01735                 VarCheck(TRUE);
01736                 WDLN("Automatic variable checking turned on");
01737                 break;
01738                 case "varcheck=off":
01739                 MODE_OFF(MODE_VARCHECK);
01740                 WDLN("Automatic variable checking turned off");
01741                 break;
01742                 case "scanchk=on":
01743                 MODE_ON(MODE_SCANCHK);
01744                 WDLN("Scan check turned on");
01745                 break;
01746                 case "scanchk=off":
01747                 MODE_OFF(MODE_SCANCHK);
01748                 WDLN("Scan check turned off");
01749                 break;
01750                 case "echo=on":
01751                 MODE_ON(MODE_ECHO);
01752                 WDLN("Echoing of multiple command execution turned on");
01753                 break;
01754                 case "echo=off":
01755                 MODE_OFF(MODE_ECHO);
01756                 WDLN("Echoing of multiple command execution turned off");
01757                 break;
01758                 case "short=on":
01759                 MODE_ON(MODE_SHORT);
01760                 WDLN("Use of short descriptions turned on");
01761                 break;
01762                 case "short=off":
01763                 MODE_OFF(MODE_SHORT);
01764                 WDLN("Use of short descriptions turned off");
01765                 break;
01766                 case "kill":
01767                 WDLN(TOOL_NAME+" selfdestructs");
01768                 destruct(ME);
01769                 break;
01770                 case "news":
01771                 XMoreFile(TOOL_NEWS, FALSE);
01772                 break;
01773                 case "reset":
01774                 WDLN("Resetting "+TOOL_TITLE);
01775                 ME->__INIT();
01776                 break;
01777                 case "load":
01778                 if(file_size(SAVE_FILE+".o")>0)
01779                 {
01780                   WDLN("Loading "+TOOL_TITLE+" settings");
01781                   restore_object(SAVE_FILE);
01782                 }
01783                 else
01784                   WDLN("Sorry, cannot find file to load settings");
01785                 break;
01786                 case "save":
01787                 WDLN("Saving "+TOOL_TITLE+" settings");
01788                 save_object(SAVE_FILE);
01789                 break;
01790                 default:
01791                 return FALSE;
01792       }
01793   }
01794   else
01795   {
01796     WLN(TOOL_TITLE+" settings:");
01797     tmp= (" first .... = "+(MODE(MODE_FIRST) ? "on\n" : "off\n"));
01798     tmp+=(" protect .. = "+(MODE(MODE_PROTECT) ? "on\n" : "off\n"));
01799     tmp+=(" invcheck . = "+(MODE(MODE_INVCHECK) ? "on\n" : "off\n"));
01800     tmp+=(" varcheck . = "+(MODE(MODE_VARCHECK) ? "on\n" : "off\n"));
01801     tmp+=(" scanchk .. = "+(MODE(MODE_SCANCHK) ? "on\n" : "off\n"));
01802     tmp+=(" echo ..... = "+(MODE(MODE_ECHO) ? "on\n" : "off\n"));
01803     tmp+=(" short .... = "+(MODE(MODE_SHORT) ? "on\n" : "off\n"));
01804     tmp+=(" more ..... = "+morelines);
01805     WLN(sprintf("%-80#s", tmp));
01806   }
01807   return TRUE;
01808 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xtrace ( string  str  ) 

Definiert in Zeile 1810 der Datei toolcmd.c.

Benutzt file(), PrintShort(), SECURE2, short_path(), SUBSTR, TRACE_LEVEL, TRUE, USAGE1, WDLN und XFindObj().

01811 {
01812   string file;
01813   object obj;
01814   
01815   SECURE2(TRUE);
01816   USAGE1(str, "xtrac(e) <object>");
01817   if(!str||str=="")
01818   {
01819     trace(0);
01820     WDLN("Ending trace ["+short_path("/"+traceprefix(0))+"]");
01821   }
01822   else if(obj=XFindObj(str))
01823   {
01824     PrintShort("Tracing: ", obj);
01825     file=object_name(obj);
01826     file=SUBSTR(file, 1, -1);
01827     traceprefix(file);
01828     trace(TRACE_LEVEL);
01829   }
01830   return TRUE;
01831 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xtrans ( string  str  ) 

Definiert in Zeile 1833 der Datei toolcmd.c.

Benutzt cloner, CRNAME, ENV, MoveObj(), SECURE2, TRUE, USAGE2, WDLN und XFindObj().

01834 {
01835   object obj;
01836   
01837   SECURE2(TRUE);
01838   USAGE2(str, "xtran(s) <object>");
01839   if((obj=XFindObj(str))&&ENV(obj))
01840   {
01841     tell_room(ENV(obj), CRNAME(obj)+" vanishes.\n");
01842     tell_room(ENV(cloner), CRNAME(obj)+
01843                       " is teleported into this room by "+CRNAME(cloner)+".\n");
01844     MoveObj(obj, ENV(cloner), TRUE);
01845     tell_object(obj, "You've been teleported to "+CRNAME(cloner)+".\n");
01846   }
01847   else
01848     WDLN("Failed to teleport object");
01849   return TRUE;
01850 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xuclone ( string  str  ) 

Definiert in Zeile 247 der Datei toolcmd.c.

Benutzt cloner, Destruct(), ENV, ERR_FILE, error(), file(), MoveObj(), SECURE2, short_path(), TRUE, USAGE2, variable, W, WDLN, WLN und XFindFile().

00248 {
00249   object obj;
00250   string file, errlog, error;
00251   
00252   SECURE2(TRUE);
00253   USAGE2(str, "xuclo(ne) <filename>");
00254   if(!(file=XFindFile(str))) return TRUE;
00255   errlog=ERR_FILE;
00256   if(file_size(errlog)>0) rm(errlog);
00257   if(obj=find_object(file)) {
00258     Destruct(obj);
00259     WLN("Update and clone: "+short_path(file));
00260   }
00261   else
00262     WLN("Clone: "+short_path(file));
00263   if(!(error=catch(obj=clone_object(file))))
00264   {
00265     variable=insert_alist("clone", obj, variable);
00266     if(!MoveObj(obj, ENV(cloner), TRUE))
00267       WDLN("Cannot move object into this room");
00268     else if(!obj->QueryNoGet())
00269     {
00270       if(!MoveObj(obj, cloner, TRUE))
00271                 WDLN("Cannot move object into your inventory");
00272     }
00273   }
00274   else
00275     W("Error: "+error[1..]);
00276   return TRUE;
00277 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xupdate ( string  str  ) 

Definiert in Zeile 1852 der Datei toolcmd.c.

Benutzt Destruct(), file(), PrintShort(), pure_file_name, SECURE2, SUBSTR, TRUE, USAGE2, WDLN, XFindFile() und XFindObj().

01853 {
01854   object obj;
01855   string file;
01856   
01857   SECURE2(TRUE);
01858   USAGE2(str, "xup(date) <filename>");
01859   if(!(file=XFindFile(str)))
01860     return TRUE;
01861   if(SUBSTR(file, -2, -1)==".c")
01862     file=SUBSTR(file, 0, -3);
01863   if((obj=XFindObj(file))&&(obj=find_object(pure_file_name(obj))))
01864   {
01865     PrintShort("Updating: ", obj);
01866     Destruct(obj);
01867   }
01868   else
01869     WDLN("Object not found");
01870   return TRUE;
01871 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xuptime ( string  str  ) 

Definiert in Zeile 1873 der Datei toolcmd.c.

Benutzt TRUE.

01874 {
01875   return TRUE;
01876 }

int Xwc ( string  str  ) 

Definiert in Zeile 1878 der Datei toolcmd.c.

Benutzt FALSE, file(), lines, pipe_if, pipe_in, PIPE_MAX, SECURE2, TK(), TRUE, USAGE1, USAGE2, WDLN, WLN und XFindFile().

01879 {
01880   string file;
01881   string tmp, *tmp2;
01882   int i, chars, words, lines, nchars, nwords, nlines;
01883   
01884   SECURE2(TRUE);
01885   TK("Xwc: str: "+str);
01886   chars=words=lines=FALSE;
01887   if(!pipe_in)
01888   {
01889     USAGE2(str, "xwc [-cwl] <file>");
01890     if(str[0]=='-')
01891     {
01892       while((str=str[1..])[0]!=' '&&strlen(str))
01893                 switch(str[0])
01894                 {
01895                   case 'c':
01896                   chars=TRUE;
01897                   break;
01898                   case 'w':
01899                   words=TRUE;
01900                   break;
01901                   case 'l':
01902                   lines=TRUE;
01903                   break;
01904                   default:
01905                   return FALSE;
01906                 }
01907       str=str[1..];
01908     }
01909     if(!(file=XFindFile(str)))
01910     {
01911       WDLN("Can't find file");
01912       return TRUE;
01913     }
01914   }
01915   else
01916   {
01917     USAGE1(str,"xwc [-cwl]");
01918     if(str)
01919       if(str[0]=='-')
01920       {
01921                 while((str=str[1..])[0]!=' '&&strlen(str))
01922                   switch(str[0])
01923                   {
01924                     case 'c':
01925                     chars=TRUE;
01926                     break;
01927                     case 'w':
01928                     words=TRUE;
01929                     break;
01930                     case 'l':
01931                     lines=TRUE;
01932                     break;
01933                     default:
01934                     return FALSE;
01935                   }
01936       }
01937       else
01938                 return FALSE;
01939     if(file_size(file=pipe_if)<0)
01940     {
01941       WDLN("Missing input to xwc");
01942       return TRUE;
01943     }
01944   }
01945   if(!(chars|words|lines))
01946     chars=words=lines=TRUE;
01947   nlines=nwords=nchars=0;
01948   tmp=read_file(file,0,PIPE_MAX);
01949   tmp2=explode(tmp,"\n");
01950   if(lines)
01951   {
01952     nlines=sizeof(tmp2);
01953     if(tmp2[<1]==""&&nlines>1)
01954       nlines--;
01955   }
01956   if(words)
01957     for(i=sizeof(tmp2)-1;i>=0;i--)
01958     {
01959       TK(sprintf("%O",tmp2[i]));
01960       if(tmp2[i]!="")
01961                 nwords+=sizeof(regexplode(tmp2[i],"[            ]")-({""," ","  "}));
01962       TK(sprintf("%O",regexplode(tmp2[i],"[     ]")-({""," ","  "})));
01963       TK("nwords: "+nwords);
01964     }
01965   if(chars)
01966     for(i=sizeof(tmp2)-1;i>=0;i--)
01967       nchars+=strlen(tmp2[i])+1;
01968   tmp2=0;
01969   tmp="";
01970   if(lines)
01971     tmp+=sprintf("%7d",nlines)+" ";
01972   if(words)
01973     tmp+=sprintf("%7d",nwords)+" ";
01974   if(chars)
01975     tmp+=sprintf("%7d",nchars)+" ";
01976   if(file!=pipe_if)
01977     tmp+=file;
01978   WLN(tmp);
01979   return TRUE;
01980 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

int Xwho ( string  opt  ) 

Definiert in Zeile 1991 der Datei toolcmd.c.

Benutzt FALSE, ME, pipe_of, pipe_out, SECURE2, TK(), TRUE, USAGE1 und WLN.

01992 {
01993   string *strs,str,func;
01994   
01995   SECURE2(TRUE);
01996   TK("Xwho: opt: \""+opt+"\"");
01997   USAGE1(opt, "xwh(o) [mail|ip|race|guild|domain|stats|snoop]");
01998   func="string_compare";
01999   if(!opt||opt=="")
02000     strs=map(users(), "PlayerWho", ME);
02001   else
02002     switch(opt)
02003     {
02004       case "mail":
02005       strs=map(users(), "PlayerMail", ME, TRUE);
02006       break;
02007       case "ip":
02008       strs=map(users(), "PlayerIP", ME, TRUE);
02009       break;
02010       case "race":
02011       case "guild":
02012       strs=map(users(), "PlayerRace", ME, TRUE);
02013       break;
02014       case "domain":
02015       strs=map(users(), "PlayerDomain", ME, TRUE);
02016       break;
02017       case "stat":
02018       case "stats":
02019       strs=map(users(), "PlayerStats", ME, TRUE);
02020       break;
02021       case "snoop":
02022       strs=map(users(), "PlayerSnoop", ME, TRUE);
02023       break;
02024       case "cmdavg":
02025       strs=map(users(), "PlayerCmdAvg", ME, TRUE);
02026       func="cmdavg_compare";
02027       break;
02028       default:
02029       return FALSE;
02030     }
02031   strs=sort_array(strs, func, ME);
02032   if(pipe_out&&pipe_of)
02033     write_file(pipe_of,implode(strs,"\n")+"\n");
02034   else
02035     WLN(implode(strs,"\n"));
02036   return TRUE;
02037 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

Erzeugt am Thu Jun 3 14:40:08 2010 für MorgenGrauen Mudlib von  doxygen 1.6.3