Eliminando funcao lfs.touch() para lancamento da versao 1.0 oficial.

This commit is contained in:
tomas
2005-01-19 14:28:58 +00:00
parent e99b7844bb
commit 508c7b3b56
2 changed files with 6 additions and 34 deletions

View File

@@ -1,10 +1,10 @@
# $Id: Makefile,v 1.11 2005/01/18 10:48:02 tomas Exp $
# $Id: Makefile,v 1.12 2005/01/19 14:28:58 tomas Exp $
T= lfs
include ./config
V= 1.1b
V= 1.0
DIST_DIR= luafilesystem-$V
TAR_FILE= $(DIST_DIR).tar.gz
ZIP_FILE= $(DIST_DIR).zip

View File

@@ -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 <errno.h>
@@ -23,13 +22,11 @@
#include <direct.h>
#include <io.h>
#include <sys/locking.h>
#include <sys/utime.h>
#else
#include <unistd.h>
#include <dirent.h>
#include <fcntl.h>
#include <sys/types.h>
#include <utime.h>
#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},
};