apio
bc07cc94cb
All checks were successful
continuous-integration/drone/push Build is passing
Also, add copyright information to individual files. This is going to be a hassle to do for EVERY file.
31 lines
906 B
C++
31 lines
906 B
C++
/**
|
|
* @file Mode.h
|
|
* @author apio (cloudapio.eu)
|
|
* @brief Visual file permissions parsing and formatting.
|
|
*
|
|
* @copyright Copyright (c) 2023, the Luna authors.
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <sys/types.h>
|
|
|
|
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]);
|
|
}
|