From 508c7b3b569c7370f4ec54eebb88ceee0354f428 Mon Sep 17 00:00:00 2001 From: tomas Date: Wed, 19 Jan 2005 14:28:58 +0000 Subject: Eliminando funcao lfs.touch() para lancamento da versao 1.0 oficial. --- src/lfs.c | 36 ++++-------------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/lfs.c b/src/lfs.c index de1c6f0..4b4db61 100644 --- a/src/lfs.c +++ b/src/lfs.c @@ -7,10 +7,9 @@ ** lfs.dir (path) ** lfs.mkdir (path) ** lfs.lock (fh, mode) -** lfs.touch (filepath [, atime [, mtime]]) ** lfs.unlock (fh) ** -** $Id: lfs.c,v 1.16 2005/01/18 11:21:58 tuler Exp $ +** $Id: lfs.c,v 1.17 2005/01/19 14:28:58 tomas Exp $ */ #include @@ -23,13 +22,11 @@ #include #include #include -#include #else #include #include #include #include -#include #endif #include "lua.h" @@ -148,7 +145,7 @@ static int _file_lock (lua_State *L, FILE *fh, const char *mode, const long star case 'w': f.l_type = F_WRLCK; break; case 'r': f.l_type = F_RDLCK; break; case 'u': f.l_type = F_UNLCK; break; - default : luaL_error (L, "%s: invalid mode", funcname); + default : return luaL_error (L, "%s: invalid mode", funcname); } f.l_whence = SEEK_SET; f.l_start = (off_t)start; @@ -397,30 +394,6 @@ static const char *mode2string (mode_t mode) { } -/* -** Set access time and modification values for file -*/ -static int file_utime (lua_State *L) { - const char *file = luaL_checkstring (L, 1); - struct utimbuf utb, *buf; - - if (lua_gettop (L) == 1) /* set to current date/time */ - buf = NULL; - else { - utb.actime = (time_t)luaL_optnumber (L, 2, 0); - utb.modtime = (time_t)luaL_optnumber (L, 3, utb.actime); - buf = &utb; - } - if (utime (file, buf)) { - lua_pushnil (L); - lua_pushfstring (L, "%s", strerror (errno)); - return 2; - } - lua_pushboolean (L, 1); - return 1; -} - - /* ** Get file information */ @@ -498,7 +471,7 @@ static int file_info (lua_State *L) { */ static void set_info (lua_State *L) { lua_pushliteral (L, "_COPYRIGHT"); - lua_pushliteral (L, "Copyright (C) 2004 Kepler Project"); + lua_pushliteral (L, "Copyright (C) 2004-2005 Kepler Project"); lua_settable (L, -3); lua_pushliteral (L, "_DESCRIPTION"); lua_pushliteral (L, "LuaFileSystem is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution"); @@ -507,7 +480,7 @@ static void set_info (lua_State *L) { lua_pushliteral (L, "LuaFileSystem"); lua_settable (L, -3); lua_pushliteral (L, "_VERSION"); - lua_pushliteral (L, "1.0b"); + lua_pushliteral (L, "1.0"); lua_settable (L, -3); } @@ -519,7 +492,6 @@ static const struct luaL_reg fslib[] = { {"dir", dir_iter_factory}, {"lock", file_lock}, {"mkdir", make_dir}, - {"touch", file_utime}, {"unlock", file_unlock}, {NULL, NULL}, }; -- cgit v1.2.3-55-g6feb