/src/serenity/AK/kstdio.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <AK/Platform.h> |
10 | | |
11 | | #ifdef AK_OS_SERENITY |
12 | | # ifdef KERNEL |
13 | | # include <Kernel/kstdio.h> |
14 | | # else |
15 | | # include <AK/Types.h> |
16 | | # include <stdarg.h> |
17 | | extern "C" { |
18 | | void dbgputstr(char const*, size_t); |
19 | | int sprintf(char* buf, char const* fmt, ...) __attribute__((format(printf, 2, 3))); |
20 | | int snprintf(char* buffer, size_t, char const* fmt, ...) __attribute__((format(printf, 3, 4))); |
21 | | } |
22 | | # endif |
23 | | #else |
24 | | # include <stdio.h> |
25 | | inline void dbgputstr(char const* characters, size_t length) |
26 | 91.0k | { |
27 | | fwrite(characters, 1, length, stderr); |
28 | 91.0k | } |
29 | | #endif |
30 | | template<size_t N> |
31 | | inline void dbgputstr(char const (&array)[N]) |
32 | | { |
33 | | return ::dbgputstr(array, N); |
34 | | } |