summaryrefslogtreecommitdiff
path: root/avr/cmd_fat.c
diff options
context:
space:
mode:
authorLeo C2018-07-31 07:58:00 +0200
committerLeo C2018-07-31 07:58:00 +0200
commit66f6a44eb2e13ca5a293bd5c05189279e2cfbe18 (patch)
tree9444ffa72e20295660a8c53e699e69d5da4e3afc /avr/cmd_fat.c
parentc646b5a9585d4c83df048be9198b0662a5881dcb (diff)
downloadz180-stamp-66f6a44eb2e13ca5a293bd5c05189279e2cfbe18.zip
pwd hack
Diffstat (limited to 'avr/cmd_fat.c')
-rw-r--r--avr/cmd_fat.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/avr/cmd_fat.c b/avr/cmd_fat.c
index 29275a1..60102ed 100644
--- a/avr/cmd_fat.c
+++ b/avr/cmd_fat.c
@@ -20,6 +20,13 @@
#include "debug.h"
#include "env.h"
+
+#define DEBUG_FA 0 /* set to 1 to debug */
+
+#define debug_fa(fmt, args...) \
+ debug_cond(DEBUG_FA, fmt, ##args)
+
+
/* TODO: use memory size test function (detect_ramsize() in cmd_loadihex.c) */
/* TODO: detect_ramsize() should be moved to z80-if.c */
#define MAX_MEMORY CONFIG_SYS_RAMSIZE_MAX
@@ -160,18 +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] == ':') {
- char drv[3];
- drv[2] = '\0';
- drv[1] = ':';
- drv[0] = arg[0];
- res = f_chdrive(drv);
- }
- if (!res) {
+ if (arg[1] == ':')
+ res = f_chdrive(arg);
+debug_fa("### f_chdrive(): arg: '%s', res: %d\n", arg, res);
+ if (res == FR_OK) {
+ if (arg[2] == '\0') {
+ arg[0] = '/';
+ arg[1] = '\0';
+ }
res = f_chdir(arg);
}
-
- if (res) {
+debug_fa("### f_chdir(): arg: '%s', res: %d\n", arg, res);
+ if (res != FR_OK) {
put_rc(res);
return CMD_RET_FAILURE;
}