mirror of
https://github.com/nodemcu/nodemcu-firmware.git
synced 2025-01-16 20:52:57 +08:00
a463d764eb
Currently the UART driver break boot (or at least output).
27 lines
628 B
C
27 lines
628 B
C
#include "flash_fs.h"
|
|
#include <string.h>
|
|
|
|
int fs_mode2flag(const char *mode){
|
|
if(strlen(mode)==1){
|
|
if(strcmp(mode,"w")==0)
|
|
return FS_WRONLY|FS_CREAT|FS_TRUNC;
|
|
else if(strcmp(mode, "r")==0)
|
|
return FS_RDONLY;
|
|
else if(strcmp(mode, "a")==0)
|
|
return FS_WRONLY|FS_CREAT|FS_APPEND;
|
|
else
|
|
return FS_RDONLY;
|
|
} else if (strlen(mode)==2){
|
|
if(strcmp(mode,"r+")==0)
|
|
return FS_RDWR;
|
|
else if(strcmp(mode, "w+")==0)
|
|
return FS_RDWR|FS_CREAT|FS_TRUNC;
|
|
else if(strcmp(mode, "a+")==0)
|
|
return FS_RDWR|FS_CREAT|FS_APPEND;
|
|
else
|
|
return FS_RDONLY;
|
|
} else {
|
|
return FS_RDONLY;
|
|
}
|
|
}
|