add tcp_cmd_ prefix
This commit is contained in:
2023-12-02 10:54:18 +01:00
parent 12a7221a2e
commit 8a9df4d883

View File

@@ -154,7 +154,7 @@ static bool tcp_cmd_parser(struct tcp_pcb* pcb, int argc, char** argv) {
LOG_WARN(TAG, "No command given");
return false;
}
str_tolower(argv[0]);
tcp_cmd_str_tolower(argv[0]);
if (strcmp(argv[0], "help") == 0) {
LOG_INFO(TAG, "Printing help");
tcp_cmd_print_help(pcb);
@@ -252,7 +252,7 @@ static bool tcp_cmd_parser(struct tcp_pcb* pcb, int argc, char** argv) {
}
if (strcmp(argv[0], "setimage") == 0) {
if (argc >= 2) {
ext = get_filename_ext(argv[1]);
ext = tcp_cmd_get_filename_ext(argv[1]);
if (strcmp(ext, "bmp") != 0) {
LOG_WARN(TAG, "setimage: File is not a bmp");
tcp_cmd_write(pcb, "File is not a bmp\n");
@@ -276,7 +276,7 @@ static bool tcp_cmd_parser(struct tcp_pcb* pcb, int argc, char** argv) {
}
if (strcmp(argv[0], "setgif") == 0) {
if (argc >= 2) {
ext = get_filename_ext(argv[1]);
ext = tcp_cmd_get_filename_ext(argv[1]);
if (strcmp(ext, "gif") != 0) {
LOG_WARN(TAG, "setgif: File is not a gif");
tcp_cmd_write(pcb, "File is not a gif\n");
@@ -355,13 +355,13 @@ err_t tcp_cmd_recv(void* arg, struct tcp_pcb* pcb, struct pbuf* p, err_t err) {
// Tell the tcp stack that we have taken the data
tcp_recved(pcb, p->tot_len);
remove_newline(cmd, strlen(cmd));
tcp_cmd_remove_newline(cmd, strlen(cmd));
LOG_INFO(TAG, "cmd: %s", cmd);
// Split string into tokens by delimiter (space)
argv[0] = get_next_token(cmd, " ", &next);
argv[0] = tcp_cmd_get_next_token(cmd, " ", &next);
argc = 1;
while (argv[argc - 1] != NULL && argc < MAX_TOKENS) {
argv[argc] = get_next_token(NULL, " ", &next);
argv[argc] = tcp_cmd_get_next_token(NULL, " ", &next);
if (argv[argc] == NULL) {
break;
}