summaryrefslogtreecommitdiff
path: root/miniany/libc-hosted.c
blob: f602de1651b9552e236550e285bea16845a13b7c (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
/*
 * include files for C library of the host. Currently only tested
 * with glibc 2.31.
 */

#define _XOPEN_SOURCE 600
#include <bsd/string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

int putstring( char *s )
{
	printf( "%s", s );
	
	return 0;
}

int putint( int i )
{
	printf( "%d", i );

	return i;
}

int putnl( void )
{
	return puts( "" );
}

char *itoa( int v, char *s, int base )
{
	switch( base ) {
		case 10:
			sprintf( s, "%d", v );
			return s;
		case 16:
			sprintf( s, "%x", v );
			return s;
			
		default:
			return NULL;
	}
}