Re: Re: your mail

From: The Arrow (pt94jpi@student.hk-r.se)
Date: 10/02/96


First of all I want to appologize for forgetting to put a subject on my
first mail :)

On Thu, 3 Oct 1996, Niese-Petersen wrote:
[SNIP]
> 
>  /* A little quicky */
> 
> int test(char *keywords, char *testwords) {
>   int ok = TRUE;
>   char lookword[256];
> 
>   keywords = one_argument(keywords, lookword);
> 
>   while(ok && *lookword)
>     if(isname(lookword, testwords))
>       keywords = one_argument(keywords, lookword);
>     else
>       ok = FALSE;
> 
>   return(ok);
> }
> 
> 
> Now.. Before anyone come and say "why not just use str_cmp ??", then
> remember, its possible that keywords are "long sword" and testwords are
> "sword long"  :)

I renamed the isname function to is_name, took the function above and
renamed it isname (and remebered to change the call to isname() in the
new isname to is_name to prevent recursion, could anyone follow that? :)
and it still didn't work! My test commands was "vnum o long sword" and
"vnum o sword long".
_BUT_! And this is a bit but! :) After putting in some printf calls, I
noticed that the vnum_object function only got the first word of the 
object to search for.
So I changed this line in do_vnum:
  two_arguments(argument, buf, buf2);
to:
  char *buf2;
  buf2 = one_argument(argument, buf);
and then it worked!

So now its time to go through all the code, looking for places to switch
from two_arguments() to one_argument().

Gosh, who knew it could be that simple! :)

Thanks for getting me on track!

/ Joachim

---------------------------------------------------------------------
  The Arrow              Moses@PTMUD   sargasso.fukt.hk-r.se 4000

  Joachim Pileborg       Email: pt94jpi@student.hk-r.se
  Svarvarevägen 5
  37230 Ronneby          http://www.rby.hk-r.se/~pt94jpi/pt94jpi.html
  SWEDEN
---------------------------------------------------------------------

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



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