diff options
author | Benji Dial <benji6283@gmail.com> | 2021-02-17 17:59:05 -0500 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2021-02-17 17:59:05 -0500 |
commit | 79973061600a2af480c4f8ec1e1e71846985b653 (patch) | |
tree | f63a54b5116bd19e2f82b14261c65584d80407f5 /src/user/knob/block.c | |
parent | 302666775a00b1df398ca06b97aa481a6626045d (diff) | |
download | portland-os-79973061600a2af480c4f8ec1e1e71846985b653.tar.gz |
dirlist program, making fat refuse to list file as directory
Diffstat (limited to 'src/user/knob/block.c')
-rw-r--r-- | src/user/knob/block.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/user/knob/block.c b/src/user/knob/block.c index 90f79e3..1720f94 100644 --- a/src/user/knob/block.c +++ b/src/user/knob/block.c @@ -57,4 +57,20 @@ uint32_t strlen(const char *str) { ++str; } return len; +} + +void str_trunc_fill(char *str, uint32_t len) { + const uint8_t orig_len = strlen(str); + if (orig_len > len) { + str[len - 4] = ' '; + str[len - 3] = '.'; + str[len - 2] = '.'; + str[len - 1] = '.'; + str[len] = '\0'; + } + else if (orig_len != len) { + for (uint8_t j = orig_len; j < len; ++j) + str[j] = ' '; + str[len] = '\0'; + } }
\ No newline at end of file |