#include #include #include #include #include void Root(char * filename) { char path[PATH_MAX], * terminator; if (!realpath(filename, path)) { return; } if ((terminator = strrchr(path, '/'))) { *terminator = '\0'; chdir(path); } }