Blob Blame History Raw
/***********************************************************/
/*  ntux: native translation und extension                 */
/*  Copyright (C) 2016--2021  SysDeer Technologies, LLC    */
/*  Released under GPLv2 and GPLv3; see COPYING.NTUX.      */
/***********************************************************/

#include <psxxfi/xfi_base.h>

void * ntux_memcpy(void * dst, const void * src, size_t n)
{
	return __xfi_memcpy(dst,src,n);
}

void * ntux_memset(void * ch, int c, size_t n)
{
	return __xfi_memset(ch,c,n);
}

char * ntux_strcpy(char * dst, const char * src)
{
	size_t srclen;

	srclen = __xfi_strlen(src);
	__xfi_memcpy(dst,src,srclen);
	dst[srclen] = '\0';

	return dst;
}

size_t ntux_strlen(const char * ch)
{
	return __xfi_strlen(ch);
}

int ntux_strcmp(const char * a, const char * b)
{
	return __xfi_strcmp(a,b);
}

int ntux_strncmp(const char * a, const char * b, size_t n)
{
	return __xfi_strncmp(a,b,n);
}

char * ntux_strchr(const char * ch, int c)
{
	for (; *ch; ch++)
		if (*ch == c)
			return (char *)ch;
	return 0;
}

char * ntux_strrchr(const char * ch, int c)
{
	const char * base;

	base = ch;
	ch  += __xfi_strlen(ch);

	for (; ch >= base; ch--)
		if (*ch == c)
			return (char *)ch;
	return 0;
}

int ntux_isblank(int c)
{
	return ((c == 0x20) || (c == 0x09));
}

#ifdef NTUX_EXPORT
int __stdcall ntux_entry_point(void * hinstance, uint32_t reason, void * reserved)
{
	(void)hinstance;
	(void)reason;
	(void)reserved;

	return 1;
}
#endif