diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-11-14 04:27:28 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-11-14 04:27:28 +0100 |
commit | 945661b090eb2f4b08a63aec85411b6c8a878afb (patch) | |
tree | 77c5bc4fbbe1674ed523f1934509a94cbff9c0e7 | |
parent | m doc (diff) | |
download | slibc-945661b090eb2f4b08a63aec85411b6c8a878afb.tar.gz slibc-945661b090eb2f4b08a63aec85411b6c8a878afb.tar.bz2 slibc-945661b090eb2f4b08a63aec85411b6c8a878afb.tar.xz |
change prototypes for humanmode and machinemode
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | include/slibc-human.h | 114 |
1 files changed, 68 insertions, 46 deletions
diff --git a/include/slibc-human.h b/include/slibc-human.h index 25e5162..ee55568 100644 --- a/include/slibc-human.h +++ b/include/slibc-human.h @@ -33,56 +33,25 @@ -/** - * Ways to handled unrecognised escapes, - * and other configurations. - */ -enum unescape_mode +enum machinemode_mode { /** - * For any unrecognised character '#', - * '\#' results in an EINVAL-error. + * Return in the format where 0750 + * resolves to 'rwxr-x---'. * - * Cannot be used together with - * `UNESCAPE_VERBATIM` or `UNESCAPE_IGNORE`. + * If used in combination with `MACHINEMODE_MASK`, + * 0750 resolves to 'u=rwx,g=r-x,o=---'. */ - UNESCAPE_EINVAL = 1, + MACHINEMODE_STAT = 1, /** - * For any unrecognised character '#', - * '\#' results in '#'. + * Return in the format where 0750 + * resolves to 'u=rwx,g=rx,o='. * - * Cannot be used together with - * `UNESCAPE_EINVAL` or `UNESCAPE_IGNORE`. - */ - UNESCAPE_VERBATIM = 2, - - /** - * For any unrecognised character '#', - * '\#' results in '\#'. - * - * Cannot be used together with - * `UNESCAPE_EINVAL` or `UNESCAPE_VERBATIM`. + * If used in combination with `MACHINEMODE_STAT`, + * 0750 resolves to 'u=rwx,g=r-x,o=---'. */ - UNESCAPE_IGNORE = 4, - - - /** - * '\&' resolves to the byte 255 (0xFF). - * - * If not used, '\&' is handled as an - * unsupported escape. - */ - UNESCAPE_AMPERSAND = 8, - - /** - * '\0' resolves to the byte sequence - * 192 128 (0xC0 0x80). - * - * If not used, '\0' resolves to a - * 0 byte (termination). - */ - UNESCAPE_MOD_UTF8 = 16, + MACHINEMODE_MASK = 2, }; @@ -134,7 +103,7 @@ enum humansize_mode * `detail` < 0 is allowed, */ HUMANSIZE_ROUND = 32, - } + }; enum machinesize_mode @@ -156,13 +125,66 @@ enum machinesize_mode * included, otherwise 1024-base is used. */ MACHINESIZE_IEC = 2, - } + }; + + +/** + * Ways to handled unrecognised escapes, + * and other configurations. + */ +enum unescape_mode + { + /** + * For any unrecognised character '#', + * '\#' results in an EINVAL-error. + * + * Cannot be used together with + * `UNESCAPE_VERBATIM` or `UNESCAPE_IGNORE`. + */ + UNESCAPE_EINVAL = 1, + + /** + * For any unrecognised character '#', + * '\#' results in '#'. + * + * Cannot be used together with + * `UNESCAPE_EINVAL` or `UNESCAPE_IGNORE`. + */ + UNESCAPE_VERBATIM = 2, + + /** + * For any unrecognised character '#', + * '\#' results in '\#'. + * + * Cannot be used together with + * `UNESCAPE_EINVAL` or `UNESCAPE_VERBATIM`. + */ + UNESCAPE_IGNORE = 4, + + + /** + * '\&' resolves to the byte 255 (0xFF). + * + * If not used, '\&' is handled as an + * unsupported escape. + */ + UNESCAPE_AMPERSAND = 8, + + /** + * '\0' resolves to the byte sequence + * 192 128 (0xC0 0x80). + * + * If not used, '\0' resolves to a + * 0 byte (termination). + */ + UNESCAPE_MOD_UTF8 = 16, + }; -char* humanmode(char* restrict buffer, mode_t mode); +char* humanmode(char* restrict buffer, mode_t perm, enum machinemode_mode mode); -mode_t machinemode(const char* restrict str, mode_t mode, mode_t mask); +int machinemode(mode_t* restrict mode, mode_t* restrict mask, const char* restrict str); char* humansize(char* restrict buffer, size_t size, enum humansize_mode mode, int detail); |