MCPcopy Create free account
hub / github.com/cesanta/mongoose / cli_ls

Function cli_ls

tutorials/esp32/uart-bridge/main/cli.c:12–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10}
11
12static void cli_ls(void) {
13 DIR *dirp = opendir(FS_ROOT);
14 struct dirent *dp;
15 if (dirp == NULL) {
16 MG_ERROR(("Cannot open FS: %d", errno));
17 } else {
18 while ((dp = readdir(dirp)) != NULL) {
19 /* Do not show current and parent dirs */
20 if (strcmp((const char *) dp->d_name, ".") == 0 ||
21 strcmp((const char *) dp->d_name, "..") == 0) {
22 continue;
23 } else {
24 printf("%s\n", dp->d_name);
25 }
26 }
27 closedir(dirp);
28 }
29}
30
31static void cli_cat(const char *fname) {
32 char path[MG_PATH_MAX];

Callers 1

cliFunction · 0.85

Calls 3

opendirFunction · 0.50
readdirFunction · 0.50
closedirFunction · 0.50

Tested by

no test coverage detected