Re: [CODE] Recall/Clone code on FTP

From: Ron Hensley (ron@CROSS.DMV.COM)
Date: 09/21/97


On Sat, 20 Sep 1997, Sammy wrote:

> On Sat, 20 Sep 1997, Ron Hensley wrote:
>
> > Ive noticed that some speicals code, trash the argument list passed into
> > them. Like if you assign a mob to be a shop keeper and also try to
> > MOB_ASSIGN it, youll see that the shop code obliterates the argument list
> > before your special gets called.
>
> That's not a problem with stock spec_procs.  I think what's happening is
> your specials don't have enough checks to determine whether the special
> should act on the arguments before you call the argument functions.  Any
> "return 0" in a special that is called after a destructive argument parse
> function is asking for trouble.


I think I have to dissagree with that statement. Got stock code and
unzipped it. Here is the result of:
  grep -in "argument = one_argument" *.c

act.item.c:449:  argument = one_argument(argument, arg);
act.item.c:457:    argument = one_argument(argument, arg);
act.item.c:585:  argument = one_argument(argument, arg);
act.item.c:591:    argument = one_argument(argument, arg);
act.item.c:593:      argument = one_argument(argument, arg);
act.other.c:170:  argument = one_argument(argument, obj_name);
modify.c:130:  argument = one_argument(argument, name);
modify.c:181:  argument = one_argument(argument, buf);
olc.c:106:      argument = one_argument(argument, arg);
olc.c:130:    argument = one_argument(argument, arg);
olc.c:142:    argument = one_argument(argument, arg);
spec_procs.c:632:    argument = one_argument(argument, buf);
spec_procs.c:633:    argument = one_argument(argument, pet_name);

As one_argument returns a pointer to the argument array, minus the
argument popped off the list by the call itself, anyime you say
  argument = one_argument(argument,.....
You have just destroyed the argument list have you not?
I mean you have take the global char *argument that points to the
beginning of the list, and moved it, thus losing the beginning.
As the two from spec_procs show, the pet shop code is one such stock code.

Of course you are correct, many many patches violate this as well such as
all the mob program code.

    *******************************************************************
    *   Ron Hensley                     ron@dmv.com                   *
    *   Network Administrator           http://www.dmv.com/~ron       *
    *                                   PGP Key at WWW Page           *
    *   DelMarVa OnLine                 749-7898 Ext. 403             *
    *******************************************************************


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



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