Skip to content

Instantly share code, notes, and snippets.

View odkr's full-sized avatar

Odin Kroeger odkr

View GitHub Profile
@odkr
odkr / path_normalise.c
Last active November 11, 2022 16:38
Remove dots (".") and supernumerary slashes ("/"s) from paths
int
path_normalise(size_t n, const char *const fname, const norm[n])
{
char *lim; /* Limit of normalised filename. */
char *end; /* Current end of normalised filename. */
assert(*fname != '\0');
lim = norm + n - 1U;
end = norm;