tcp_cmd
remove tcp_cmd_get_filename_ext and move over to llfs variant
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
|
||||
void tcp_cmd_remove_newline(char* str, size_t len);
|
||||
char* tcp_cmd_remove_leading_space(char* str, size_t len);
|
||||
char* tcp_cmd_get_filename_ext(char* filename);
|
||||
char* tcp_cmd_get_next_token(char* input, const char* delimiters, char** next);
|
||||
void tcp_cmd_init(void);
|
||||
err_t tcp_cmd_recv(void* arg, struct tcp_pcb* pcb, struct pbuf* p, err_t err);
|
||||
|
||||
@@ -100,18 +100,6 @@ void tcp_cmd_str_tolower(char* str) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function returns the extension of a file
|
||||
* @param filename The filename to get the extension from
|
||||
* @return char* The extension of the file
|
||||
*/
|
||||
char* tcp_cmd_get_filename_ext(char* filename) {
|
||||
char* dot = strrchr(filename, '.');
|
||||
if (!dot || dot == filename)
|
||||
return NULL;
|
||||
return dot + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function finds the next token in the input string
|
||||
* If the token is between quotes, return the whole string between quotes
|
||||
@@ -290,7 +278,7 @@ static bool tcp_cmd_parser(struct tcp_pcb* pcb, int argc, char** argv) {
|
||||
}
|
||||
if (strcmp(argv[0], "setimage") == 0) {
|
||||
if (argc >= 2) {
|
||||
ext = tcp_cmd_get_filename_ext(argv[1]);
|
||||
ext = llfs_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");
|
||||
@@ -314,7 +302,7 @@ static bool tcp_cmd_parser(struct tcp_pcb* pcb, int argc, char** argv) {
|
||||
}
|
||||
if (strcmp(argv[0], "setgif") == 0) {
|
||||
if (argc >= 2) {
|
||||
ext = tcp_cmd_get_filename_ext(argv[1]);
|
||||
ext = llfs_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");
|
||||
|
||||
Reference in New Issue
Block a user