| 10 | } |
| 11 | |
| 12 | static 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 | |
| 31 | static void cli_cat(const char *fname) { |
| 32 | char path[MG_PATH_MAX]; |