diff options
author | Leo C | 2018-08-23 08:53:41 +0200 |
---|---|---|
committer | Leo C | 2018-08-23 08:53:41 +0200 |
commit | 6bc0153d1a35ff1ea1bc1b10b9dfa119d1a04dc7 (patch) | |
tree | f64d47401dcb9320811720e0c591650d5d524981 /avr/cmd_fat.c | |
parent | b01142c8b93edb04463006a6d127e43788147882 (diff) | |
download | z180-stamp-6bc0153d1a35ff1ea1bc1b10b9dfa119d1a04dc7.zip |
pwd/cd
Diffstat (limited to 'avr/cmd_fat.c')
-rw-r--r-- | avr/cmd_fat.c | 14 |
1 files changed, 8 insertions, 6 deletions
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; |