summaryrefslogtreecommitdiffhomepage
path: root/src/internal/ntux_nolibc_impl.c
blob: b5a016b82a64382076003cec66b63cdede7d4c05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/***********************************************************/
/*  ntux: native translation und extension                 */
/*  Copyright (C) 2016--2018  Z. Gilboa                    */
/*  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)
{
	return __xfi_memcpy(
		dst,src,
		__xfi_strlen(src));
}

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;
}

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

	return 1;
}
#endif