/****************************************************************************/
/*	Copyright (c) 2009, Bendor Research Pty. Ltd. All rights reserved.		*/
/*	This software is released under the GNU General Public License, version	*/
/*	3, with the exemptions that 1) the header files installed by this 	 	*/
/*	package can be included in closed-source code and 2) the libraries		*/
/*	built by this package can be statically linked into a closed-source 	*/
/*	binary. See the file LICENSE for the details.							*/
/*	This software is provided "AS IS", without any warranty or guarantee.	*/
/*	By using this software you acknowledge that neither Bendor Research nor	*/
/*	any of its personnel or affiliates can be held liable for any damages,	*/
/*	including, but not limited to, loss of business, loss of money, loss of */
/*	life, loss of reputation, arising out of this software being faulty or	*/
/*	not performing as advertised, even if Bendor Research was aware of such	*/
/*	faults in the software. You use this software at your own risk, any and */
/*	all liabilities that arise out of your using this software are strictly	*/
/*	yours.																	*/
/****************************************************************************/

#include <string.h>

/** @addtogroup string */
/** @{ */

/**
*	Compare two NUL terminated strings.
*
*	The function compares the strings byte after byte, as unsigned chars.
*	The comparison stops at the first byte that is different or when a NUL
*	in either string is reached. A string is considered smaller than an
*	other if the first differing character is a smaller unsigned number
*	is less than the character at the same position in the other string.
*
*	@param	s1		Pointer to the first string
*	@param	s2		Pointer to the second string
*
*	@return			An integer value that is 0 if s1 and s2 are identical,
*					a negative number if s1 is smaller that s2 and a positive
*					number if s1 is greater than s2. The actual numeric value
*					of the return value is undeterminate, only its signum is
*					significant.
*/

int		strcmp( const char *s1, const char *s2 )
{
unsigned char	a, b;
int				c;

	for ( ;; ) {

		a = *s1++;
		b = *s2++;
		c = a - b;
		if ( a == 0 || a != b ) return( c );
	}
}

/** @} */

