~case/dbns

ref: 0f9985edf4d2b9e98aaac388d30fd4ab8c4722cf dbns/src/finger.c -rw-r--r-- 22.9 KiB
0f9985edcase rm extern 10 months ago
                                                                                
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
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
/****************************************************************************
 *                   ^     +----- |  / ^     ^ |     | +-\                  *
 *                  / \    |      | /  |\   /| |     | |  \                 *
 *                 /   \   +---   |<   | \ / | |     | |  |                 *
 *                /-----\  |      | \  |  v  | |     | |  /                 *
 *               /       \ |      |  \ |     | +-----+ +-/                  *
 ****************************************************************************
 * AFKMud Copyright 1997-2002 Alsherok. Contributors: Samson, Dwip, Whir,   *
 * Cyberfox, Karangi, Rathian, Cam, Raine, and Tarl.                        *
 *                                                                          *
 * Original SMAUG 1.4a written by Thoric (Derek Snider) with Altrag,        *
 * Blodkai, Haus, Narn, Scryn, Swordbearer, Tricops, Gorog, Rennard,        *
 * Grishnakh, Fireblade, and Nivek.                                         *
 *                                                                          *
 * Original MERC 2.1 code by Hatchet, Furey, and Kahn.                      *
 *                                                                          *
 * Original DikuMUD code by: Hans Staerfeldt, Katja Nyboe, Tom Madsen,      *
 * Michael Seifert, and Sebastian Hammer.                                   *
 ****************************************************************************
 *                        Finger and Wizinfo Module                         *
 ****************************************************************************/

/******************************************************
        Additions and changes by Edge of Acedia
              Rewritten do_finger to better
             handle info of offline players.
           E-mail: nevesfirestar2002@yahoo.com
 ******************************************************/

#include <ctype.h>
#include <string.h>
#include <strings.h>
#include <stdbool.h>
#include <dirent.h>
#include <sys/stat.h>
#include <time.h>
#include "mud.h"

#if defined(KEY)
#undef KEY
#endif

#define KEY( literal, field, value )					\
				if ( !str_cmp( word, literal ) )	\
				{					\
				      field = value;			\
				      fMatch = true;			\
				      break;				\
				}

/* Begin wizinfo stuff - Samson 6-6-99 */

bool     check_parse_name        args( ( char *name, bool newchar ) );

WIZINFO_DATA * first_wizinfo;
WIZINFO_DATA * last_wizinfo;

/* Construct wizinfo list from god dir info - Samson 6-6-99 */
void add_to_wizinfo( char *name, WIZINFO_DATA *wiz )
{
   WIZINFO_DATA *wiz_prev;

   wiz->name = str_dup( name );
   if ( !wiz->email )
      wiz->email = str_dup( "Not Set" );

   for( wiz_prev = first_wizinfo; wiz_prev; wiz_prev = wiz_prev->next )
      if( strcasecmp( wiz_prev->name, name ) >= 0 )
         break;

   if( !wiz_prev )
      LINK( wiz, first_wizinfo, last_wizinfo, next, prev );
   else
      INSERT( wiz, wiz_prev, first_wizinfo, next, prev );

   return;
}

void clear_wizinfo( bool bootup )
{
   WIZINFO_DATA *wiz, *next;

   if( !bootup )
   {
     for ( wiz = first_wizinfo; wiz; wiz = next )
     {
        next = wiz->next;
        UNLINK( wiz, first_wizinfo, last_wizinfo, next, prev );
	  DISPOSE( wiz->name );
	  DISPOSE( wiz->email );
        DISPOSE( wiz );
     }
   }

   first_wizinfo = NULL;
   last_wizinfo = NULL;

   return;
}

void fread_info( WIZINFO_DATA *wiz, FILE *fp )
{
   char *word;
   bool fMatch;

     for ( ; ; )
     {
	word   = feof( fp ) ? "End" : fread_word( fp );
	fMatch = false;

	switch ( UPPER(word[0]) )
	{
	case '*':
	    fMatch = true;
	    fread_to_eol( fp );
	    break;

	case 'E':
	    KEY( "Email", 	wiz->email,		fread_string_nohash( fp ) );
	    if ( !str_cmp( word, "End" ) )
		return;
	    break;

	case 'I':
	    KEY( "ICQ",	wiz->icq,	fread_number( fp ) );
	    break;

	case 'L':
	    KEY( "Level", wiz->level,	fread_number( fp ) );
	    break;
	}

	if ( !fMatch )
	    fread_to_eol( fp );
    }
}

void build_wizinfo( bool bootup )
{
   DIR *dp;
   struct dirent *dentry;
   FILE *fp;
   WIZINFO_DATA *wiz;
   char buf[MAX_STRING_LENGTH];

   clear_wizinfo( bootup ); /* Clear out the table before rebuilding a new one */

   dp = opendir( GOD_DIR );

    if (dp == NULL) {
	    bug("GOD_DIR doesn't exist.");
	    exit(1);
    }

   dentry = readdir( dp );

   while ( dentry )
   {
      /* Added by Tarl 3 Dec 02 because we are now using CVS */
      if( !str_cmp( dentry->d_name, "CVS" ) )
      {
         dentry = readdir( dp );
         continue;
      }
      if ( dentry->d_name[0] != '.' )
      {
	  sprintf( buf, "%s%s", GOD_DIR, dentry->d_name );
	  fp = fopen( buf, "r" );
	  if ( fp )
	  {
	    CREATE( wiz, WIZINFO_DATA, 1 );
          fread_info( wiz, fp );
	    add_to_wizinfo( dentry->d_name, wiz );
	    FCLOSE( fp );
	  }
      }
      dentry = readdir( dp );
   }
   closedir( dp );
   return;
}

/*
 * Wizinfo information.
 * Added by Samson on 6-6-99
 */
void do_wizinfo( CHAR_DATA *ch, char *argument )
{
   WIZINFO_DATA *wiz;
   char buf[MAX_STRING_LENGTH];

   send_to_pager( "Contact Information for the Immortals:\n\r\n\r", ch );
   send_to_pager( "Name         Email Address                     ICQ#\n\r", ch );
   send_to_pager( "------------+---------------------------------+----------\n\r", ch );

   for ( wiz = first_wizinfo; wiz; wiz = wiz->next )
   {
      sprintf( buf, "%-12s %-33s %10d", wiz->name, wiz->email, wiz->icq );
	strcat( buf, "\n\r" );
      send_to_pager( buf, ch );
   }
   return;
}

/* End wizinfo stuff - Samson 6-6-99 */

/* Finger snippet courtesy of unknown author. Installed by Samson 4-6-98 */
/* File read/write code redone using standard Smaug I/O routines - Samson 9-12-98 */
/* Data gathering now done via the pfiles, eliminated separate finger files - Samson 12-21-98 */
/* Improvements for offline players by Edge of Acedia 8-26-03 */
/* Further refined by Samson on 8-26-03 */
void do_finger( CHAR_DATA *ch, char *argument )
{
   CHAR_DATA *victim = NULL;
   CMDTYPE *command;
   ROOM_INDEX_DATA *temproom, *original = NULL;
   int level = LEVEL_IMMORTAL;
   char buf[MAX_STRING_LENGTH], fingload[MAX_INPUT_LENGTH];
   struct stat fst;
   char *laston = NULL;
   bool loaded = false, skip = false;

   if( IS_NPC(ch) )
   {
      send_to_char( "Mobs can't use the finger command.\n\r", ch );
      return;
   }

   if( !argument || argument[0] == '\0' )
   {
      send_to_char( "Finger whom?\n\r", ch );
      return;
   }

   sprintf( buf, "0.%s", argument );

   /* If player is online, check for fingerability (yeah, I coined that one)	-Edge */
   if( ( victim = get_char_world( ch, buf ) ) != NULL )
   {
	if( IS_SET( victim->pcdata->flags, PCFLAG_PRIVACY ) && !IS_IMMORTAL(ch) )
    	{
	   ch_printf( ch, "%s has privacy enabled.\n\r", victim->name );
	   return;
    	}

    	if ( IS_IMMORTAL(victim) && !IS_IMMORTAL(ch) )
    	{
	   send_to_char( "You cannot finger an immortal.\n\r", ch );
	   return;
    	}
   }

   /* Check for offline players - Edge */
   else
   {
      DESCRIPTOR_DATA *d;

      sprintf( fingload, "%s%c/%s", PLAYER_DIR, tolower(argument[0]), capitalize( argument ) );
      /* Bug fix here provided by Senir to stop /dev/null crash */
      if( stat( fingload, &fst ) == -1 || !check_parse_name( capitalize( argument ), false ) )
      {
         ch_printf( ch, "&YNo such player named '%s'.\n\r", argument );
         return;
      }

      /*laston = ctime( &fst.st_mtime );*/
      temproom = get_room_index( ROOM_VNUM_LIMBO );
      if( !temproom )
      {
         bug( "%s", "do_finger: Limbo room is not available!" );
         send_to_char( "Fatal error, report to the immortals.\n\r", ch );
         return;
      }

	CREATE( d, DESCRIPTOR_DATA, 1 );
	d->next = NULL;
	d->prev = NULL;
	d->connected = CON_GET_NAME;
	d->outsize = 2000;
	CREATE( d->outbuf, char, d->outsize );
      argument[0] = UPPER( argument[0] );

	loaded = load_char_obj( d, argument, false ); /* Remove second false if compiler complains */
      LINK( d->character, first_char, last_char, next, prev );
	original = d->character->in_room;
	char_to_room( d->character, temproom );
	victim = d->character; /* Hopefully this will work, if not, we're SOL */
	d->character->desc	= NULL;
	d->character		= NULL;
	DISPOSE( d->outbuf );
	DISPOSE( d );

	/* Link dead check?  Was crashing on "IP Info" line below
	 * hopefully this will fix it. -Goku 10.11.03 */
	if (!victim->desc)
		loaded = false;

	if( IS_SET( victim->pcdata->flags, PCFLAG_PRIVACY ) && !IS_IMMORTAL(ch) )
    	{
	   ch_printf( ch, "%s has privacy enabled.\n\r", victim->name );
         skip = true;
    	}

    	if( IS_IMMORTAL(victim) && !IS_IMMORTAL(ch) )
    	{
	   send_to_char( "You cannot finger an immortal.\n\r", ch );
         skip = true;
    	}
      loaded = true;
   }

   if( !skip )
   {
      send_to_char( "&w          Finger Info\n\r", ch );
      send_to_char( "          -----------\n\r", ch );
      ch_printf( ch, "&wName    : &G%-20s &wMUD Age: &G%d\n\r", victim->name, get_newage( victim ) );
      ch_printf( ch, "&wRank    : &G%-20s &wRace   : &G%s\n\r",
		get_rank(victim), capitalize( get_race(victim) ) );
      ch_printf( ch, "&wSex     : &G%-20s\n\r",
                victim->sex == SEX_MALE   ? "Male"   :
                victim->sex == SEX_FEMALE ? "Female" : "Neutral" );
      ch_printf( ch, "&wTitle   : &G%s\n\r", victim->pcdata->title );
      ch_printf( ch, "&wHomepage: &G%s\n\r", victim->pcdata->homepage != NULL ? victim->pcdata->homepage : "Not specified" );
      ch_printf( ch, "&wEmail   : &G%s\n\r", victim->pcdata->email != NULL ? victim->pcdata->email : "Not specified" );
      ch_printf( ch, "&wICQ#    : &G%d\n\r", victim->pcdata->icq );
      if( loaded )
         ch_printf( ch, "&wLast on : &G%s\n\r", ctime( &victim->pcdata->lastlogon ) );
      else
         ch_printf( ch, "&wLast on : &GCurrently Online\n\n\r", laston );
      if ( IS_IMMORTAL(ch) )
      {
	   send_to_char( "&wImmortal Information\n\r", ch );
	   send_to_char( "--------------------\n\r", ch );
//	   ch_printf( ch, "&wIP Info       : &G%s\n\r", loaded ? "Unknown" : victim->desc->host );
	   ch_printf( ch, "&wTime played   : &G%ld hours\n\r", (long int)GET_TIME_PLAYED( victim ) );
         ch_printf( ch, "&wPrivacy Status: &G%s\n\r", IS_SET( victim->pcdata->flags, PCFLAG_PRIVACY ) ? "Enabled" : "Disabled" );
         if( victim->level < ch->level )
         {
            /* Added by Tarl 19 Dec 02 to remove Huh? when ch not high enough to view comments. */
            command = find_command( "comment" );
            if( !command )
               level = LEVEL_IMMORTAL;
            else
               level = command->level;
            if( ch->level >= command->level )
            {
               sprintf( buf, "comment list %s", victim->name );
               interpret( ch, buf );
            }
         }
      }
		pager_printf_color (ch, "&wBio:\n\r&G%s\n\r", victim->pcdata->bio ? victim->pcdata->bio : "Not created" );
		pager_printf_color (ch, "\n\r&wDescription:\n\r&G%s\n\r", victim->description ? victim->description : "Not created" );
   }

   if( loaded )
   {
      int x, y;

      char_from_room( victim );
	char_to_room( victim, original );

      quitting_char = victim;
      /*save_char_obj( victim );*/

	if( sysdata.save_pets && victim->pcdata->pet )
	  extract_char( victim->pcdata->pet, true, false);

      saving_char = NULL;

      /*
       * After extract_char the ch is no longer valid!
       */
      extract_char( victim, true, false );
      for ( x = 0; x < MAX_WEAR; x++ )
	  for ( y = 0; y < MAX_LAYERS; y++ )
	    save_equipment[x][y] = NULL;
   }
   return;
}

/* Added a clone of homepage to let players input their email addy - Samson 4-18-98 */
void do_email( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];

    if ( IS_NPC(ch) )
	return;

    if ( argument[0] == '\0' )
    {
	if ( !ch->pcdata->email )
	  ch->pcdata->email = str_dup( "" );
	ch_printf( ch, "Your email address is: %s\n\r",	show_tilde( ch->pcdata->email ) );
	return;
    }

    if ( !str_cmp( argument, "clear" ) )
    {
	if ( ch->pcdata->email )
	  DISPOSE(ch->pcdata->email);
	ch->pcdata->email = str_dup("");

      if ( IS_IMMORTAL( ch ) )
      {
	  save_char_obj( ch );
	  build_wizinfo( false );
      }

	send_to_char( "Email address cleared.\n\r", ch );
	return;
    }

    strcpy( buf, argument );

    if ( strlen(buf) > 70 )
	buf[70] = '\0';

    hide_tilde( buf );
    if ( ch->pcdata->email )
      DISPOSE(ch->pcdata->email);
    ch->pcdata->email = str_dup(buf);
    if ( IS_IMMORTAL( ch ) )
    {
	save_char_obj( ch );
	build_wizinfo( false );
    }
    send_to_char( "Email address set.\n\r", ch );
}

void do_icq_number( CHAR_DATA *ch, char *argument )
{
    int icq;

    if ( IS_NPC( ch ) )
	return;

    if ( argument[0] == '\0' )
    {
	if ( !ch->pcdata->icq )
	  ch->pcdata->icq = 0;
	ch_printf( ch, "Your ICQ# is: %d\n\r", ch->pcdata->icq );
	return;
    }

    if ( !str_cmp( argument, "clear" ) )
    {
	ch->pcdata->icq = 0;

      if ( IS_IMMORTAL( ch ) )
      {
	  save_char_obj( ch );
	  build_wizinfo( false );
      }

	send_to_char( "ICQ# cleared.\n\r", ch );
	return;
    }

    if ( !is_number( argument ) )
    {
	send_to_char( "You must enter numeric data.\n\r", ch );
	return;
    }

    icq = atoi( argument );

    if ( icq < 1 )
    {
	send_to_char( "Valid range is greater than 0.\n\r", ch );
	return;
    }

    ch->pcdata->icq = icq;

    if ( IS_IMMORTAL( ch ) )
    {
	save_char_obj( ch );
	build_wizinfo( false );
    }

    send_to_char( "ICQ# set.\n\r", ch );
    return;
}

void do_homepage( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];

    if ( IS_NPC(ch) )
	return;

    if ( !argument || argument[0] == '\0' )
    {
	if ( !ch->pcdata->homepage )
	  ch->pcdata->homepage = str_dup( "" );
	ch_printf( ch, "Your homepage is: %s\n\r", show_tilde( ch->pcdata->homepage ) );
	return;
    }

    if ( !str_cmp( argument, "clear" ) )
    {
	if ( ch->pcdata->homepage )
	  DISPOSE(ch->pcdata->homepage);
	ch->pcdata->homepage = str_dup("");
	send_to_char( "Homepage cleared.\n\r", ch );
	return;
    }

    if ( strstr( argument, "://" ) )
	strcpy( buf, argument );
    else
	sprintf( buf, "http://%s", argument );
    if ( strlen(buf) > 70 )
	buf[70] = '\0';

    hide_tilde( buf );
    if ( ch->pcdata->homepage )
      DISPOSE(ch->pcdata->homepage);
    ch->pcdata->homepage = str_dup(buf);
    send_to_char( "Homepage set.\n\r", ch );
}

void do_privacy( CHAR_DATA *ch, char *argument )
{
   if ( IS_NPC( ch ) )
   {
	send_to_char( "Mobs can't use the privacy toggle.\n\r", ch );
	return;
   }

   TOGGLE_BIT( ch->pcdata->flags, PCFLAG_PRIVACY );

   if ( IS_SET( ch->pcdata->flags, PCFLAG_PRIVACY ) )
   {
	send_to_char( "Privacy flag enabled.\n\r", ch );
	return;
   }
   else
   {
	send_to_char( "Privacy flag disabled.\n\r", ch );
	return;
   }
}

/*
 * basicly a copy of do_finger but checks pfiles in the backup dir -Goku 09.29.04
 */
void do_backfinger( CHAR_DATA *ch, char *argument )
{
   CHAR_DATA *victim = NULL;
   CMDTYPE *command;
   ROOM_INDEX_DATA *temproom, *original = NULL;
   int level = LEVEL_IMMORTAL;
   char buf[MAX_STRING_LENGTH], fingload[MAX_INPUT_LENGTH];
   char *laston = NULL;
   struct stat fst;
   bool loaded = false, skip = false;
      DESCRIPTOR_DATA *d;

   if( IS_NPC(ch) )
   {
      send_to_char( "Mobs can't use the finger command.\n\r", ch );
      return;
   }

   if( !argument || argument[0] == '\0' )
   {
      send_to_char( "Back finger whom?\n\r", ch );
      return;
   }

   sprintf( buf, "0.%s", argument );


      sprintf( fingload, "%s%c/%s", BACKUP_DIR, tolower(argument[0]), capitalize( argument ) );
      /* Bug fix here provided by Senir to stop /dev/null crash */
      if( stat( fingload, &fst ) == -1 || !check_parse_name( capitalize( argument ), false ) )
      {
         ch_printf( ch, "&YNo such player named '%s'.\n\r", argument );
         return;
      }

      /*laston = ctime( &fst.st_mtime );*/
      temproom = get_room_index( ROOM_VNUM_LIMBO );
      if( !temproom )
      {
         bug( "%s", "do_backfinger: Limbo room is not available!" );
         send_to_char( "Fatal error, report to the immortals.\n\r", ch );
         return;
      }

	CREATE( d, DESCRIPTOR_DATA, 1 );
	d->next = NULL;
	d->prev = NULL;
	d->connected = CON_GET_NAME;
	d->outsize = 2000;
	CREATE( d->outbuf, char, d->outsize );
      argument[0] = UPPER( argument[0] );

	loaded = load_char_obj( d, argument, false ); /* Remove second false if compiler complains */
      LINK( d->character, first_char, last_char, next, prev );
	original = d->character->in_room;
	char_to_room( d->character, temproom );
	victim = d->character; /* Hopefully this will work, if not, we're SOL */
	d->character->desc	= NULL;
	d->character		= NULL;
	DISPOSE( d->outbuf );
	DISPOSE( d );

	/* Link dead check?  Was crashing on "IP Info" line below
	 * hopefully this will fix it. -Goku 10.11.03 */
	if (!victim->desc)
		loaded = false;

	if( IS_SET( victim->pcdata->flags, PCFLAG_PRIVACY ) && !IS_IMMORTAL(ch) )
    	{
	   ch_printf( ch, "%s has privacy enabled.\n\r", victim->name );
         skip = true;
    	}

    	if( IS_IMMORTAL(victim) && !IS_IMMORTAL(ch) )
    	{
	   send_to_char( "You cannot back finger an immortal.\n\r", ch );
         skip = true;
    	}
      loaded = true;

   if( !skip )
   {
      send_to_char( "&w          Back Finger Info\n\r", ch );
      send_to_char( "          -----------\n\r", ch );
      ch_printf( ch, "&wName    : &G%-20s &wMUD Age: &G%d\n\r", victim->name, get_newage( victim ) );
      ch_printf( ch, "&wRank    : &G%-20s &wRace   : &G%s\n\r",
		get_rank(victim), capitalize( get_race(victim) ) );
      ch_printf( ch, "&wSex     : &G%-20s\n\r",
                victim->sex == SEX_MALE   ? "Male"   :
                victim->sex == SEX_FEMALE ? "Female" : "Neutral" );
      ch_printf( ch, "&wTitle   : &G%s\n\r", victim->pcdata->title );
      ch_printf( ch, "&wHomepage: &G%s\n\r", victim->pcdata->homepage != NULL ? victim->pcdata->homepage : "Not specified" );
      ch_printf( ch, "&wEmail   : &G%s\n\r", victim->pcdata->email != NULL ? victim->pcdata->email : "Not specified" );
      ch_printf( ch, "&wICQ#    : &G%d\n\r", victim->pcdata->icq );
      if( loaded )
         ch_printf( ch, "&wLast on : &G%s\n\r", ctime( &victim->pcdata->lastlogon ) );
      else
         ch_printf( ch, "&wLast on : &GCurrently Online\n\n\r", laston );
      if ( IS_IMMORTAL(ch) )
      {
	   send_to_char( "&wImmortal Information\n\r", ch );
	   send_to_char( "--------------------\n\r", ch );
//	   ch_printf( ch, "&wIP Info       : &G%s\n\r", loaded ? "Unknown" : victim->desc->host );
	   ch_printf( ch, "&wTime played   : &G%ld hours\n\r", (long int)GET_TIME_PLAYED( victim ) );
         ch_printf( ch, "&wPrivacy Status: &G%s\n\r", IS_SET( victim->pcdata->flags, PCFLAG_PRIVACY ) ? "Enabled" : "Disabled" );
         if( victim->level < ch->level )
         {
            /* Added by Tarl 19 Dec 02 to remove Huh? when ch not high enough to view comments. */
            command = find_command( "comment" );
            if( !command )
               level = LEVEL_IMMORTAL;
            else
               level = command->level;
            if( ch->level >= command->level )
            {
               sprintf( buf, "comment list %s", victim->name );
               interpret( ch, buf );
            }
         }
      }
		pager_printf_color (ch, "&wBio:\n\r&G%s\n\r", victim->pcdata->bio ? victim->pcdata->bio : "Not created" );
		pager_printf_color (ch, "\n\r&wDescription:\n\r&G%s\n\r", victim->description ? victim->description : "Not created" );
   }

   if( loaded )
   {
      int x, y;

      char_from_room( victim );
	char_to_room( victim, original );

      quitting_char = victim;
      /*save_char_obj( victim );*/

	if( sysdata.save_pets && victim->pcdata->pet )
	  extract_char( victim->pcdata->pet, true, false );

      saving_char = NULL;

      /*
       * After extract_char the ch is no longer valid!
       */
      extract_char( victim, true, false );
      for ( x = 0; x < MAX_WEAR; x++ )
	  for ( y = 0; y < MAX_LAYERS; y++ )
	    save_equipment[x][y] = NULL;
   }
   return;
}

void fread_pfile2( CHAR_DATA *ch, FILE *fp )
{
    char *word;
    char *name = NULL;
    sh_int level = 0;
    sh_int file_ver = 0;
    bool fMatch;
        long double exp = 0;
        char *          description = NULL;
	char *		bio = NULL;
    
    for ( ; ; )
    {
        word   = feof( fp ) ? "End" : fread_word( fp );
        fMatch = false;

/*        if (StopFP)
        {
                bug("Bad Pfile detected.  Stoping proccessing of bad Pfile.");
                StopFP = false;
                return;
        }
*/        switch ( UPPER(word[0]) )
        {

        case '*':
            fMatch = true;
            fread_to_eol( fp );
            break;

	case 'B':
            KEY( "Bio",bio,fread_string(fp));
            break;
        case 'D':
            KEY( "Description", description,    fread_string( fp ) );
            break;

	case 'E':
                KEY( "Exp",             exp,            fread_number_ld( fp ) );
            if ( !strcmp( word, "End" ) )
		goto timecheck;
            break;

        case 'L':
            KEY( "Level",               level,  fread_number( fp ) );
            break;

        case 'N':
            KEY( "Name",                name,   fread_string( fp ) );
            break;

        case 'V':
            KEY( "Version",     file_ver,       fread_number( fp ) );
            break;
        }

        if ( !fMatch )
           fread_to_eol( fp );
    }
timecheck:
{
    send_to_char( "Name: ", ch );
    send_to_char( name, ch );
    send_to_char( "\n\rBio:\n\r", ch );
    send_to_char( bio, ch );
    send_to_char( "\n\r\n\rDesc:\n\r", ch );
    send_to_char( description, ch );
}
}

void do_finger2( CHAR_DATA *ch, char *argument )
{
   char buf[MAX_STRING_LENGTH], fingload[MAX_INPUT_LENGTH];
   FILE *fp;

   if( IS_NPC(ch) )
   {
      send_to_char( "Mobs can't use the finger command.\n\r", ch );
      return;
   }

   if( !argument || argument[0] == '\0' )
   {
      send_to_char( "Finger whom?\n\r", ch );
      return;
   }

   sprintf( buf, "0.%s", argument );

   /* Check for offline players - Edge */
//   else
   {
      sprintf( fingload, "%s%c/%s", BACKUP_DIR, tolower(argument[0]), capitalize( argument ) );
      /* Bug fix here provided by Senir to stop /dev/null crash */

	if( ( fp = fopen( fingload, "r" ) ) == NULL )
	{
		send_to_char( "Error.\n\r", ch );
		return;
	}

	for ( ; ; )
        {
            char letter;
            char *word;
/*            if (StopFP)   
            {
                bug("Bad Pfile detected.  Stoping proccessing of bad Pfile.");
                StopFP = false;
                return;
            }
*/            letter = fread_letter( fp );

            if ( letter != '#' )
               continue;

            word = fread_word( fp );

            if ( !str_cmp( word, "End" ) )
                break;

            if ( !str_cmp( word, "PLAYER" ) )
                fread_pfile2( ch, fp );
            else
            if ( !str_cmp( word, "END" ) )      /* Done         */
                break;
        }
        fclose( fp );          

   }
   return;
}