summaryrefslogtreecommitdiff
path: root/src/user/dirinfo
diff options
context:
space:
mode:
authorBenji Dial <benji6283@gmail.com>2021-01-24 12:00:11 -0500
committerBenji Dial <benji6283@gmail.com>2021-01-24 12:00:11 -0500
commitbce944d1498eaa3b6940ee234c863b3548a66b37 (patch)
treeea40c087ab4f0f236aee8d158cf68550f5209f72 /src/user/dirinfo
parentca731aa747214919df7b3dfe3478dbe787ce5b68 (diff)
downloadportland-os-bce944d1498eaa3b6940ee234c863b3548a66b37.tar.gz
graphics!
Diffstat (limited to 'src/user/dirinfo')
-rw-r--r--src/user/dirinfo/dirinfo.c49
1 files changed, 0 insertions, 49 deletions
diff --git a/src/user/dirinfo/dirinfo.c b/src/user/dirinfo/dirinfo.c
deleted file mode 100644
index 21afcc7..0000000
--- a/src/user/dirinfo/dirinfo.c
+++ /dev/null
@@ -1,49 +0,0 @@
-#include <pland/syscall.h>
-#include <knob/format.h>
-#include <knob/file.h>
-#include <knob/user.h>
-
-#define MAX_DIR_ENTRIES 20
-
-void main(const char *arg) {
- uint8_t dn;
- const char *path = remove_prefix(arg, &dn);
-
- tell_user_sz("Directory info for ");
- tell_user_sz(*arg ? arg : "drive root");
- tell_user_sz("\n");
-
- _dir_info_entry_t infos[MAX_DIR_ENTRIES];
- uint8_t count = _enumerate_dir(dn, path, infos, MAX_DIR_ENTRIES);
- tell_user_sz(
- count == MAX_DIR_ENTRIES
- ? "Truncated to 20 entries.\n\n"
- : "\n"
- );
-
- uint32_t total_size = 0;
-
- if (!count)
- tell_user_sz("(none)\n");
-
- for (uint8_t i = 0; i < count; ++i) {
- tell_user_sz(infos[i].name);
- tell_user_sz(": ");
- if (infos[i].is_dir)
- tell_user_sz("dir");
- else {
- char nbuf[11];
- itosz(infos[i].size, nbuf);
- tell_user_sz(nbuf);
- tell_user_sz(" bytes");
- total_size += infos[i].size;
- }
- tell_user_sz("\n");
- }
-
- tell_user_sz("\nTotal size without subdirectories: ");
- char nbuf[11];
- itosz(total_size, nbuf);
- tell_user_sz(nbuf);
- tell_user_sz(" bytes\n");
-} \ No newline at end of file