Re: [CODE] do_say snippet

From: Daniel Koepke (dkoepke@CALIFORNIA.COM)
Date: 04/04/98


Benjamin Draper wrote:
>
> A few people asked me for this a while back. It's taken from the
> Archipelago code on the ftp site, cleaned up a little. Do with it
> what you will.
>
> [snip]

That won't/doesn't work and it's hideously terrible code.  This, in
particular, appalled me:

>        for (len = argument; *(len) != '\0'; len++);
>        len--;

The coder must have been smoking crack here.  Heard of "strlen()"?
And what's with the pointer to hold one single character? etc. etc.

>        switch (*len) {

Make this, "switch (*(argument+strlen(len)-1)) {" and remove the
"len" thing (which wasn't even declared in the code).

-dak


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