Files
Sepp J Morris 31738079c4 Upload
Digital Research
2020-11-06 18:50:37 +01:00

35 lines
818 B
C
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*********************************************************************
* STRNCMP - compares strings up to n chars
*
* WORD strncmp(s1,s2,n)
* BYTE *s1, *s2;
* UWORD n;
*
* 'strncmp' compares null terminated strings s1 and s2, and examines
* at most n chars.
* Always compares at least 1 char.
* n < 0 compares many, many characters.
* Returns:
* strncmp < 0 if s1<s2 (within n chars)
* strncmp = 0 if s1=s2 " " "
* strncmp > 0 if s1>s2 " " "
*********************************************************************/
#include <portab.h>
WORD strncmp(s1,s2,num) /* CLEAR FUNCTION ***********/
REG BYTE *s1, *s2;
REG WORD num;
{
for( ; --num > 0 && (*s1 == *s2); s1++, s2++ )
if( *s1 == NULL )
return(0);
return(*s1 - *s2);
}
;
return(*s1 - *s2);
}
;
return(*s1 - *s2);
}