summaryrefslogtreecommitdiffstats
path: root/include/stdio.h
blob: b2a843edbe9cc63379b7822c5461557a6d373312 (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
#ifndef __STDIO_H
#define __STDIO_H

#include <stdarg.h>
#include <console.h>

/*
 * STDIO based functions (can always be used)
 */

/* serial stuff */
void	serial_printf (const char *fmt, ...);

/* stdin */
int	tstc(void);

/* stdout */
void	console_putc(unsigned int ch, const char c);
int	getc(void);
void	console_puts(unsigned int ch, const char *s);

static inline void puts(const char *s) {
	return console_puts(CONSOLE_STDOUT, s);
}

static inline void putchar(char c) {
	console_putc(CONSOLE_STDOUT, c);
}

int	printf(const char *fmt, ...);
int	vprintf(const char *fmt, va_list args);
int	sprintf(char * buf, const char *fmt, ...);
int	vsprintf(char *buf, const char *fmt, va_list args);

/* stderr */
#define eputc(c)		console_putc(CONSOLE_STDERR, c)
#define eputs(s)		console_puts(CONSOLE_STDERR, s)
#define eprintf(fmt,args...)	fprintf(stderr,fmt ,##args)

/*
 * FILE based functions
 */

#define stdin		0
#define stdout		1
#define stderr		2
#define MAX_FILES	16

void	fprintf(int file, const char *fmt, ...);
int	fputs(int file, const char *s);
int	fputc(int file, const char c);
int	ftstc(int file);
int	fgetc(int file);

#endif /* __STDIO_H */