return s;
}
-// Return the file extension (including the dot) of a path as a pointer into
-// path. If path has no file extension, the empty string and the end of path is
-// returned.
-const char*
-get_extension(const char* path)
-{
- size_t len = strlen(path);
- for (const char* p = &path[len - 1]; p >= path; --p) {
- if (*p == '.') {
- return p;
- }
- if (*p == '/') {
- break;
- }
- }
- return &path[len];
-}
-
// Format a size as a human-readable string. Caller frees.
char*
format_human_readable_size(uint64_t size)
void x_setenv(const char* name, const char* value);
void x_unsetenv(const char* name);
char* x_dirname(const char* path);
-const char* get_extension(const char* path);
char* format_human_readable_size(uint64_t size);
char* format_parsable_size_with_suffix(uint64_t size);
bool parse_size_with_suffix(const char* str, uint64_t* size);