# --- T2-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # T2 SDE: package/.../lua-posix/t2-realpath.patch # Copyright (C) 2008 - 2014 The T2 SDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- T2-COPYRIGHT-NOTE-END --- --- posix.orig/lposix.c 2008-02-09 22:05:17.000000000 +0100 +++ posix/lposix.c 2008-02-09 22:11:53.000000000 +0100 @@ -305,6 +305,15 @@ return 1; } +static int Prealpath(lua_State *L) /** realpath(path) */ +{ + char buf[PATH_MAX], *rpath; + const char *path = luaL_checkstring(L, 1); + rpath = realpath(path, buf); + if (!rpath) return pusherror(L, path); + lua_pushstring(L, buf); + return 1; +} static int Paccess(lua_State *L) /** access(path,[mode]) */ { @@ -805,6 +814,7 @@ {"pathconf", Ppathconf}, {"putenv", Pputenv}, {"readlink", Preadlink}, + {"realpath", Prealpath}, {"rmdir", Prmdir}, {"setgid", Psetgid}, {"setuid", Psetuid},