strncmp

This macro performs limited comparison of two strings. It is used to compare strings in ASCII sequence, except that the comparison stops after count characters, or when the first NUL character is encountered, whichever comes first.

This macro behaves like the strncmp function in the ANSI C string library.

Syntax:

char *strncmp (str1, str2, count)
char *
str1;
char *
str2;
int
count;

where:

str1                       Specifies the location in memory of the first byte of a character string.

str2                       Specifies the location in memory of the first byte of a character string.

count                    Specifies the number of characters in each string to compare, unless the NUL character is encountered in either string first.

Return Value

int                     One of the following:

-1     Indicates that str2 comes after str1 in the machine collating sequences, str1 < str2.

0      Indicates that the two strings are identical in content.

1      Indicates that str1 comes after str2 in the machine collating sequences, str2 < str1.

Rules