Re: [code] FREE !!!

From: Rasmus 'Con' Ronlev (raro94ab@hp4.econ.cbs.dk)
Date: 12/19/96


On Wed, 18 Dec 1996, Allan M. Grant wrote:

> I have just set up a whois patch from the site and I got a bug that
> When ever I get a whois on someone its not freed so when I type whois
> again it gives me both enteries... then three...
> ACMD(do_whois)
[SNIPPETY SNIP]

>       sprintf(buf, "%s\\c07Level \\c04%d %s\\c07.\\c00\r\n", buf,
                     ^^^^                                     ^^^^^^
> GET_LEVEL(victim),
>               class_abbrevs[(int) GET_CLASS(victim)]);

Well, there's your problem, underlined with ^'s :)
You're copying your old buffer along with the new output...
Actually you'll get what was put last in buf, and add the new info to
it....

So, just make it:

sptintf(buf, "\\c07Level \\c04%d %s \\c07.\\c00\r\n," GET_LEVEL(victim),
             class_abbrevs[(int) GET_CLASS(victim)]);

Hope this helps :)
Con

d.
--
     Rasmus Rønlev DOEK'94      WWW: http://www.econ.cbs.dk/people/raro94ab
     Student instructor         MUD: exiled.mud.circlemud.org 5000
                                         199.199.16.100 5000
       Student, B.Sc in Computer Science and Business Administration.

+-----------------------------------------------------------+
| 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/18/00 PST