blob: e561f9f9847d47b8a04563edc835bc067dd068c5 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001// $Id: magier_ext.c 9555 2016-05-03 20:42:46Z Zesstra $
2#pragma strict_types
3#pragma save_types
4//#pragma range_check
5#pragma no_clone
MG Mud User88f12472016-06-24 23:31:02 +02006
Zesstra876b0d62018-11-08 20:52:22 +01007protected functions virtual inherit "/std/util/path";
8
MG Mud User88f12472016-06-24 23:31:02 +02009#include <wizlevels.h>
10#include <logging.h>
11#include <magier.h>
12#include <snooping.h>
13#include <driver_info.h>
14#define NEED_PROTOTYPES
15#include <player/telnetneg.h>
16#include <player/base.h>
bugfix1b04afb2020-04-15 14:52:24 +020017#include <player/comm.h>
MG Mud User88f12472016-06-24 23:31:02 +020018#undef NEED_PROTOTYPES
19#include <properties.h>
20#include <files.h>
21#include <events.h>
MG Mud User88f12472016-06-24 23:31:02 +020022
23inherit "/std/shells/magier/parsing";
24inherit "/std/shells/magier/upd";
25inherit "/std/shells/magier/fileview";
26inherit "/std/shells/magier/objects";
27inherit "/std/shells/magier/fileedit";
28//inherit "/std/shells/magier/todo";
29inherit "/std/shells/magier/players";
30inherit "/std/shells/magier/admin";
31inherit "/std/shells/magier/moving";
32inherit "/std/shells/magier/comm";
33
34
35// #######
36//############################### SET #################################
37// #######
38
39
40//
41// _set(): Shell-Befehl 'set'
42// args: Kommandozeilenargumente
43//
44
45static int _set(mixed args)
46{
47 int pos;
48 string var;
49 mixed val;
50 mapping vars;
51
52 if(!args=_unparsed_args())
53 {
54 if(!sizeof(vars=QueryProp(P_VARIABLES)))
55 printf("Du hast noch keine Variablen definiert!\n");
56 else
57 {
58 printf("Du hast die folgenden Variablen definiert:\n");
59 walk_mapping(vars,((: printf(" %-20s = %s\n",$1,
60 pointerp($2)?implode($2,":"):$2) :)));
61
62 }
63 return 1;
64 }
65 pos = member(args,' ');
66 if(pos == -1)
67 if(sizeof(args))
68 {
69 m_delete(QueryProp(P_VARIABLES), args);
70 printf("Variable %s wurde geloescht.\n",args);
71 return 1;
72 }
73 else return USAGE("set <variable> <wert>");
74 var = args[0..pos-1];
75 val = (member(args[pos+1..],':')>-1?
76 explode(args[pos+1..], ":") :
77 args[pos+1..]);
78 vars=QueryProp(P_VARIABLES);
79 vars+= ([var : val]);
80 printf("Variable gesetzt: %s = %s\n",var,args[pos+1..]);
81 return 1;
82}
83
84// ############
85//############################# CD + PWD ###################################
86// ############
87
88static int _pwd()
89{
90 printf("Aktuelles Verzeichnis: %s\n",QueryProp(P_CURRENTDIR));
91 return 1;
92}
93
94static int _cd2(string cmdline)
95{
96 string dest,tmp;
97 int flags;
98 mixed *args;
99
100 args=parseargs(cmdline,&flags,CD_OPTS,1);
101 if (flags==-1) return 0;
102 if(flags&CD_B)
103 {
104 dest=QueryProp(P_LASTDIR);
105 }
106 if (sizeof(args)>1)
107 return notify_fail("Man kann sich (leider) nur in einem "
108 "Verzeichnis gleichzeitig befinden.\n"),0;
109 if(!dest)
110 {
111 if (!sizeof(args))
112 {
113 if (IS_WIZARD(this_object()))
114 dest="/players/"+getuid(this_object());
115 else
116 dest="/doc";
117 }
118 else
119 {
120 dest=args[0];
121 }
122 }
123
124 if (dest!="/")
125 {
126 args=file_list(({dest}),MODE_CD,0,"/");
127 args = filter(args, function int (mixed arr)
128 { return arr[FILESIZE] == FSIZE_DIR; } );
129
130 if (!sizeof(args))
131 return notify_fail("cd: "+dest+
132 ": Kein solches Verzeichnis gefunden.\n"),0;
133 if (sizeof(args)>1)
134 return notify_fail("cd: "+dest+": Maske ist nicht eindeutig.\n"),0;
135 dest=args[0][FULLNAME];
136 }
137 if (!IS_WIZARD(this_object())&&dest[0..3]!="/doc") dest="/doc";
138 SetProp(P_LASTDIR,QueryProp(P_CURRENTDIR));
139 printf("Aktuelles Verzeichnis ist jetzt: %s\n",SetProp(P_CURRENTDIR,dest));
140 tmp="";
141 if (((flags&CD_L)||
142 ((!m_contains(&tmp,QueryProp(P_VARIABLES),"CD_SHORT")||
143 tmp!="1")&&(!(flags&CD_S)))))
144 tell_object(this_object(),
145 read_file(dest+(dest[<1]=='/'?".readme":"/.readme"))||"");
146 return 1;
147}
148
149static int _cd(string cmdline)
150{
151 return _cd2(_unparsed_args());
152}
153
154static string _set_currentdir(string path)
155{
156 Set(P_CURRENTDIR, path);
bugfix1b04afb2020-04-15 14:52:24 +0200157 modify_prompt(); // Prompt mit neuem Pfad setzen, telnetneg
MG Mud User88f12472016-06-24 23:31:02 +0200158 return path;
159}
160
161private string _query_currentdir()
162{
163 string c;
164 if(!c=Query(P_CURRENTDIR))
165 return Set(P_CURRENTDIR, "/players/"+getuid(this_object()),F_VALUE);
166 return c;
167}
168
169// ##########
170//############################ PROMPT #################################
171// ##########
172
173//
174// _prompt_subst: Mudnamen, Usernamen, Zeilenvorschub in Eingabeauf-
175// forderung einbauen
176// str: Uebergebener Kommandozeilenabschnitt
177//
178
179private string _prompt_subst(string str)
180{
181 switch(str)
182 {
183 case "\\h": return sizeof(MUDNAME)?MUDNAME:"Mud ohne Namen";
184 case "\\u": return capitalize(getuid(this_object()));
185 case "\\n": return "\n";
186 case "\\t": return "\t";
187 case "\\w": return "\w";
188 }
189 return str;
190}
191
192
193//
194// _prompt: Eingabeaufforderung setzen
195// arg: Kommandozeile
196//
197
198static int _prompt(string args)
199{
200 string *pargs;
201
202 args=(extern_call()?_unparsed_args():args);
203 if (!sizeof(args)) args="> ";
204 if (args[0]=='"') args=args[1..<2]; //");
205 if(!sizeof(pargs = regexplode(args, "\\\\[thuwn]")))
206 return USAGE("prompt \"<Eingabeaufforderungsdefinition>\"");
207 pargs=map(pargs,#'_prompt_subst);
208
209 SetProp(P_PROMPT,implode(pargs,""));
210 return 1;
211}
212
213static string _set_prompt(string prompt) {
214 Set(P_PROMPT, prompt, F_VALUE);
bugfix1b04afb2020-04-15 14:52:24 +0200215 modify_prompt(); // neuen Prompt setzen (telnetneg.c)
MG Mud User88f12472016-06-24 23:31:02 +0200216 return prompt;
217}
218
219
220// ##############
221//############################ SHOWPRESAY ###############################
222// ##############
223
224static int _showpresay(string cmdline)
225{
226 int presay;
227 presay=QueryProp(P_CAN_FLAGS)&CAN_PRESAY;
228 cmdline=_unparsed_args(0);
229 if (!sizeof(cmdline))
230 {
231 printf("Dein Presay wird im Moment %sangezeigt.\n"
232 "%sschalten mit \'showpresay %s\'.\n",
233 presay?"":"nicht ",presay?"Aus":"Ein",
234 presay?"aus":"ein");
235 return 1;
236 }
237 if (cmdline=="ein"||cmdline=="an")
238 {
239 printf("Dein Presay wird jetzt angezeigt.\n");
240 SetProp(P_CAN_FLAGS,QueryProp(P_CAN_FLAGS)|CAN_PRESAY);
241 return 1;
242 }
243 if (cmdline=="aus")
244 {
245 printf("Dein Presay wird jetzt nicht mehr angezeigt.\n");
246 SetProp(P_CAN_FLAGS,QueryProp(P_CAN_FLAGS)&~CAN_PRESAY);
247 return 1;
248 }
249 return USAGE("showpresay [ein|an|aus]");
250}
251
252// ########
253//############################### EXEC ###############################
254// ########
255
256static int _exec(string filename)
257{
258 object ob;
259 if (!IS_LORD(this_object())) return 0;
260 if (this_player()!=this_interactive()) return 0;
261 if (this_player()!=this_object()) return 0;
262 if (!(filename=_unparsed_args())) return USAGE("exec <objektname>");
Zesstra876b0d62018-11-08 20:52:22 +0100263 filename=normalize_path(filename, getuid(), 1);
MG Mud User88f12472016-06-24 23:31:02 +0200264 if (file_size(filename)<0&&(!to_filename(filename+".c"))||
265 file_size(to_filename(filename+".c"))<0)
266 {
267 printf("exec: %s: Datei nicht vorhanden oder ein Verzeichnis.\n",filename);
268 return 1;
269 }
Zesstra876b0d62018-11-08 20:52:22 +0100270 if (catch(load_object(filename)))
MG Mud User88f12472016-06-24 23:31:02 +0200271 {
272 printf("exec: Fehler beim Laden von %s.\n",filename);
273 return 1;
274 }
275 if (!(ob=clone_object(filename))) return 0;
276 if (getuid(ob) != getuid(this_object()))
277 {
278 printf("exec: UID-Konflikt: %s <-> %s.\n",getuid(ob),
279 getuid(this_object()));
280 destruct(ob);
281 return 1;
282 }
283 log_file(SHELLLOG("EXEC"),
284 sprintf("%12.12s %40.40s %25.25s\n",
285 capitalize(getuid(this_object())),filename,dtime(time())[4..]));
286 disable_commands();
287 exec(ob,this_object());
288 if (interactive(this_object())||!interactive(ob))
289 {
290 enable_commands();
291 printf("Fehler bei EXEC: Uebertragung der Shell "
292 "nicht moeglich.\n");
293 return 1;
294 }
bugfixd94d0932020-04-08 11:27:13 +0200295 ({int})ob->start_player(capitalize(getuid(this_object())));
MG Mud User88f12472016-06-24 23:31:02 +0200296 remove();
297 return 1;
298}
299// ############
300//############################# SNOOPING ###############################
301// ############
302
303private nosave string snoop_allowed;
304private nosave object snoopee;
305
306nomask int QueryAllowSnoop(object who)
307{
308 return (getuid(who) == snoop_allowed);
309}
310
311static int _sallow(string str)
312{
313 object ob;
314
315 if (!sizeof(str))
316 {
317 if (!snoop_allowed) return USAGE("sallow [<name>]\n");
318 str=snoop_allowed;
319 snoop_allowed=0;
320 printf("Du entziehst %s die Erlaubnis zum Snoopen.\n",capitalize(str));
321 ob=query_snoop(this_player());
322 if (!ob||(getuid(ob)!=str)) return 1;
323 tell_object(ob,break_string(sprintf("%s entzieht Dir die "
324 "Erlaubnis zum snoopen und zwingt Dich so dazu, mit "
325 "dem Snoopen aufzuhoeren.\n",capitalize(getuid()))));
326 snoop(ob);
327 return 1;
328 }
329 if (snoop_allowed) _sallow(""); // Erstmal abschalten
330 ob=find_player(lower_case(str));
331 str=capitalize(str);
332 if (!ob) return
333 printf("sallow: Spieler %s konnte nicht gefunden werden.\n",str),1;
334 if (query_wiz_grp(ob)>query_wiz_grp(this_player()))
335 return printf("sallow: %s hat einen hoeheren Rang als Du und kann "
336 "Dich daher ohnehin snoopen.\n",str),1;
337 snoop_allowed=getuid(ob);
338 return printf("sallow: Du erlaubst %s, Dich zu snoopen.\n",str),1;
339}
340
341static int _snoop(string cmdline)
342{
343 object ob;
344 int flags;
345 string *args;
346
Zesstra12f4fc42020-04-28 22:56:50 +0200347#if __BOOT_TIME__ < 1588106971
348 if (!IS_ARCH(this_object()) && !IS_DEPUTY(this_object()))
349 {
350 printf("Snoopen koennen bis auf Weiteres nur Erzmagier.\n");
351 return 1;
352 }
353#endif
354
MG Mud User88f12472016-06-24 23:31:02 +0200355 if (!sizeof(cmdline=_unparsed_args())||
356 sizeof(args=parseargs(cmdline,&flags,SNOOP_OPTS,0))!=1||flags==-1)
357 {
358 if (!snoop(this_object())) return USAGE("snoop [-" SNOOP_OPTS
359 "] [<spieler>]\n");
360 if (snoopee)
361 printf("Du snoopst %s jetzt nicht mehr.\n",capitalize(getuid(snoopee)));
362 else
363 {
364 printf("Du hoerst auf zu snoopen.\n");
365 // evtl. irgendetwas loggen ... sollte eigentlich nicht passieren.
366 }
Vanion50652322020-03-10 21:13:25 +0100367 snoopee=0;
MG Mud User88f12472016-06-24 23:31:02 +0200368 return 1;
369 }
370 SetProp(P_SNOOPFLAGS,flags); // FUNKTIONIERT NUR, WENN magier.h und
371 // snooping.h abgeglichen sind
372 if (!(ob = find_player(args[0])))
373 return printf("snoop: Konnte keinen Spieler '%s' finden.\n",
374 capitalize(args[0])),1;
375 if (!snoop(this_player(),ob))
376 return printf("snoop: Der Versuch, %s zu snoopen, ist "
377 "fehlgeschlagen.\n%s",capitalize(args[0]),
378 ((~flags)&SNOOP_F)?"Eventuell funktioniert es mit dem "
379 "Flag '-f'.\n":""),1;
380 snoopee=ob;
381 return printf("Du snoopst jetzt %s.\n",capitalize(getuid(ob))),1;
382}
383
384
385// ##########
386//############################ MSCHAU #################################
387// ##########
388
389static int _mschau(string str)
390{
391 if (this_interactive()!=this_object()) return 0;
392 if (str=="ja"||str=="an"||str=="ein")
393 {
394 if ( QueryProp(P_WANTS_TO_LEARN) )
395 printf("Du hast den Magier-Modus doch schon eingeschaltet!\n");
396 else
397 {
398 printf("Du hast jetzt den Magier-Modus eingeschaltet.\n" );
399 SetProp(P_WANTS_TO_LEARN, 1);
400 }
401 return 1;
402 }
403 if (str=="nein"||str=="aus")
404 {
405 if (QueryProp(P_WANTS_TO_LEARN))
406 {
407 printf( "Du schaltest den Magier-Modus aus.\n");
408 set_heart_beat(1);
409 SetProp(P_WANTS_TO_LEARN,0);
410 }
411 else
412 printf("Du hast den Magier-Modus doch schon ausgeschaltet.\n");
413 return 1;
414 }
415 if (str=="+debug")
416 {
417 printf("Du nimmst jetzt Debugausgaben wahr.\n");
418 SetProp(P_WIZ_DEBUG,1);
419 return 1;
420 }
421 if (str=="-debug")
422 {
423 printf("Du nimmst jetzt keine Debugausgaben mehr wahr.\n");
424 SetProp(P_WIZ_DEBUG,0);
425 return 1;
426 }
427 return USAGE("mschau [an|ein|ja|aus|nein|+debug|-debug]\n");
428}
429
430// ###########
431//############################ PROTECT ################################
432// ###########
433
434static int _protect(string str)
435{
436
437 if (this_object()!=this_interactive()) return 0;
438 if (!sizeof(str))
439 return USAGE("protect <propertyname>\n");
440 Set(str, PROTECTED, F_MODE);
441 return printf("Deine Property %s ist jetzt %sgeschuetzt.\n",
442 str,(Query(str,F_MODE) & PROTECTED?"":"nicht mehr ")),1;
443}
444
445
446// ###############
447//########################## VIS + INVIS ##############################
448// ###############
449
450static int _hbstop;
451static int _age;
452
453static int _invis(string inform)
454{
455
456 if (QueryProp(P_INVIS))
457 return printf("Du bist doch schon unsichtbar!\n"),1;
458 tell_room(environment(),sprintf("%s %s.\n",capitalize(Name()),
459 QueryProp(P_MMSGOUT)),({ this_object() }));
460 if (inform=="e") {
461 // Logout-event ausloesen
bugfixd94d0932020-04-08 11:27:13 +0200462 ({int})EVENTD->TriggerEvent(EVT_LIB_LOGOUT, ([
MG Mud User88f12472016-06-24 23:31:02 +0200463 E_OBJECT: this_object(),
464 E_PLNAME: getuid(this_object()),
465 E_ENVIRONMENT: environment() ]) );
466
467 call_notify_player_change(0);
468 }
469
470 SetProp(P_INVIS, QueryProp(P_AGE));
471 printf("Du bist jetzt unsichtbar.\n");
472 return 1;
473}
474
475static int _vis(string inform)
476{
477 if (!QueryProp(P_INVIS))
478 return printf("Du bist doch schon sichtbar.\n"),1;
479 tell_room(environment(),sprintf("%s %s.\n",capitalize(Name()),
480 QueryProp(P_MMSGIN)),({ this_object() }));
481 SetProp(P_INVIS, 0);
482 if (inform=="e") {
483 // Login-event ausloesen
bugfixd94d0932020-04-08 11:27:13 +0200484 ({int})EVENTD->TriggerEvent(EVT_LIB_LOGIN, ([
MG Mud User88f12472016-06-24 23:31:02 +0200485 E_OBJECT: this_object(),
486 E_PLNAME: getuid(this_object()),
487 E_ENVIRONMENT: environment() ]) );
488
489 call_notify_player_change(1);
490 }
491 printf("Du bist jetzt sichtbar.\n");
492 return 1;
493}
494
495// ############
496//########################### LOCALCMD ###############################
497// ############
498
499
500static int _localcmd()
501{
502 int size,more;
503 string *verbs,result;
504
505 // Per Umweg ueber Mapping doppelte Werte einstampfen
506 size=sizeof(verbs=m_indices(mkmapping(query_actions(this_object()))));
507 verbs-=({""});
508 more=(size>sizeof(verbs));
509 if (!sizeof(verbs))
510 {
511 if (more)
512 printf("Die vorhandenen Befehle koennen nicht angezeigt werden, "
513 "da sie per 'add_action(\"funktion\",\"\",1)' definiert "
514 "wurden.\n");
515 else
516 printf("Dir stehen keine Befehle zur Verfuegung ... eigenartig!\n");
517 return 1;
518 }
519 verbs=sort_array(verbs,#'>);
520 result=break_string(sprintf("\'%s\'",implode(verbs,"' '")),78);
521 return printf("\n%'-'78.78s\nDie fuer Dich aktuell verfuegbaren "
522 "Befehle sind:\n\n%s\n%s%'-'78.78s\n","",result,
523 more?"Zudem wurden Befehle per 'add_action("
524 "\"funktion\",\"\",1)' definiert.\n":"",""),1;
525}
526
527// ###########
528//############################ TRAENKE ################################
529// ###########
530
531static int _traenke(string str)
532{
533 if(SetProp(P_TRANK_FINDEN, !QueryProp(P_TRANK_FINDEN)))
534 write("Du kannst jetzt Zaubertraenke finden.\n");
535 else
536 write("Du findest jetzt keine Zaubertraenke mehr.\n");
537 return 1;
538}
539
540static int norm_rusage() {
541 mixed* r;
542 r = rusage();
543 return r[0]/100 + r[1]/100;
544}
545
546// #############
547//############################ ASYNCHRON #################################
548// #############
549
550//
551// asynchron(): Asynchrone Abarbeitung eines Arrays
552// array: Zu bearbeitendes Array
553// cmd: Auszufuehrende Closure
554// data: Extraargumente
555// flags: Zusatzdaten (normalerweise Flags)
556// c: schon asynchron?
557//
558
559static varargs void asynchron(mixed* array, closure cmd, mixed data, mixed flags,int c)
560{
561 int i, j, k;
562 mixed ret_val;
563 string cmd_string;
564
565 k = norm_rusage()+5;
566 j = sizeof(array);
567 i=0;
568
569 switch (cmd_string=explode(sprintf("%O",cmd),"->")[1])
570 {
571 case "_make": cmd_string=(data&UPD_LOAD?"load":"upd");break;
572 case "cp_file": cmd_string =(data?"mv":"cp"); break;
573 case "grep_file": cmd_string = "grep"; break;
574 case "rm_file": cmd_string = "rm"; break;
575 default: break;
576 }
577
578 while(i < j && get_eval_cost() > 200000 && norm_rusage()<k)
579 // Sowohl Too-Long-Eval als auch Lag verhindern
580 {
581 ret_val=apply(cmd,array[i],data, flags);
582 if (closurep(ret_val))
583 {
584 if(c) tell_object(this_object(),
585 sprintf("%s: Verlasse Asynchronen Modus.\n",cmd_string));
586 funcall(ret_val,array[i..],data,flags);
587 return;
588 }
589 if (ret_val==RET_DELETE)
590 {
591 array[i+array[i][SUBDIRSIZE]+1..i+array[i][SUBDIRSIZE]]=
592 ({ (array[i][0..5]+({0})) });
593 }
594 if (ret_val==RET_JUMP) i+=array[i][SUBDIRSIZE];
595 i++;
596 }
597 if(sizeof(array = array[i..]))
598 {
599 if(!c) tell_object(this_object(),
600 sprintf("%s: Asynchroner Modus aktiviert!\n", cmd_string));
601 call_out(#'asynchron, 1, array, cmd, data,flags, 1);
602 }
603 else
604 {
605 if(c) tell_object(this_object(),
606 sprintf("%s: abgeschlossen.\n",cmd_string));
607 else if (query_verb()) tell_object(this_object(),
608 sprintf("%s: abgeschlossen.\n",query_verb()));
609 }
610 return;
611}
612
613//
614// ######################## Driver Status Infos ##########################
615//
616static int _driver_malloc(string str)
617{
618 if(!sizeof(str))
619 {
620 write(efun::driver_info(DI_STATUS_TEXT_MALLOC));
621 return 1;
622 }
623 if(str == "extstats")
624 {
625 write(efun::driver_info(DI_STATUS_TEXT_MALLOC_EXTENDED));
626 return 1;
627 }
628 return 0;
629}
630
631static int _driver_dumpallobj(string str)
632{
633 write("Dumping to /OBJ_DUMP ... ");
634 efun::dump_driver_info(DDI_OBJECTS);
635 efun::dump_driver_info(DDI_OBJECTS_DESTRUCTED);
636 write("done\n");
637 return 1;
638}
639
640static int _driver_opcdump(string str)
641{
642 efun::dump_driver_info(DDI_OPCODES);
643 return 1;
644}
645
646static int _driver_status(string str)
647{
648 int opt;
649
650 switch(str || "")
651 {
652 case "":
653 opt = DI_STATUS_TEXT_MEMORY;
654 break;
655
656 case "tables":
657 case " tables":
658 opt = DI_STATUS_TEXT_TABLES;
659 break;
660
661 case "swap":
662 case " swap":
663 opt = DI_STATUS_TEXT_SWAP;
664 break;
665
666 case "malloc":
667 case " malloc":
668 opt = DI_STATUS_TEXT_MALLOC;
669 break;
670
671 case "malloc extstats":
672 case " malloc extstats":
673 opt = DI_STATUS_TEXT_MALLOC_EXTENDED;
674 break;
675
676 default:
677 return 0;
678 }
679 write(efun::driver_info(opt));
680 return 1;
681}
682
683// ###################
684//########################## INITIALISIERUNG #############################
685// ###################
686
687//
688// _query_localcmds: Welche Kommandos werden in dieser Datei implementiert?
689//
690
691static mixed _query_localcmds()
692{
693 return ({
694 ({"set","_set",0,LEARNER_LVL}),
695 ({"pwd","_pwd",0,LEARNER_LVL}),
696 ({"cd","_cd",0,LEARNER_LVL}),
697 ({"prompt","_prompt",0,LEARNER_LVL}),
698 ({"showpresay","_showpresay",0,LEARNER_LVL}),
699 ({"exec","_exec",0,ARCH_LVL}),
700 ({"sallow","_sallow",0,LEARNER_LVL}),
701 ({"snoop","_snoop",0,WIZARD_LVL}),
702 ({"mschau","_mschau",0,LEARNER_LVL}),
703 ({"protect","_protect",0,WIZARD_LVL}),
704 ({"invis","_invis",0,LEARNER_LVL}),
705 ({"vis","_vis",0,LEARNER_LVL}),
706 ({"localcmd","_localcmd",0,LEARNER_LVL}),
707 ({"traenke","_traenke",0,DOMAINMEMBER_LVL}),
708 ({"malloc","_driver_malloc",0,LEARNER_LVL}),
709 ({"dumpallobj","_driver_dumpallobj",0,ARCH_LVL}),
710 ({"opcdump","_driver_opcdump",0,ARCH_LVL}),
711 ({"status","_driver_status",0,LEARNER_LVL}),
712 })
713 +fileview::_query_localcmds()
714 +upd::_query_localcmds()
715 +objects::_query_localcmds()
716 +fileedit::_query_localcmds()
717// +todo::_query_localcmds()
718 +players::_query_localcmds()
719 +admin::_query_localcmds()
720 +moving::_query_localcmds()
721 +comm::_query_localcmds();
722}
723
724//
725// initialize: Initialisierung der Shell
726//
727
728static void initialize()
729{
730 Set(P_PROMPT, SAVE, F_MODE_AS);
731 Set(P_VARIABLES,SAVE,F_MODE_AS);
732 Set("filesys",SAVE,F_MODE_AD); // P_FILESYS ist obsolet
733 Set("short_cwd",SAVE,F_MODE_AD); // P_SHORT_CWD auch
734 if(!mappingp(QueryProp(P_VARIABLES)))
735 SetProp(P_VARIABLES, ([]));
736 _prompt(QueryProp(P_PROMPT));
737// todo::initialize();
738 _cd2("");
739 return;
740}
741
742static void reconnect() { _cd(QueryProp(P_CURRENTDIR)); }