console: add console_resize()
This commit is contained in:
parent
9a4ff385bd
commit
f001be171c
4 changed files with 34 additions and 3 deletions
22
lib/string.c
22
lib/string.c
|
|
@ -18,6 +18,14 @@ char *strcpy(char *dest, const char *src)
|
|||
return dest;
|
||||
}
|
||||
|
||||
size_t strlen(const char *c)
|
||||
{
|
||||
const char *b = c;
|
||||
while (*b++)
|
||||
;
|
||||
return b - c - 1;
|
||||
}
|
||||
|
||||
int memcmp(const void *aa, const void *bb, size_t num)
|
||||
{
|
||||
const char *a = (const char *)aa;
|
||||
|
|
@ -38,3 +46,17 @@ void *memset(void *str, int c, size_t n)
|
|||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
int atoi(const char *a)
|
||||
{
|
||||
int ndigits = strlen(a);
|
||||
int b = 1;
|
||||
|
||||
int ret = 0;
|
||||
|
||||
for (int i = ndigits - 1; i >= 0; i--) {
|
||||
ret += b * (a[i] - '0');
|
||||
b *= 10;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue