#include <stdint.h>            
 
#include "main.h"
 
struct struct_sizes {
    const char *name;
    uint64_t size;
    uint64_t expected;
};
 
 
static union {
    uint64_t d; 
    void *v;
} app_stopped = {.v = NULL};
 
static void
{
    switch (exit_type) {
        
        if (val == SIGUSR1)
            return;
 
        cne_printf_pos(99, 1, 
"\n>>> [cyan]Terminating with signal [green]%d[]\n", val);
 
        app_stopped.d = 1;
        break;
 
        if (val)
            cne_printf_pos(99, 1, 
"\n>>> [cyan]Terminating with status [green]%d[]\n", val);
 
        break;
 
        app_stopped.d = 1;
        break;
 
    default:
        break;
    }
}
 
static int
sizeof_cmd(int argc, char **argv)
{
    
    struct struct_sizes ssizes[] = {
        {"lport_stats", sizeof(lport_stats_t)},
        {
"txbuff", 
sizeof(
struct txbuff)},
 
    };
    
    int i;
 
 
 
    for (i = 0; i < cne_countof(ssizes); i++) {
        if (ssizes[i].name == NULL)
            break;
        cne_printf(
"  [magenta]%-24s[]= [green]%ld[]", ssizes[i].name, ssizes[i].
size);
 
        if (ssizes[i].expected && (ssizes[i].
size != ssizes[i].expected))
 
            cne_printf(
"  [red]*** Size Error expected %ld ***[]", ssizes[i].expected);
 
    }
 
    return 0;
}
 
static int
{
    app_stopped.d = 1;
 
    return 0;
}
 
static struct cli_tree default_tree[] = {
 
    c_cmd("stop", stop_cmd, "Stop the CNDP application"),
    c_cmd("sizeof", sizeof_cmd, "Size of structures"),
 
    c_end()
};
 
static int
init_tree(void)
{
    
        return -1;
 
    
        return -1;
 
    
        return -1;
 
    return 0;
}
 
static int
{
 
    if (!p)
        p = (char *)(uintptr_t) "PathError";
 
    cne_printf(
"[orange]cli[]:[magenta]%s[yellow]>[] ", p);
 
 
    return (strnlen(p, 128) + strnlen("cli:> ", 7));
}
 
static void *
{
    if (c) {
        int fd_in, fd_out;
 
        accept_c = c;
 
 
 
 
 
 
        
        cli_start(
"CNDP Example CLI, use 'ls -lr' or 'chelp -a' to see all commands");
 
 
    }
 
    return app_stopped.v;
}
 
static void
usage(int err)
{
    cne_printf(
"[cyan]cli[]: [yellow]CLI Test example[]\n");
 
    cne_printf(
"    [yellow]-s,--socket host[]  - [green]The local domain path or host:port[]\n");
 
    cne_printf(
"    [yellow]-h,--help[]         - [green]This help message[]\n");
 
    exit(err);
}
 
int
main(int argc, char *argv[])
{
    
    struct option lgopts[] = {
        { "socket",     1, NULL, 's' },
        { "help",       no_argument, NULL, 'h' },
        { NULL, 0, 0, 0 }
    };
    
    int option_index, opt;
 
    option_index = 0;
    while ((opt = getopt_long(argc, argv, "hs:", lgopts, &option_index)) != -1) {
        switch (opt) {
        case 'h':
            usage(EXIT_SUCCESS);
            break;
        case 's': 
            strlcpy(host_str, optarg, sizeof(host_str));
            break;
        default:
            break;
        }
    }
 
 
 
 
    if (!c)
 
    cne_printf(
"*** [yellow]CLI [green]Example application using [lightgoldenrod]%s[]\n",
 
               (host_str[0] == '\0') ? "stdio" : host_str);
 
 
 
    return 0;
out:
    return -1;
}
static struct cli_node * cli_root_node(void)
 
static char * cli_path_string(struct cli_node *node, char *path)
 
CNDP_API int cli_default_tree_init(void)
 
CNDP_API void cli_start(const char *msg)
 
CNDP_API void cli_set_quit_flag(void)
 
CNDP_API int cli_setup_with_tree(cli_tree_t tree)
 
CNDP_API void cli_destroy(void)
 
CNDP_API int cli_create(struct cli_cfg *cfg)
 
CNDP_API int cli_add_tree(struct cli_node *dir, struct cli_tree *tree)
 
CNDP_API int cli_add_bin_path(const char *path)
 
CNDP_API cli_prompt_t cli_set_prompt(cli_prompt_t prompt)
 
CNDP_API int cne_init(void)
 
CNDP_API int cne_on_exit(on_exit_fn_t exit_fn, void *arg, int *signals, int nb_signals)
 
#define CNE_NULL_RET(...)
 
#define CNE_ERR_GOTO(lbl,...)
 
CNDP_API int cne_printf_pos(int16_t r, int16_t c, const char *fmt,...)
 
CNDP_API int cne_printf(const char *fmt,...)
 
CNDP_API int tty_setup(int fd_in, int fd_out)
 
CNDP_API void tty_destroy(void)
 
@ CSOCK_MAX_SOCK_INFO_LENGTH
 
CSOCK_API int csock_server_start(csock_t *c)
 
CSOCK_API int csock_get_fd(csock_t *c)
 
CSOCK_API void csock_destroy(csock_t *c)
 
CSOCK_API csock_t * csock_create(csock_cfg_t *cfg)
 
CSOCK_API int csock_close(csock_t *c)
 
csock_client_fn_t * client_fn