-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathstring.h
More file actions
32 lines (25 loc) · 1.2 KB
/
string.h
File metadata and controls
32 lines (25 loc) · 1.2 KB
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
/*****************************************************************
* This file is part of CosmOS *
* Copyright (C) 2019-2020 Kurt M. Weber *
* Released under the stated terms in the file LICENSE *
* See the file "LICENSE" in the source distribution for details *
*****************************************************************/
#ifndef _STRING_H
#define _STRING_H
#include <types.h>
// itoa.c
void uitoa3(uint64_t n, char* s, uint16_t len, uint8_t base);
// string.c
uint64_t strlen(const uint8_t* s);
// note that this allocates a new string!
uint8_t* strtrim(const uint8_t* s);
// len is the byte size of the dest buffer
uint8_t* strncpy(uint8_t* dest, const uint8_t* src, uint64_t len);
// len is the byte size of the dest buffer
uint8_t* strncat(uint8_t* dest, const uint8_t* src, uint64_t len);
uint8_t strcmp(const uint8_t* str1, const uint8_t* str2);
uint8_t strncmp(const uint8_t* str1, const uint8_t* str2, uint64_t len);
// returns -1 if unable to find
uint32_t strstr(const uint8_t* str1, uint32_t start, const uint8_t* str2);
uint8_t* substr(const uint8_t* str1, uint32_t start, uint32_t end, uint8_t* str2, uint32_t size);
#endif