HP3000-L Archives

December 2000, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Emerson, Tom # El Monte" <[log in to unmask]>
Reply To:
Emerson, Tom # El Monte
Date:
Mon, 4 Dec 2000 18:39:22 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (60 lines)
Good eyes (yours) / bad eyes (mine)

[worse still, the "test" key I was using was "KEY3" -- exactly 4 chars in
length]

I had actually meant

   strncpy(k,argv[1],strlen(argv[1]));

I was screen-mode cut/pasting this, and took this from the line above where
I originally had "memset(k,' ',sizeof(k))", which is pre-filling the buffer
with spaces.  Note that if this is not done, there is no guarantee that this
value is "padded" with spaces.

An alternate form (that might make more sense to some since it follows an
"english language" translation) would be

   strcpy(k,argv[1]);
   memset(k+strlen(k),' ',16-strlen(k));

[with the "english language" being "copy the key you are interested in
finding to a key-buffer, then pad the buffer with blanks for the full length
of the [KSAM] key"]  However, this doesn't take into account an attempt to
find a 17-character key [larger than the actual key...]  Most likely,
without further error checking, this will "blow up" every variant we've
discussed so far.

> -----Original Message-----
> From: Stan Sieler [mailto:[log in to unmask]]
> Sent: Monday, December 04, 2000 3:08 PM
> To: [log in to unmask]
> Subject: Re: KSAM Intrinsic help
>
>
> Re:
> >     strncpy(k,argv[1],sizeof(argv[1]));  /*  <=== note the
> difference! */
>
> That sizeof is probably not what you want...it's the value 4, always.
>
> Did you want, perhaps:
>
>     i = strlen (argv [1]);
>     memset(k,' ',sizeof(k));
>     memcpy (k,argv[1],i);                /*  <=== note the
> difference!*/
>
> Having done that, find that a length of 0 still doesn't work for
> me.  If I change the FFINDBYKEY to be:
>
>     FFINDBYKEY(ksm,k,0,i,0);
>
> then it works.
>
> Stan Sieler
> [log in to unmask]
> www.allegro.com/sieler/wanted/index.html
> www.allegro.com/sieler
>

ATOM RSS1 RSS2