diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-11-13 12:52:31 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-11-13 12:52:31 +0100 |
commit | 66dbf9a6cf3d6d390ce17ed6d7f8789811a160ef (patch) | |
tree | 464f1bc39cb98591569caa85d79755958ef7c74e /include | |
parent | doc (diff) | |
download | slibc-66dbf9a6cf3d6d390ce17ed6d7f8789811a160ef.tar.gz slibc-66dbf9a6cf3d6d390ce17ed6d7f8789811a160ef.tar.bz2 slibc-66dbf9a6cf3d6d390ce17ed6d7f8789811a160ef.tar.xz |
add cleanname
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/libgen.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/libgen.h b/include/libgen.h index 653b1c0..d417739 100644 --- a/include/libgen.h +++ b/include/libgen.h @@ -55,6 +55,27 @@ char* __xpg_basename(char*) char* dirname(char*) __GCC_ONLY(__attribute__((__warn_unused_result__))); +#if defined(__SLIBC_SOURCE) +/** + * Removes all trailing slashes (that is not the first character + * in the filename,) all '.' directory components, and when possible + * using only lexical analysis, resolves '..' directory components. + * + * '..' directory components that should resolve up beyond '/', + * are removed. Note that this can in fact mean that the resulting + * path is not the same file if the processes is `chroot`:ed. + * + * This is a slibc extension. + * + * @param filename The filename, may be edited by this function. + * @return The dirname, it is either `filename` or, + * if `filename` is `NULL` or does no contain a + * non-trailing slash, a statically allocationed + * string, so it must not freed or edited. + */ +char* cleanname(char*) +#endif + #endif |