blob: a4f11e2746721d19e7c7b3a2ece7bbbe634facbd [file] [log] [blame]
// Copyright 2016 The Fuchsia Authors. All rights reserved.
// Copyright (c) 2008 Travis Geiselbrecht
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <uchar.h>
#include <zircon/compiler.h>
#define printf(x...) _printf(x)
static inline int __PRINTFLIKE(1, 2) printf(const char *fmt, ...) { return 0; }
int _printf(const char *fmt, ...) __PRINTFLIKE(1, 2);
int sprintf(char *str, const char *fmt, ...) __PRINTFLIKE(2, 3);
int snprintf(char *str, size_t len, const char *fmt, ...) __PRINTFLIKE(3, 4);
int vsprintf(char *str, const char *fmt, va_list ap);
int vsnprintf(char *str, size_t len, const char *fmt, va_list ap);
#define fprintf(fd, x...) printf(x)
/* printf engine that parses the format string and generates output */
/* function pointer to pass the printf engine, called back during the formatting.
* input is a string to output, length bytes to output (or null on string),
* return code is number of characters that would have been written, or error code (if negative)
typedef int (*_printf_engine_output_func)(const char *str, size_t len, void *state);
int _printf_engine(_printf_engine_output_func out, void *state, const char *fmt, va_list ap);
// Print a wide string to console
int puts16(char16_t *str);