40 lines
1.1 KiB
C
40 lines
1.1 KiB
C
#ifndef KERNEL_STRING_H
|
|
#define KERNEL_STRING_H
|
|
|
|
#include <types.h>
|
|
|
|
/** Integer to ascii */
|
|
char *itoa(int value, char *str, int base);
|
|
|
|
/** Fill memory with constant byte */
|
|
void *memset(void *dst, int c, size_t len);
|
|
|
|
/** Copy `len` bytes from `src` to `dst`. Undefined if regions overlap. */
|
|
void *memcpy(void *dst, const void *src, size_t len);
|
|
|
|
/** Copy `len` bytes from `src` to `dst`, safe for overlapping regions. */
|
|
void *memmove(void *dst, const void *src, size_t len);
|
|
|
|
/** Compare `len` bytes of `s1` and `s2`.
|
|
* Returns 0 if equal, <0 if s1 < s2, >0 if s1 > s2. */
|
|
int memcmp(const void *s1, const void *s2, size_t len);
|
|
|
|
/** Returns the length of a null-terminated string */
|
|
size_t strlen(const char *s);
|
|
|
|
/** Return length of string `s`, up to a max of `maxlen` bytes */
|
|
size_t strnlen(const char *s, size_t maxlen);
|
|
|
|
// TODO: These:
|
|
/*
|
|
int strcmp(const char *s1, const char *s2);
|
|
int strncmp(const char *s1, const char *s2, size_t n);
|
|
|
|
char *strcpy(char *dst, const char *src);
|
|
char *strncpy(char *dst, const char *src, size_t n);
|
|
|
|
char *strchr(const char *s, int c);
|
|
char *strrchr(const char *s, int c);
|
|
*/
|
|
|
|
#endif
|