diff options
author | lonkaars <loek@pipeframe.xyz> | 2024-05-24 17:47:00 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2024-05-24 17:47:00 +0200 |
commit | 1a92ed5075aba4b41fe34422d21a2c66cdf1d4c9 (patch) | |
tree | a66d2dae13ab7c214da7b9ccf4701f0b7817c2e5 /client/parse.cpp | |
parent | 31c30df2a24a45c69a7c5c2f594fa3a9a835b1fb (diff) |
WIP `send` command
Diffstat (limited to 'client/parse.cpp')
-rw-r--r-- | client/parse.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/client/parse.cpp b/client/parse.cpp new file mode 100644 index 0000000..d15207c --- /dev/null +++ b/client/parse.cpp @@ -0,0 +1,32 @@ +#include <stdlib.h> +#include <string.h> + +#include "parse.h" + +static unsigned ifsrun(const char* input, const char* ift) { + unsigned i; + for (i = 0; input[i] != '\0' && strchr(ift, input[i]); i++); + return i; +} + +int strtodata(const char* str, char** data, size_t* size) { + const char* ifs = IFS; + *size = 0; + size_t i; + size_t str_len = strlen(str); + + // TODO: finish this parser + // for (i = 0; i < str_len; i++) { + // unsigned ifs_run = ifsrun(&str[i], ifs); + // + // } + + *size = str_len; + + *data = (char*) malloc(*size); + + memcpy(*data, str, *size); + + return 0; +} + |