Re: Redoing Advance...

From: Mike Breuer (mbreuer@new.rr.com)
Date: 11/10/01


----- Original Message -----
From: "Pj Bean" <pj_bean@HOTMAIL.COM>

>> char *name = NULL, *position = NULL;
>> argument = one_argument(argument, name);
>> one_argument(argument,position);
> No it works just fine ...it saves the cursor inside the string so you can
> just use one_argument again to grab the second argument, it works just
fine,
> ive used it for years, btw ...its just a pointer to the string sent to the
> function, its not an actualy char, no need for allocating memory

I actually went and downloaded bpl19 on the off chance that this had changed
since the version I have.  It hasn't; you are confused.  one_argument most
definitely expects to be able to write to the second buffer that you pass,
so it MUST be allocated memory, not a pointer set to NULL.  Change the
declarations to:

char name[MAX_INPUT_LENGTH], position[MAX_INPUT_LENGTH];

> Im use to str_prefix usually being case insensitive and str_cmp not,
> Thankyou for clearin it up.

Just to be clear, str_cmp is not a standard C function.  It was specifically
written for convenience within the CircleMUD codebase.  DAK is also correct
that it is not necessary because one_argument() actually converts the
argument to lower case before copying it into the buffer you pass (the
original argument pointer is unmodified by the function itself).

Mike

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST