Re: OLC-Plusv2.1a + Copyover

From: Ryan Guthrie (guthrie@henge.com)
Date: 12/22/98


> I recently decided to start my mud over to update some old stuff and add
> some new features.  Last time i did this(for another person) I ran into
> this same problem.  That is: When I do a copyover, it does it and brings
> me back to the prompt, but whatever i type in next crashed the mud.  As
> far as i can remember, the gdb information was of no relevance, but here
> it is anyways.
<CUT>
Some additional information:
  It crashes because t->last_input and t->history don't exist.  They are
initialized in the first two if statements, but after the else, it doesn't
get set to anything.  Soooo: Solution 1: Remove the else part.  Causes: !
won't work now but fixes bug.  Solution 2: ?  Ideas?

I did a: if(t->history && t->last_input != NULL) check right after the
else which prevents it from crashing and also disables ! from working.

For those that don't know...this portion of the code is for when you want
to redo the last command.  I don't exactly understand the tmp stuff
either.  tmp is a character, and a pointer?

> 1848        } else if (*tmp == '^') {
> 1849          if (!(failed_subst = perform_subst(t, t->last_input, tmp)))
> 1850            strcpy(t->last_input, tmp);
> 1851        } else {
> 1852          strcpy(t->last_input, tmp);             <---Crash line
> 1853          if (t->history[t->history_pos])
> 1854            free(t->history[t->history_pos]);       /* Clear the old
> line. */
> 1855          t->history[t->history_pos] = str_dup(tmp);        /* Save
> the new. */
> 1856          if (++t->history_pos >= HISTORY_SIZE)     /* Wrap to top. */
> 1857            t->history_pos = 0;



                        -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-
                        |       Ryan Guthrie(Sim)       |
                        |       guthrie@henge.com       |
                        |*****CyberMUD Information:*****|
                        |      sim@sim.dkserver.dk      |
                        |       cyber.mud.dk 5000       |
                        -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



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