Skip to content

Commit 95f7287

Browse files
wdfk-progRbb666
authored andcommitted
fix:[dfs]ls在文件名太长时打印出来的文件名与大小连接在一起,无法区分
1 parent d39a439 commit 95f7287

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

components/dfs/dfs_v1/src/dfs_file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,11 +830,11 @@ void ls(const char *pathname)
830830
rt_kprintf("%-20s", dirent.d_name);
831831
if (S_ISDIR(stat.st_mode))
832832
{
833-
rt_kprintf("%-25s\n", "<DIR>");
833+
rt_kprintf(" %-25s\n", "<DIR>");
834834
}
835835
else
836836
{
837-
rt_kprintf("%-25lu\n", (unsigned long)stat.st_size);
837+
rt_kprintf(" %-25lu\n", (unsigned long)stat.st_size);
838838
}
839839
}
840840
else

components/dfs/dfs_v2/src/dfs_file.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2597,7 +2597,7 @@ void ls(const char *pathname)
25972597
if (S_ISDIR(stat.st_mode))
25982598
{
25992599
rt_kprintf(_COLOR_BLUE "%-20s" _COLOR_NORMAL, dirent.d_name);
2600-
rt_kprintf("%-25s\n", "<DIR>");
2600+
rt_kprintf(" %-25s\n", "<DIR>");
26012601
}
26022602
else if (S_ISLNK(stat.st_mode))
26032603
{
@@ -2655,17 +2655,17 @@ void ls(const char *pathname)
26552655
else if (stat.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))
26562656
{
26572657
rt_kprintf(_COLOR_GREEN "%-20s" _COLOR_NORMAL, dirent.d_name);
2658-
rt_kprintf("%-25lu\n", (unsigned long)stat.st_size);
2658+
rt_kprintf(" %-25lu\n", (unsigned long)stat.st_size);
26592659
}
26602660
else if (S_ISCHR(stat.st_mode))
26612661
{
26622662
rt_kprintf(_COLOR_YELLOW "%-20s" _COLOR_NORMAL, dirent.d_name);
2663-
rt_kprintf("%-25s\n", "<CHR>");
2663+
rt_kprintf(" %-25s\n", "<CHR>");
26642664
}
26652665
else
26662666
{
26672667
rt_kprintf("%-20s", dirent.d_name);
2668-
rt_kprintf("%-25lu\n", (unsigned long)stat.st_size);
2668+
rt_kprintf(" %-25lu\n", (unsigned long)stat.st_size);
26692669
}
26702670
}
26712671
else

0 commit comments

Comments
 (0)