diff --git a/src/fileCLI/fileCLI.cpp b/src/fileCLI/fileCLI.cpp index 6b35f009..df7001e7 100644 --- a/src/fileCLI/fileCLI.cpp +++ b/src/fileCLI/fileCLI.cpp @@ -25,6 +25,7 @@ FileCLI::menu_t FileCLI::fsExplorerMenu[] = {'d', &FileCLI::dumpBase85}, {'h', &FileCLI::dumpHex}, {'l', &FileCLI::list_dir}, + {'m', &FileCLI::mkdir}, {'p', &FileCLI::print_dir}, {'q', &FileCLI::exit}, {'r', &FileCLI::deleteFile}, @@ -37,6 +38,7 @@ void FileCLI::print_help(void) SF_OSAL_printf("%c\t%s" __NL__, 'p', "Print Working Directory"); SF_OSAL_printf("%c\t%s" __NL__, 'l', "List Directory"); SF_OSAL_printf("%c\t%s" __NL__, 'c', "Change Directory"); + SF_OSAL_printf("%c\t%s" __NL__, 'm', "Make Directory"); SF_OSAL_printf("%c\t%s" __NL__, 'r', "Remove File/Directory"); SF_OSAL_printf("%c\t%s" __NL__, 'd', "Base85/64 Dump"); SF_OSAL_printf("%c\t%s" __NL__, 'h', "Hex Dump"); @@ -332,7 +334,7 @@ void hexdump(int fp, size_t file_len) } SF_OSAL_printf(" |%s|" __NL__, (const char*)byte_buffer); } - SF_OSAL_printf("0x%08x" __NL__, file_idx); + SF_OSAL_printf("%08x" __NL__, file_idx); } @@ -483,3 +485,16 @@ void FileCLI::dumpBase85(void) close(fp); } + +void FileCLI::mkdir(void) +{ + char input_buffer[FILE_CLI_INPUT_BUFFER_LEN]; + int result; + + SF_OSAL_printf("Enter new directory name: "); + getline(input_buffer, FILE_CLI_INPUT_BUFFER_LEN); + + result = ::mkdir(input_buffer, 0777); + SF_OSAL_printf("Returned %d" __NL__, result); + return; +} diff --git a/src/fileCLI/fileCLI.hpp b/src/fileCLI/fileCLI.hpp index df9fc554..2603d1be 100644 --- a/src/fileCLI/fileCLI.hpp +++ b/src/fileCLI/fileCLI.hpp @@ -83,6 +83,12 @@ class FileCLI{ */ void print_help(void); + /** + * @brief Creates a new directory + * + */ + void mkdir(void); + int run = 1; DIR* dir_stack[FILE_CLI_MAX_DIR_DEPTH]; char path_stack[FILE_CLI_MAX_DIR_DEPTH][NAME_MAX];