blob: 1231a6d8b32a8d3b50682024c6912764a13c44ee (
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
|
#ifndef KNOB_BLOCK_H
#define KNOB_BLOCK_H
#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);
#endif
|