#include <ncbi.h>
#include <gishlib.h>

/*
	str_prefix(s, pref)

	Returns 0 if 'pref' is a perfect prefix of 's'.
	Otherwise, returns the same result as a call to strcmp().
*/

int LIBCALL
str_prefix(s, pref)
	CharPtr	s, pref;
{
	register BytePtr
			us = (BytePtr)s,
			upref = (BytePtr)pref;
	register Byte	ch;

	while ((ch = *upref++) == *us++)
		if (ch == NULLB)
			return 0;
	if (ch == NULLB)
		return 0;
	return (int)ch - (int)*--us;
}
