Minor fix in initrd ls

This commit is contained in:
xamidev
2024-09-23 15:30:20 +02:00
parent 8bac95890a
commit 7071b4788b
2 changed files with 16 additions and 4 deletions

View File

@@ -1,8 +1,8 @@
![BlankOSshowcase](https://github.com/user-attachments/assets/63aae4ae-1633-4981-875d-8e2627ccc25c) ![BlankOSshowcase](https://github.com/user-attachments/assets/63aae4ae-1633-4981-875d-8e2627ccc25c)
> [!WARNING] > [!WARNING]
> The project is currently paused, after months of work around the subject. I've had enough for now, and I'll surely come back in some time to implement the more advanced stuff I had planned. For now, enjoy the latest alpha version. > This is free and unencumbered software released into the public domain. Many things might be (are) broken.
> This is a hobbyist operating system, and it comes without any warranty whatsoever! See the license for more info. Feedback and contributions are highly appreciated. > The project is a hobbyist operating system, and it comes without any warranty whatsoever! See the license for more info. Feedback and contributions are highly appreciated.
# BlankOS # BlankOS

View File

@@ -80,10 +80,22 @@ void ls_initrd(uint8_t* initrd, int verbose)
{ {
if (!verbose) if (!verbose)
{ {
printf("%s\n", header->filename); if (header->typeflag == '5')
{
colorprintf(cyan, black, "%s\n", header->filename);
} else { } else {
printf("%s\n", header->filename);
}
} else {
if (header->typeflag == '5')
{
printf("%7d\t%c\t", (int)header->size, header->typeflag);
colorprintf(cyan, black, " %s\n", header->filename);
} else {
printf("%7d\t%c\t %s\n", (int)header->size, header->typeflag, header->filename); printf("%7d\t%c\t %s\n", (int)header->size, header->typeflag, header->filename);
} }
}
uint32_t size = tar_parse_size(header->size); uint32_t size = tar_parse_size(header->size);
uint32_t next_file_offset = ((size+TAR_BLOCK_SIZE-1)/TAR_BLOCK_SIZE)*TAR_BLOCK_SIZE; uint32_t next_file_offset = ((size+TAR_BLOCK_SIZE-1)/TAR_BLOCK_SIZE)*TAR_BLOCK_SIZE;