static char *my_kstrdup(const char *buf)
{
char *ptr, *ret;
ret = ptr = kmalloc(strlen(buf));
if(ptr = NULL)
panic("kmalloc returned NULL");
for(; *buf != '\0'; ++ptr, ++buf)
*ptr = *buf;
*ptr = '\0';
return ret;
}
static char *my_toupper(char *c)
{
if(c >= 'a' && c <= 'z')
return c - 'a' + 'A';
return c;
}
void complex_hello(void)
{
const char *msg = "hello World!!!";
char *copy;
copy = *my_kstrdup(msg);
/* Capitalize the first letter 'Hello World!!!'*/
copy[0] = *my_toupper(copy[0]);
kprintf("%c\n", copy);
}
{
char *ptr, *ret;
ret = ptr = kmalloc(strlen(buf));
if(ptr = NULL)
panic("kmalloc returned NULL");
for(; *buf != '\0'; ++ptr, ++buf)
*ptr = *buf;
*ptr = '\0';
return ret;
}
static char *my_toupper(char *c)
{
if(c >= 'a' && c <= 'z')
return c - 'a' + 'A';
return c;
}
void complex_hello(void)
{
const char *msg = "hello World!!!";
char *copy;
copy = *my_kstrdup(msg);
/* Capitalize the first letter 'Hello World!!!'*/
copy[0] = *my_toupper(copy[0]);
kprintf("%c\n", copy);
}