blob: 565c33443f16b3671d63ebbee2c560bb0262ee52 (
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
30
31
32
33
34
35
|
#ifndef KNOB_BLOCK_H
#define KNOB_BLOCK_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include <stdint.h>
void blockcpy(void *to, const void *from, uint32_t size);
bool blockequ(const void *a, const void *b, uint32_t size) __attribute__ ((__pure__));
//returns length without null-terminator
uint32_t strcpy(char *to, const char *from);
//allocates new memory
char *strdup(const char *from);
//without null-terminator
uint32_t strlen(const char *str) __attribute__ ((pure));
bool strequ(const char *a, const char *b) __attribute__ ((pure));
//if str has length == len, nothing is done
//if str has length < len, it is right-padded with spaces
//if str has length > len, the end is replaced with " ..."
//this replacement happens in place, with no memory allocation
void str_trunc_fill(char *str, uint32_t len);
#ifdef __cplusplus
}
#endif
#endif
|