-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsplinter_cli_input.c
More file actions
30 lines (24 loc) · 662 Bytes
/
splinter_cli_input.c
File metadata and controls
30 lines (24 loc) · 662 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* Copyright 2025 Tim Post
* License: Apache 2 (MIT available upon request to timthepost@protonmail.com)
*
* @file splinter_cli_input.c
* @brief Splinter CLI input routines
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/select.h>
#include "splinter_cli.h"
#include "linenoise.h"
// parse line input into an argv[] style array
char **cli_input_args(const char *prompt, int *argc) {
char *line = NULL;
char **argv = { 0 };
line = linenoise(prompt);
if (line == NULL) return NULL;
linenoiseHistoryAdd(line);
argv = cli_unroll_argv(line, argc);
linenoiseFree(line);
return(argv);
}