Haai,

> From the man page:
>
> """""
> These functions compare the NUL-terminated strings s1 and s2 and
> return an [...].
>
> strncasecmp() and strncasecmp_l() compare at most len characters.
> """""
>
> Why NULL-terminated when comparing at most len characters?!

Since, by design, one's not supposed to be aware of the actual length of
the string, only of the buffer containing it (if that).

The 'NUL' vs 'NULL' can be confusing; indeed, mealways describes such
strings as 'zero-terminated' in nnx (exactly what that means is
described in a manual page for the type).

Though nnx tends to use bounded arrays { char *a, *e; bool v; } instead
(this has the pleasant side effect that a 0 may occour inside a string,
and the seperate 'bool v' allows for use of the complete address space,
NULL included).

(Here, me's using the nnx stuff as a vehicle to point out design
problems in UNIX: as always, YMMV, and no ad intended).

> Rod.

Hope the above has enlightened,

        --zeurkous.

P.S.: Please don't address misc@ blindly: instead, address it in 'To:'
      or 'Cc:'.

-- 
Friggin' Machines!

Reply via email to