summaryrefslogtreecommitdiff
path: root/src/user/include/knob/format.h
blob: fed31c71a869b384d345e711190ecc821e83a93b (plain) (blame)
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
#ifndef KNOB_FORMAT_H
#define KNOB_FORMAT_H

#include <knob/heap.h>

#include <stdint.h>
#include <stdarg.h>

//allocates new memory
char *format_v(const char *fmt, va_list args);

//allocates new memory
char *format(const char *fmt, ...);

void syslogf_v(const char *fmt, va_list args);

void syslogf(const char *fmt, ...);

//reads a unsigned decimal terminated by either null or whitespace
//returns length of string plus length of whitespace
//returns 0 on failure
uint32_t try_swtou(const char *from, uint32_t *i_out);

//reads a hexadecimal terminated by either null or whitespace
//returns length of string plus length of whitespace
//returns 0 on failure
uint32_t try_swtoh(const char *from, uint32_t *i_out);

#endif