Custom Prompt

From: Ryan (ed209@maxwell.iia2.org)
Date: 04/01/95


Hi there, I'm trying to complete a custom prompt system where people may 
choose their own prompt style, and what they would like to see in it.

However, there seems to be a critical bug somewhere in my procedure, but 
I cannot locate it.

here's what the code looks like at the moment..

void make_prompt(struct descriptor_data * d)
{

  register char *i, *buff;
  static char lbuff[MAX_STRING_LENGTH];
  char *prompt;

  if (d->str)
    write_to_descriptor(d->descriptor, "] ");
  else if (d->showstr_point)
    write_to_descriptor(d->descriptor,
			"\r\nPress Enter to continue:");
  else if (!d->connected) {

    sprintf(prompt, "< &N > "); /* this is where the procedure would normally
                                   read the character's custom title from
                                   char_data, but I'll just put this simple
                                   string in for debugging purposes. */
    buff = lbuff;

    for (;;) {
      if (*prompt == '&') {
        switch (*(++prompt)) {
          case 'N':
            i = GET_NAME(d->character);
            break;
          case '&':
            i = "&";
            break;
        default: 
	  break;
        }
        while ((*buff = *(i++)))
	  buff++;
        prompt++;
      } else if (!(*(buff++) = *(prompt++)))
        break;
    }
    write_to_descriptor(d->descriptor, CAP(lbuff));
  }
}

As you can see, it's very simular to the act() procedure, however 
dubugging it is beyond me :(.

What happens is it will proceed to work for about 15 seconds to a minute, 
then all  of a sudden it will core dump and spit the following out in 
core.circle..

#0  0x7f67d in __sfvwrite (0x00000000, 0x001e0800, 0x00000000, 0x00000000)

If you have any ideas what is causing this, I would be happy to hear 
them.  

Ryan



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