I'm trying to use uart_poll_out instead of printk with my program and before with printk I was able to get the correct output I wanted to my uart console. Here was the code and correct output:
    for (int i = 0; i < sizeof cmd_handles / sizeof cmd_handles[0]; i++)
    {
        printk("%s\t%s\n", cmd_handles[i].cmd, cmd_handles[i].help);
    }
help    Show commands and descriptions
sample  sample function
Now I have to use uart_poll_out and my output is messed up. I don't know how to fix it/what is wrong with it. Here is my code and (incorrect) output. I want the output to look the same as above.
    for (int i = 0; i < sizeof cmd_handles / sizeof cmd_handles[0]; i++)
    {
        u8_t tempbuff[1];
        u8_t buf[sizeof(cmd_handles[i].cmd) + sizeof(cmd_handles[i].help) + 5]; // the 5 is arbitrary
        sprintf(buf, "%s\t%s\n", cmd_handles[i].cmd, cmd_handles[i].help);
        for (int i = 0; i < sizeof(buf); i++)
        {
            uart_poll_out(comm_uart, buf[i]);
        }
    }
help    Show comsample  sample
This is cmd_handles:
const cli_cmd_handle_t cmd_handles[] =
{
    {.cmd = "help", .help = "Show commands and descriptions", .handler = cli_help_handler},
    {.cmd = "sample", .help = "sample function", .handler = sample_function},
};
Does anyone know how to fix this? Thanks :)
Edit: definition of cli_cmd_handle_t:
{
    const char *cmd;
    const char *help;
    CliCmdHandler handler;
} cli_cmd_handle_t;```
