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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
/**
* @file kio.h
*
* @author Freya Murphy <freya@freyacat.org>
*
* Kernel I/O definitions.
*/
#ifndef _KIO_H
#define _KIO_H
#include <stddef.h>
#include <stdarg.h>
/**
* Prints out a char
*
* @param c - the char
*/
void kputc(char c);
/**
* Prints out a null terminated string
*
* @param s - the string
*/
void kputs(const char *s);
/**
* prints out a formatted string
*
* @param format - the format string
* @param ... - variable args for the format
*/
__attribute__((format(printf, 1, 2))) void kprintf(const char *format, ...);
/**
* prints out a formatted string to a buffer
*
* @param s - the string to write to
* @param format - the format string
* @param ... - variable args for the format
* @returns number of bytes written
*/
__attribute__((format(printf, 2, 3))) size_t ksprintf(char *restrict s,
const char *format, ...);
/**
* prints out a formatted string to a buffer with a given max length
*
* @param s - the string to write to
* @param maxlen - the max len of the buffer
* @param format - the format string
* @param ... - variable args for the format
* @returns number of bytes written
*/
__attribute__((format(printf, 3, 4))) size_t ksnprintf(char *restrict s,
size_t maxlen,
const char *format, ...);
/**
* prints out a formatted string
*
* @param format - the format string
* @param args - variable arg list for the format
*/
void kvprintf(const char *format, va_list args);
/**
* prints out a formatted string to a buffer
*
* @param s - the string to write to
* @param format - the format string
* @param args - variable arg list for the format
* @returns number of bytes written
*/
size_t kvsprintf(char *restrict s, const char *format, va_list args);
/**
* prints out a formatted string to a buffer with a given max length
*
* @param s - the string to write to
* @param maxlen - the max len of the buffer
* @param format - the format string
* @param args - variable arg list for the format
* @returns number of bytes written
*/
size_t kvsnprintf(char *restrict s, size_t maxlen, const char *format,
va_list args);
#endif /* kio.h */
|