 |
strncmp |
Function (ROM Call 0x272) |
Compares at most maxlen characters of one string to another.
strncmp makes the same unsigned comparison as strcmp, but looks at no more
than maxlen characters. It starts with the first character in each string and
continues with subsequent characters until the corresponding characters
differ or until it has examined maxlen characters. strncmp returns an int
value based on the result of comparing s1 (or part of it) to s2 (or part of
it):
- < 0 if s1 is less than s2
- == 0 if s1 is the same as s2
- > 0 if s1 is greater than s2
More precisely, if the strings differ, the value of the first nonmatching character in s2
subtracted from the corresponding character in s1 is returned. The
subtraction casts the input strings to unsigned chars so that the characters
in the range 128..255 are considered above the characters in the range 0..127.
Note: This routine is declared as "short" although the ANSI standard proposes "long". This is important,
because TIOS the strncmp routine puts garbage in the higher half of the d0 register.
Used by: TIOS_EV_getAppID
See also: strcmp