-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmudsh-1.2.perl
executable file
·705 lines (676 loc) · 20.8 KB
/
mudsh-1.2.perl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
#MUD Shell
#(C)2001 Dean "Gandalf" Swift and Xirium
#
#20010209 Gandalf: idea taken from comments on SlashDot.Org
#20010210 Gandalf: start
#20010211 Gandalf: save
#20010212 Gandalf: save test
#20010213 Gandalf: save
#20010214 Gandalf: save test
#20010218 Gandalf: save
#20010302 Gandalf: save fix spacing, add comments
# Examine command contributed by Ron Broberg
# Stat command fixed by Bernard Yap
#20010307 Gandalf: start themes
#This subroutine, &disp, formats text to 72 columns.
#This is done by using a ruler, $width, to copy the first 72 characters from $in to $line.
#The last space is located and surplus from the next character is returned by prepending it to $in.
#There are exceptions for strings containing "\n", although these are not tested.
#Very long words have undefined results and hyphenation is not implemented.
sub disp
{
$width="."x72;
$in=shift;
if($in ne "")
{
print("\n");
}
while(length($in)>length($width))
{
$in=~s/^($width)//s;
$line=$1;
if($line=~/\n/s)
{
$line=~s/^(.*)\n(.*)$/$1/s;
$in=$2.$in;
}
else
{
$line=~s/^(.*) (.*)$/$1/s;
$in=$2.$in;
}
print("$line\n");
}
print("$in\n");
$disp_flag=1;
}
#For non null input, &disp, outputs a blank line before any other output.
#&disp can be called multiple times, so, to ensure single blank lines between uses of &disp and to ensure a blank after the final use, a flag, $disp_flag is set.
#&disp_space only outputs a blank line if &disp has been called then the flag is cleared.
sub disp_space
{
if($disp_flag==1)
{
print "\n";
$disp_flag=0;
}
}
sub inv_add
{
}
sub inv_sub
{
}
#-Message inv-empty You are carrying nothing and you have no weapons.
sub inv_disp
{
&disp($message{"inv-empty"});
}
#read configuration file specified as only parameter.
#currently collected configuration information is stored in @alias, @des and @message.
#aliases are not case sensitive, descriptions and messages are case sensitive.
sub conf_read
{
$temp0=shift;
if(-r $temp0)
{
open(FILE,$temp0);
while(defined($line=<FILE>))
{
$line=~s/^\#\-//;
$line=~s/[\n\r]*$//;
if($line!~/^\#/)
{
($temp0,$temp1,$temp2)=split(/[ \t]+/,$line,3);
$temp0=~tr/[a-z]/[A-Z]/;
if($temp0 eq "ALIAS")
{
$temp1=~tr/[a-z]/[A-Z]/;
$temp2=~tr/[a-z]/[A-Z]/;
$alias{$temp1}=$temp2;
}
elsif($temp0 eq "DESCRIBE")
{
$temp2=~s/\\n/\n/g;
$temp2=~s/\\\\/\\/g;
$des{$temp1}=$temp2;
}
elsif($temp0 eq "MESSAGE")
{
$message{$temp1}=$temp2;
}
else
{
#should output error here
}
}
}
close(FILE);
}
}
#The following comments form part of the default theme.
#The comments are stored in @des when the prog reads itself as configuration.
#Directives in this format can be added to separate "theme" configuration files.
#In theme files, directives must not be preceded with "#-".
#This is for upward compatibility.
#-Describe / You are in a desert. A tumbleweed passes. You see a signpost but the words are obscure and abbreviated. Footprints indicate that the gurus have passed here many times before. If you stay here long enough, you will grow a beard.
#-Describe /dev You are in the vast engine room of an alien spacecraft. Or it might be a holographic projection room. There are many exotic instruments, gauges, blinking lights and a sign in another language. Do not touch!
#-Describe /etc You are in a junkyard. Well, you think it is a junkyard. Scrap metal and wood is piled conically all around you. You see crude, fearsome machines but you are unsure of their purpose. A stone tablet of names and encrypted passwords hangs from a crane. This rubble was once an important building.
#-Describe /bin You are in the reference section of an old library. It is extremely dusty and hard to read the book titles. You can tell that this was once a place of profound discovery in golden era. You feel that this place may be useful in an emergency.
#-Describe /tmp You are in a large deserted marketplace. The weather is overcast and you feel cold. The flagstones are uneven and newspaper soaks in a small puddle. Occasionally, useful information can be found here.
#-Describe /usr You are in a tall, sparkling glass building. The building is curved and clear except for the light green turrets. A flying car passes.
#-Describe /usr/local You are in a modern town.
#-Describe /var You are in the lobby of a hotel.
#-Describe /var/spool You are in the lounge of a hotel. You hear tasteful music playing quietly. Low comfy seating is arranged around palm trees and ferns. Soft lighting shines from the white ceiling. You would feel uneasy staying here too long.
#-Describe /root You see a vast cavern with no quota limit. There might be treasure here but it is too dark to see. The walls by the entrance are scorched. A wise old dragon lives here. The dragon is subtle and quick to anger. Should you be here?
#-Describe /proc You are in an office. You see many cubicles and hear a humming noise from the nearby supercomputer. Or maybe the hum is the air conditioning.
#-Describe /opt You see a newly created cavern. Two gurus are arguing over the usefulness of this new area. Bugs and bloatware have already infested the area. You see some vendorware in the distance.");
#-Describe /opt/xirium You are not sure why this room is here. A bell rings as you open the glass door. You see an arrangement of scrolls and a quaint photocopier, which is free to use. There is a generic desk with a generic sign that says "[email protected]". You see an assortment of gadgets, some unfinished. Finally, you see some bones. A wumpus has eaten the shopkeeper.
#-Describe /boot You are in a cave. This place was the beginning of civilisation.
#-Describe /site You are in a trendy suburb. Residential and commercial properties are intermixed.");
#&describe checks for a description previously read from a theme.
#If none is found, an attempt is made to read ".mudshrc" in the current directory.
#If this is not the case, one of the defaults is tried.
#Descriptions in the theme take precedence.
#This is followed by descriptions in the filing system, although for some directories, such as /proc and /tmp , this is not practical.
#-Message directory-empty (Empty Directory)
#-Message exits Exits
#-Message direction-north North
#-Message direction-east East
#-Message direction-south South
#-Message direction-west West
#-Message direction-up Up
#-Message direction-home Home
#-Message direction-none (None)
sub describe
{
if(defined($des{$cwd}))
{
#use description from theme
&disp($des{$cwd});
}
elsif(-r ".mudshrc")
{
#print description found in .mudshrc in current directory
local($/);
open(FILE,".mudshrc");
$buffer=<FILE>;
$buffer=~s/\n\r/\n/gm;
$buffer=~s/\r\n/\n/gm;
$buffer=~s/\r/\n/gm;
$buffer=~s/\n$//gm;
&disp($buffer);
close(FILE);
}
else
{
#use default
if(($cwd eq "/usr/local/bin")||($cwd eq "/usr/bin"))
{
&disp("You are in a modern factory. Many of the machines form a single automated production line. Occasionally, a machine makes a loud noise, but there is no pattern.");
}
elsif(($cwd eq "/usr/local/lib")||($cwd eq "/usr/lib"))
{
&disp("You are in workshop. You see many interesting tools. Some are general purpose and some are for highly specialised uses.");
}
elsif(($cwd eq "/usr/local/man")||($cwd eq "/usr/man"))
{
&disp("You are standing by an information kiosk. The kiosk has a curved front and is painted in white, dark green and purple. It is quite gaudy. You see many leaflets on exotic subjects. The leaflets are written in a strange, terse language, but are extensively cross referenced. No one is present, but you see a sign that says \"Please take a leaflet or five\".");
}
elsif(($cwd eq "/var/spool/mail")||($cwd eq "/var/mail"))
{
&disp("You are in an oak panel room with plush carpet. You see pigeon holes for people's mail. You are curious and want to read. There are tubes to deliver mail and tubes to send mail. A mangle sits in the corner.");
}
elsif(($cwd eq "/usr/tmp")||($cwd eq "/var/tmp"))
{
&disp("You squeeze past a tall metal gate with a notice that reads \"Property left here at owners risk\". You see a concrete yard with a large bin. People don't come here any more, not since the machines replaced the workers.");
}
elsif($cwd=~/\/lost\+found$/)
{
&disp("You are in a lost property office.");
}
elsif($cwd eq "/mnt")
{
&disp("You are at an airport.");
}
elsif($cwd=~/\/mnt\/[^\/]+$/)
{
&disp("You are in an airplane.");
}
elsif(($cwd eq "/home")||($cwd=~/^\/[^\/]*\/home$/))
{
&disp("This is the home of the lesser gurus and the neophytes. You see pasty people sleeping. Some have a keyboard pattern imprinted on one side of their faces. These people need to get out more.");
}
elsif($cwd=~/\/home[^\/]*\/gandalf/)
{
&disp("You are in a disorganised room.");
}
elsif(($cwd eq "/www")||($cwd eq "/home/httpd/html"))
{
&disp("You are in the centre of a vast printing room. Loud machines surround you and they are producing thousands of informative magazines every minute. The noise is deafening.");
}
elsif((($cwd=~/^\/www\//)&&($cwd=~/\/cgi-bin$/))||($cwd eq "/home/httpd/cgi-bin"))
{
&disp("You are standing in a custom printing room. The most bizarrely designed machines are brought from miles around to work in this room. Steam prevents you seeing clearly.");
}
elsif(($cwd eq "/www-log")||($cwd eq "/home/httpd/logs")||($cwd eq "/usr/local/apache/logs"))
{
&disp("You are in the accounting room of the printers. Open ledgers can be found on elf size wooden desks. You wish the elves would write more clearly and spend less time getting drunk.");
}
elsif($cwd=~/^\/site\/[^\/]+\/www$/)
{
&disp("You are in a small office.");
}
}
print "\n";
$temp0=`ls -CF`;
if($temp0 eq "")
{
$temp0=$message{"directory-empty"}."\n";
}
print $temp0;
$temp0="";
if($dir_n ne "")
{
$temp0.=" ".$message{"direction-north"};
}
if($dir_e ne "")
{
$temp0.=" ".$message{"direction-east"};
}
if($dir_s ne "")
{
$temp0.=" ".$message{"direction-south"};
}
if($dir_w ne "")
{
$temp0.=" ".$message{"direction-west"};
}
if($temp0 eq "")
{
$temp0=" ".$message{"direction-none"};
}
&disp($message{"exits"}.":$temp0.");
}
#&scout identifies target directories for navigation.
#(Replace this bit to *really* confuse your users.)
#If not in root directory, you can go North.
#If not in root directory, obtain the names of the items in the parent directory in alphabetical order.
#For all of the readable directories found in the parent directory, create a window of three items.
#Terminate loop if current directory is middle element of window.
#First and last elements of window are East and West.
#Obtain the names of the items in the current directory in alphabetical order.
#The first readable directory is South.
#A null string indicates that an exit is not available.
#(This algorithm will change so that North and South are consistant and Up works how North currently does.)
sub scout
{
$dir_w="";
$dir_e="";
$dir_s="";
if($cwd eq "/")
{
$dir_n="";
}
else
{
$dir_n="..";
#scout West and East: search for sibling directories here
@temp0=glob("../*");
$temp1=$cwd;
$temp1=~s/.*\///;
$temp1=~s/([^0-9A-Za-z])/\\$1/g;
$flag=0;
$x=0;
for($x=0;($x<@temp0)&&($flag==0);$x++)
{
if(((((stat($temp0[$x]))[2])&040000)!=0)&&(-r $temp0[$x]))
{
if($temp0[$x]=~/$temp1$/)
{
$flag=1;
}
else
{
$dir_w=$temp0[$x];
}
}
}
for(;($x<@temp0)&&($dir_e eq "");$x++)
{
if(((((stat($temp0[$x]))[2])&040000)!=0)&&(-r $temp0[$x]))
{
$dir_e=$temp0[$x];
}
}
}
#scout South: search for first child directory here
@temp0=glob("*");
for($x=0;($x<@temp0)&&($dir_s eq "");$x++)
{
if(((((stat($temp0[$x]))[2])&040000)!=0)&&(-r $temp0[$x]))
{
$dir_s=$temp0[$x];
}
}
}
#Attempt to change directory.
#This routine reports an error to output if directory change is not possible.
#-Message cd-cannot You cannot go in that direction.
#-Message cd-deny A force field is blocking you. Your face is squashed and it tingles.
#-Message cd-unknown This exit does not exist. You feel confused.
sub cd
{
$dir=shift;
if($dir eq "")
{
&disp($message{"cd-cannot"});
}
else
{
if(chdir($dir))
{
$cwd=`pwd`;
$cwd=~s/\n//;
&scout();
$xp++;
}
else
{
if(-e $dir)
{
&disp($message{"cd-deny"});
}
else
{
&disp($message{"cd-unknown"});
}
}
}
return(1);
}
#&go maps directions to directory names found by &scout before calling &cd.
#Not sure if use of glob here has a bug.
sub go
{
if(($c eq "NORTH")||($c eq "N")||($c eq "UP")||($c eq ".."))
{
return(&cd($dir_n));
}
elsif(($c eq "WEST")||($c eq "W"))
{
return(&cd($dir_w));
}
elsif(($c eq "EAST")||($c eq "E"))
{
return(&cd($dir_e));
}
elsif(($c eq "SOUTH")||($c eq "S"))
{
return(&cd($dir_s));
}
elsif(($c eq "HOME")||($c eq "H"))
{
$temp=glob("~");
return(&cd($temp));
}
return(0);
}
#Array of words is passed to &parse.
#Words are decoded from the beginning and discarded as they are interpreted.
#$c should always be capitalised, with trailing punctuation removed, which speeds and simplifies decode.
#(Ensuring the consistancy of $c when the array is shifted should be the action of a subroutine.)
#Some commands grab the whole line, others allow further commands to be appended.
#Glue words, such as "and" are ignored but unknown words halt decode, possibly after partial decode.
#-Message direction-ambiguous This direction is ambiguous.
#-Message directory-ambiguous This directory is ambiguous.
#-Message demo-move This is the demo version of MUDShell. You cannot move files.
#-Message demo-read This is the demo version of MUDShell. You cannot view files.
#-Message demo-edit This is the demo version of MUDShell. You cannot edit files.
sub parse
{
*command=shift;
while(@command)
{
$c=$command[0];
$c=~tr/[a-z]/[A-Z]/;
$c=~s/([0-9A-Z])[^0-9A-Z]$/$1/;
if(defined($alias{$c}))
{
$c=$alias{$c};
}
if(($c eq "HELP")||($c eq "H")||($c eq "?")||($c eq "MAN"))
{
&disp("MUDShell Help\n\nAvailable commands are: GO direction, CD directory, LOOK, EXAMINE object, INVENTORY or INV, TAKE objects, DROP objects, TALK, SHOUT, WHISPER, EMOTE gesture, READ files or VIEW files, EDIT files or OPEN files, KILL files, STAT, EXIT. Warning: KILL may remove files permanantly.");
if($exec_flag==1)
{
$temp="currently enabled";
}
else
{
$temp="not available from this login shell";
}
&disp("Prefix an explanation mark (\"!\") to execute proper shell commands. (This feature is $temp.)");
shift(@command);
}
elsif($c eq "GO")
{
shift(@command);
$c=$command[0];
$c=~tr/[a-z]/[A-Z]/;
$c=~s/([0-9A-Z])[^0-9A-Z]$/$1/;
if(!&go())
{
@temp=glob($command[0]);
if(@temp>1)
{
&disp($message{"direction-ambiguous"});
}
else
{
&cd($temp[0]);
}
}
shift(@command);
}
elsif(&go())
{
shift(@command);
}
elsif($c eq "CD")
{
shift(@command);
@temp=glob($command[0]);
if(@temp>1)
{
&disp($message{"directory-ambiguous"});
}
else
{
&cd($temp[0]);
}
shift(@command);
}
elsif($c eq "LOOK")
{
&describe();
$xp++;
shift(@command);
}
elsif($c eq "INV")
{
&inv_disp();
$xp++;
shift(@command);
}
elsif($c eq "TAKE")
{
&disp($message{"demo-move"});
return(1);
}
elsif($c eq "DROP")
{
&disp("You are not carrying anything.");
return(1);
}
elsif(($c eq "TALK")||($c eq "SAY")||($c eq "SHOUT"))
{
shift(@command);
write(join(@command," "));
return(1);
}
elsif($c eq "EMOTE")
{
shift(@command);
write("Guest ".join(@command," "));
return(1);
}
elsif($c eq "WHISPER")
{
&disp("Other users are not logged in.");
return(1);
}
elsif($c eq "EXAMINE") {
shift(@command);
while($command[0] ne "") {
if($command[0]!~/^and$/i) {
$temp=$command[0];
$temp=~s/^.*\/([^\/]*)$/$1/;
if("$temp" eq "") {
&disp("No such object");
} elsif(!-e $temp) {
&disp("Object $temp not found here.");
} else {
$examfile=`file $temp`;
$examfile=~s/^.*: //;
chomp($examfile);
&disp("$temp is a $examfile");
$xp++;
}
}
shift(@command);
}
}
elsif($c eq "READ")
{
&disp($message{"demo-read"});
return(1);
}
elsif($c eq "EDIT")
{
&disp($message{"demo-edit"});
return(1);
}
elsif($c eq "KILL")
{
shift(@command);
mkdir("~/Trash",0600); #fix this
while($command[0] ne "")
{
if($command[0]!~/^and$/i)
{
$temp=$command[0];
$temp=~s/^.*\/([^\/]*)$/$1/;
if(!-e $command[0])
{
&disp("File $temp not found.");
}
else
{
$len=(stat($temp))[7];
if(rename($command[0],"~/Trash/$temp")) #fix this
{
&disp("You killed $temp.");
$xp+=$len;
}
else
{
&disp("You are not strong enough to kill $temp.");
}
}
}
shift(@command);
}
}
elsif($c eq "STAT")
{
&disp("You have $xp experience points.");
shift(@command);
}
elsif($c eq "EXIT")
{
return(0);
}
elsif($c=~/^\#/)
{
#shell comment
return(1);
}
elsif(($c ne "AND")&&($c ne "THEN")&&($c ne "THE")&&($c ne "OF")&&($c ne "AGAIN"))
{
print("Eh?\n");
return(1);
}
else
{
shift(@command);
$c=$command[0];
$c=~tr/[a-z]/[A-Z]/;
$c=~s/([0-9A-Z])[^0-9A-Z]$/$1/;
if(defined($alias{$c}))
{
$c=$alias{$c};
}
}
}
return(1);
}
#Aliases are defined here.
#These aliases are added to @alias when the program reads itself as configuration.
#Aliases are substituted before commands are interpreted.
#Currently, you can only substitute one word for another.
#-Alias g go
#-Alias l look
#-Alias ls look
#-Alias inventory inv
#-Alias i inv
#-Alias exam examine
#-Alias ex examine
#-Alias open edit
#-Alias view read
#-Alias more read
#-Alias less read
#-Alias stats stat
#-Alias quit exit
#-Alias qui exit
#-Alias qu exit
#-Alias q exit
#-Alias logout exit
#-Alias logoff exit
#Main program is here.
#Display banner, check for login shell, check safeguard then enter decode loop.
#Lines are checked for shell escapes before being sent to the parser.
#If an exit command is encountered, &parse returns an exit value.
#Accumulated experience points are displayed before termination.
print("\@\@\@\\ /\@\@\@ Version 1.2: \@\@\@ o\@\@\@\@\@o \@\@\@ (C)2001 Xirium \@\@\@ \@\@\@\n");
print("\@\@\@\@\\ /\@\@\@\@ PointyStick \@\@\@ /\@\@\@\@\@\@\@\@\@\\ \@\@\@ and Dean Swift \@\@\@ \@\@\@\n");
print("\@\@\@\@\@\\ /\@\@\@\@\@ \@\@\@ \@\@\@' `\@\@\@ \@\@\@ \@\@\@ \@\@\@\n");
print("\@\@\@\@\@\@\\ /\@\@\@\@\@\@ \@\@\@ \@\@\@ o\@\@\@b\@\@\@ \@\@\@. \@\@\@ \@\@\@d\@\@\@o o\@\@\@\@o \@\@\@ \@\@\@\n");
print("\@\@\@\\\@\@\@V\@\@\@/\@\@\@ \@\@\@ \@\@\@ /\@\@\@\@\@\@\@\@\@ \\\@\@\@o. \@\@\@\@\@\@\@\@\@\\ /\@\@\@\@\@\@\@\@\\ \@\@\@ \@\@\@\n");
print("\@\@\@ \\\@\@\@\@\@/ \@\@\@ \@\@\@ \@\@\@ \@\@\@' `\@\@\@ *\@\@\@\@\@o \@\@\@' `\@\@\@ \@\@\@' `\@\@\@ \@\@\@ \@\@\@\n");
print("\@\@\@ \\\@\@\@/ \@\@\@ \@\@\@ \@\@\@ \@\@\@ \@\@\@ `*\@\@\@\\ \@\@\@ \@\@\@ \@\@\@\@\@\@\@\@\@\@ \@\@\@ \@\@\@\n");
print("\@\@\@ \@\@\@ \@\@\@ \@\@\@ \@\@\@ \@\@\@ \@\@\@ `\@\@\@ \@\@\@ \@\@\@ \@\@\@\@\@\@\@\@\@\@ \@\@\@ \@\@\@\n");
print("\@\@\@ \@\@\@ \@\@\@. ,\@\@\@ \@\@\@. ,\@\@\@ \@\@\@. ,\@\@\@ \@\@\@ \@\@\@ \@\@\@. \@\@\@ \@\@\@\n");
print("\@\@\@ \@\@\@ \\\@\@\@\@\@\@\@\@\@ \\\@\@\@\@\@\@\@\@\@ \\\@\@\@\@\@\@\@\@\@/ \@\@\@ \@\@\@ \\\@\@\@\@\@\@\@\@ \@\@\@ \@\@\@\n");
print("\@\@\@ \@\@\@ *\@\@\@P\@\@\@ *\@\@\@P\@\@\@ *\@\@\@\@\@* \@\@\@ \@\@\@ *\@\@\@\@\@\@ \@\@\@ \@\@\@\n");
&disp("You are logged in as Guest.");
if($0!~/^\-/)
{
#this is not a login shell therefore allows external commands to be run
$exec_flag=1;
}
@temp=`ps`;
if(scalar(@temp)<=3)
{
#there are too few tasks for this not to be a login shell
$exec_flag=0;
}
&conf_read($0); #reads self for configuration
&conf_read("/etc/mudshrc");
&conf_read("/opt/xirium/mudsh/conf");
&conf_read(glob("~/.mudshrc"));
$xp=0;
$cwd=`pwd`;
$cwd=~s/\n//;
&scout();
&describe();
$continue=1;
while($continue)
{
&disp_space();
print("mudsh - $cwd > ");
$buffer=<>;
$buffer=~s/[\n\r]*$//g;
$buffer=~s/\t/ /g;
$buffer=~s/ +/ /g;
$buffer=~s/^ //;
$buffer=~s/ $//;
if($buffer=~/^!/)
{
if($exec_flag!=1)
{
&disp("A wizard prevents your action.");
}
else
{
$buffer=~s/^!//;
system($buffer);
}
}
else
{
@line=split(/ /,$buffer);
$continue=&parse(\@line);
}
}
&disp("Experience points gained this session: $xp. Experience points are earned by actions, but mostly by killing things.");