[Circle] do_who help

From: goamkows (goamkows@kirk.geog.sc.edu)
Date: 08/15/96


i've added an elemental to the character file
ch->player_specials->saved.prefix
where *prefix is of type char.

i want to prepend the prefix to the characters name when someone does
a who, so in do_who, i put in:

  char *tmp;

then later on put in 
  tmp = strcat((wch->player_specials->saved.prefix), (GET_NAME(wch)));

and replaced the GET_NAME in the sprintf that displays the name with tmp.

it compiles without warning or error, but when i go to do a who, it
crashes the mud.  

gdb is giving the value of blah->saved.prefix as what i want it to be,
and presumably GET_NAME(wch) will turn up the appropriate name string,
so i have no idea what i am doing wrong :(
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+


From dkarnes@mystech.com Thu, 15 Aug 96 01:41:48 EDT
X-SystemInfo: MyE-Mail: EMail
X-Message-No: 3731 (database)
From: Derek Karnes (Mystech-Manassas) <dkarnes@mystech.com>
To: circle <circle@cspo.queensu.ca, goamkows@kirk.geog.sc.edu>
Subject: Re:  [Circle] do_who help
Date: Thu, 15 Aug 96 06:41:00
Message-ID: <9608150541.AA07055@mystech.com>
X-POP3-Rcpt: lk4150@per
Return-Path: <@QUCDN.QueensU.CA:owner-circle@cspo.queensu.ca>
Received: from QUCDN.QueensU.CA (QUCDN.QueensU.CA [130.15.126.2]) by per.cybercity.dk (8.6.12/8.6.12) with SMTP id OAA03184 for <lk4150@krull.dk>; Thu, 15 Aug 1996 14:04:19 +0200
Received: from cspo.queensu.ca by QUCDN.QueensU.CA (IBM VM SMTP V2R2) with TCP;Thu, 15 Aug 96 03:44:27 EDT
Received: by cspo.queensu.ca (SMI-8.6/SMI-SVR4)id BAA07359; Thu, 15 Aug 1996 01:33:28 -0500
Received: from mystech.com by cspo.queensu.ca (SMI-8.6/SMI-SVR4)
Received: (from mail@localhost) by mystech.com (8.7.4/8.7.3) id BAA18987; Thu, 15 Aug 1996 01:35:34 -0400
Received: from unknown(42.3.0.10) by bastion.mystech.com via smap (V1.3)
Received: by mystech.com (4.1/SMI-4.1)
To: circle@cspo.queensu.ca, goamkows@kirk.geog.sc.edu
Sender: owner-circle@cspo.queensu.ca
Precedence: bulk

i've added an elemental to the character file
ch->player_specials->saved.prefix
where *prefix is of type char.

i want to prepend the prefix to the characters name when someone does
a who, so in do_who, i put in:

  char *tmp;

then later on put in 
  tmp = strcat((wch->player_specials->saved.prefix), (GET_NAME(wch)));

and replaced the GET_NAME in the sprintf that displays the name with tmp.

--
if prefix is of type char, then you're trying to copy a string (GET_NAME)
into a character space... if prefix is a char *, then you're tryig to
copy a string into unmalloced memory... if you look at the man pages on
strcat, you'll see that it needs a space to copy into.. try using
str_dup instead of strcat could solve your problem.

Derek Karnes
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/07/00 PST