summaryrefslogtreecommitdiffhomepage
path: root/src/internal/ntux_ntaio_impl.c
blob: 53fdf3c0f5b2a072fc46d1a330d32525d0af8b13 (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
/***********************************************************/
/*  ntux: native translation und extension                 */
/*  Copyright (C) 2016--2021  SysDeer Technologies, LLC    */
/*  Released under GPLv2 and GPLv3; see COPYING.NTUX.      */
/***********************************************************/

#include <psxabi/sys_sysapi.h>
#include <psxabi/sys_errno.h>

#include <psxxfi/xfi_base.h>
#include <psxxfi/xfi_acl.h>

#include <ntapi/nt_memory.h>
#include <ntapi/nt_file.h>
#include <ntapi/nt_process.h>

int ntux_sprintf(char * str, const char * fmt, ...)
{
	int     ret;
	va_list ap;

	va_start(ap, fmt);
	ret = __xfi_vsprintf(str, fmt, ap);
	va_end(ap);

	return ret;
}

int ntux_snprintf(char * str, size_t n, const char * fmt, ...)
{
	int     ret;
	va_list ap;

	va_start(ap, fmt);
	ret = __xfi_vsnprintf(str, n, fmt, ap);
	va_end(ap);

	return ret;
}

int ntux_isatty(int fildes)
{
	return __xfi_get_runtime_data_file_type(fildes) == NT_FILE_TYPE_PTY;
}