X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/b01142c8b93edb04463006a6d127e43788147882..6bc0153d1a35ff1ea1bc1b10b9dfa119d1a04dc7:/avr/cmd_fat.c diff --git a/avr/cmd_fat.c b/avr/cmd_fat.c index c1d3770..d434cbd 100644 --- a/avr/cmd_fat.c +++ b/avr/cmd_fat.c @@ -135,12 +135,13 @@ command_ret_t do_pwd(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag UNUSED, int argc } res = f_getcwd(buf, BUFFER_SIZE); /* Get current directory path */ + debug_fa("### f_getcwd(): buf: '%s', res: %d\n", buf, res); - if (!res) { + if (res == FR_OK) { puts(buf); } free(buf); - if (res) { + if (res != FR_OK) { put_rc(res); return CMD_RET_FAILURE; } @@ -166,17 +167,18 @@ command_ret_t do_cd(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag UNUSED, int argc, } else arg = argv[1]; - if (arg[1] == ':') + if (strlen(arg) > 1 && arg[1] == ':') { res = f_chdrive(arg); -debug_fa("### f_chdrive(): arg: '%s', res: %d\n", arg, res); - if (res == FR_OK) { + debug_fa("### f_chdrive(): arg: '%s', res: %d\n", arg, res); if (arg[2] == '\0') { arg[0] = '/'; arg[1] = '\0'; } + } + if (res == FR_OK) { res = f_chdir(arg); + debug_fa("### f_chdir(): arg: '%s', res: %d\n", arg, res); } -debug_fa("### f_chdir(): arg: '%s', res: %d\n", arg, res); if (res != FR_OK) { put_rc(res); return CMD_RET_FAILURE;