增加网络配置界面

This commit is contained in:
2026-09-10 11:36:33 +08:00
parent 020278d4e3
commit 8e1fd3b2b8
44 changed files with 2488 additions and 332 deletions
+10 -8
View File
@@ -3,6 +3,8 @@
#include <string.h>
#include <ctype.h>
#include "FreeRTOS.h"
#include "ff.h"
#include "private/lftpd_io.h"
@@ -41,19 +43,19 @@ char *lftpd_io_canonicalize_path(const char *base, const char *name)
char *path;
if (name[0] == '/') {
path = (char *)malloc(strlen(name) + 1);
path = (char *)pvPortMalloc(strlen(name) + 1);
if (path == NULL) return NULL;
strcpy(path, name);
} else {
size_t len = strlen(base) + 1 + strlen(name) + 1;
path = (char *)malloc(len);
path = (char *)pvPortMalloc(len);
if (path == NULL) return NULL;
snprintf(path, len, "%s/%s", base, name);
}
char *abs_path = (char *)malloc(strlen(path) + 2);
char *abs_path = (char *)pvPortMalloc(strlen(path) + 2);
if (abs_path == NULL) {
free(path);
vPortFree(path);
return NULL;
}
abs_path[0] = '\0';
@@ -83,7 +85,7 @@ char *lftpd_io_canonicalize_path(const char *base, const char *name)
*p = saved;
}
free(path);
vPortFree(path);
if (strlen(abs_path) == 0) {
strcpy(abs_path, "/");
@@ -186,13 +188,13 @@ int lftpd_io_unlink(const char *path)
void *lftpd_io_opendir(const char *path)
{
DIR *dp = (DIR *)malloc(sizeof(DIR));
DIR *dp = (DIR *)pvPortMalloc(sizeof(DIR));
if (dp == NULL) {
return NULL;
}
const char *fpath = to_fatfs_path(path);
if (f_opendir(dp, fpath) != FR_OK) {
free(dp);
vPortFree(dp);
return NULL;
}
return (void *)dp;
@@ -230,6 +232,6 @@ void lftpd_io_closedir(void *dp)
{
if (dp != NULL) {
f_closedir((DIR *)dp);
free(dp);
vPortFree(dp);
}
}