/** * @file Mode.h * @author apio (cloudapio.eu) * @brief Visual file permissions parsing and formatting. * * @copyright Copyright (c) 2023, the Luna authors. * */ #pragma once #include namespace os { /** * @brief Create a visual representation of file permissions using the integral representation. * * The output is formatted in the same style as the output of "ls -l". * For example: * An integral mode of S_IFREG | 0644 would result in "-rw-r--r--". * An integral mode of S_IFDIR | 0755 would result in "drwxr-xr-x". * An integral mode of S_IFLNK | 0777 would result in "lrwxrwxrwx". * * @param mode The integral mode. * @param out The buffer to store the formatted file permissions in, as a C-string (minimum 11 bytes, including the * terminating null byte). */ void format_mode(mode_t mode, char out[11]); }