Port fat_io_lib, mount atasd0mp1 as sys:
This commit is contained in:
6
kernel/std/assert.h
Normal file
6
kernel/std/assert.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef STD_ASSERT_H_
|
||||
#define STD_ASSERT_H_
|
||||
|
||||
#define assert(x)
|
||||
|
||||
#endif // STD_ASSERT_H_
|
||||
@ -14,7 +14,7 @@ void *memcpy(void *dst, const void *src, size_t n) {
|
||||
return dst;
|
||||
}
|
||||
|
||||
size_t strlen(char *s) {
|
||||
size_t strlen(const char *s) {
|
||||
char *s2;
|
||||
for (s2 = s; *s2; ++s2);
|
||||
return (s2 - s);
|
||||
@ -149,3 +149,27 @@ char *strcat(char *dest, const char *src) {
|
||||
dest[i+j] = '\0';
|
||||
return dest;
|
||||
}
|
||||
|
||||
int strncmp( const char * s1, const char * s2, size_t n )
|
||||
{
|
||||
while ( n && *s1 && ( *s1 == *s2 ) )
|
||||
{
|
||||
++s1;
|
||||
++s2;
|
||||
--n;
|
||||
}
|
||||
if ( n == 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ( *(unsigned char *)s1 - *(unsigned char *)s2 );
|
||||
}
|
||||
}
|
||||
|
||||
void strncpy( char* _dst, const char* _src, size_t _n )
|
||||
{
|
||||
size_t i = 0;
|
||||
while(i++ != _n && (*_dst++ = *_src++));
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
void *memset(void *p, int c, size_t n);
|
||||
void *memcpy(void *dst, const void *src, size_t n);
|
||||
size_t strlen(char *s);
|
||||
size_t strlen(const char *s);
|
||||
int strcmp(const char *a, const char *b);
|
||||
size_t strcspn(const char *s, const char *reject);
|
||||
size_t strspn(const char *s, const char *accept);
|
||||
@ -14,5 +14,7 @@ char *strchr(const char *s, int c);
|
||||
int memcmp(const void *s1, const void *s2, int len);
|
||||
char *strstr(const char *str, const char *substring);
|
||||
char *strcat(char *dest, const char *src);
|
||||
int strncmp( const char * s1, const char * s2, size_t n );
|
||||
void strncpy( char* _dst, const char* _src, size_t _n );
|
||||
|
||||
#endif // STD_STRING_H_
|
||||
|
||||
Reference in New Issue
Block a user