]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - avr/cmd_fat.c
Find (top level) subcommands without recursion.
[z180-stamp.git] / avr / cmd_fat.c
index 9750c38c5c09148f99c6e3bbfbb7a3efb6aa6362..0c1d0e73aebb0109feec7194bdbe43909711f9d5 100644 (file)
@@ -105,9 +105,10 @@ static void swirl(void)
        static uint32_t tstamp;
 
        if (get_timer(0) > tstamp) {
-               printf_P(PSTR("\b%c"), swirlchar[cnt]);
-               cnt = (cnt+1) % ARRAY_SIZE(swirlchar);
                tstamp = get_timer(0) + 250;
+               putchar('\b');
+               cnt = (cnt+1) & 3;
+               putchar(swirlchar[cnt]);
        }
 }
 
@@ -368,7 +369,7 @@ command_ret_t do_stat(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag UNUSED, int arg
                                fs->n_rootdir, fs->fsize, fs->n_fatent - 2,
                                fs->fatbase, fs->dirbase, fs->database);
 
-#if _USE_LABEL
+#if FF_USE_LABEL
                DWORD serial;
                res = f_getlabel(path, buf, &serial);
                if (!res) {
@@ -379,14 +380,15 @@ command_ret_t do_stat(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag UNUSED, int arg
                }
 #endif
                if (!res) {
-                       my_puts_P(PSTR("\nCounting...  "));
                        statp.AccSize = statp.AccFiles = statp.AccDirs = 0;
                        strcpy(buf, path);
 
+                       my_puts_P(PSTR("\nCounting...  "));
                        res = scan_files(buf, &statp);
+                       putchar('\r');
                }
                if (!res) {
-                       printf_P(PSTR("\r%u files, %lu bytes.\n%u folders.\n"
+                       printf_P(PSTR("%u files, %lu bytes.\n%u folders.\n"
                                                 "%lu KB total disk space.\n%lu KB available.\n"),
                                        statp.AccFiles, statp.AccSize, statp.AccDirs,
                                        (fs->n_fatent - 2) * (fs->csize / 2), nfreeclst * (fs->csize / 2)
@@ -532,17 +534,17 @@ CMD_TBL_ITEM(
        "dev"
 ),
 CMD_TBL_ITEM(
-       pwd,    2,      CTBL_RPT,       do_pwd,
+       pwd,    2,      CTBL_RPT|CTBL_SUBCMDAUTO,       do_pwd,
        "Print name of current/working directory",
        ""
 ),
 CMD_TBL_ITEM(
-       cd,             2,      0,                      do_cd,
+       cd,             2,      0|CTBL_SUBCMDAUTO,                      do_cd,
        "Change the current/working directory.",
        "path"
 ),
 CMD_TBL_ITEM(
-       ls,             2,      CTBL_RPT,       do_ls,
+       ls,             2,      CTBL_RPT|CTBL_SUBCMDAUTO,       do_ls,
        "Directory listing",
        "path"
 ),
@@ -576,7 +578,7 @@ CMD_TBL_ITEM(
 
 /* This does not use the CMD_TBL_ITEM macro as ? can't be used in symbol names */
        {FSTR("?"),   CONFIG_SYS_MAXARGS, 1, do_help,
-        FSTR("Alias for 'help'"),
+        NULL,
 #ifdef  CONFIG_SYS_LONGHELP
        FSTR(""),
 #endif /* CONFIG_SYS_LONGHELP */