>
> ACMD(do_whois)
> {
> struct char_data *victim = 0;
> struct char_file_u tmp_store;
>
> skip_spaces(&argument);
>
> if (!*argument) {
> send_to_char("\\c07USAGE: whois \\c04<name of a player to get info
> on>\\c00\r\n", ch);
> }
> else {
> CREATE(victim, struct char_data, 1);
> clear_char(victim);
> if (load_char(argument, &tmp_store) > -1) {
> store_to_char(&tmp_store, victim);
> sprintf(buf, "%s\\c07Level \\c04%d %s\\c07.\\c00\r\n", buf,
> GET_LEVEL(victim),
> class_abbrevs[(int) GET_CLASS(victim)]);
> send_to_char(buf, ch);
> }
> else {
> send_to_char("There is no such player.\r\n", ch);
> }
> }
> free(victim);
> }
>
The problem is that you don't blank buf before you use it, so it still
has the info in it from before. Buf is a global variable, so it doesn't
go away after the function, therefore the info stays in it until something
clears it. From what I can tell, you can change your sprintf line to this:
sprintf(buf, "\\c07Level \\c04%d %s\\c07.\\c00\r\n, GET_LEVEL(victim),
class_abbrevs[(int) GET_CLASS(victim)]);
--
--Mym, the Incarnation of War
--Mists of Chaos
--Running on:
Cow.pasture.com 4000
-------------------------------------
| Everybody believes in something. |
| I believe I'll have another beer. |
-------------------------------------
+-----------------------------------------------------------+
| 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