Am 12.08.2010 21:59, Adam D. Barratt schrieb:
> A quick question though:
> 
> +-              if (strncmp(buf, str, len) == 0 && buf[len] == '\0') {
> ++              if (strncmp(buf, "*", 2) == 0 ||
> ++              (strncmp(buf, str, len) == 0 && buf[len] == '\0')) {
> 
> Why the first two characters?  Should the * not always be at the start
> of the line?

Adam,

here is the answer i just received.

--- snip ----

The comparrison of '2' is to make sure you're not comparing it to a
string that just begins with a star.  E.g., you don't want it to match
"*foo".  So the '2' will make sure it only matches the "1-character"
string, "*" (which actually uses 2 bytes, the '*' and a NUL).

--- snap ----


Regards

Stefan
-- 
Stefan Bauer -----------------------------------------
PGP: E80A 50D5 2D46 341C A887 F05D 5C81 5858 DCEF 8C34
-------- plzk.de - Linux - because it works ----------


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: http://lists.debian.org/[email protected]

Reply via email to