Github User Fetcher 1.0.0
C Application with Server and GUI
|
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
#include <fcntl.h>
#include <sys/types.h>
#include <utime.h>
#include <sys/param.h>
#include <limits.h>
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#include "lfs.h"
Go to the source code of this file.
Data Structures | |
struct | dir_data |
struct | lfs_Lock |
struct | _stat_members |
Macros | |
#define | _FILE_OFFSET_BITS 64 /* Linux, Solaris and HP-UX */ |
#define | _LARGEFILE64_SOURCE |
#define | LFS_MAXPATHLEN _POSIX_PATH_MAX |
#define | LFS_VERSION "1.8.0" |
#define | LFS_LIBNAME "lfs" |
#define | new_lib(L, l) (lua_newtable(L), luaL_register(L, NULL, l)) |
#define | DIR_METATABLE "directory metatable" |
#define | LOCK_METATABLE "lock metatable" |
#define | _O_TEXT 0 |
#define | _O_BINARY 0 |
#define | lfs_setmode(file, m) ((void)file, (void)m, 0) |
#define | STAT_STRUCT struct stat |
#define | STAT_FUNC stat |
#define | LSTAT_FUNC lstat |
#define | lfs_mkdir(path) |
Typedefs | |
typedef struct dir_data | dir_data |
typedef struct lfs_Lock | lfs_Lock |
typedef void(* | _push_function) (lua_State *L, STAT_STRUCT *info) |
Functions | |
static int | pusherror (lua_State *L, const char *info) |
static int | pushresult (lua_State *L, int res, const char *info) |
static int | change_dir (lua_State *L) |
static int | get_dir (lua_State *L) |
static FILE * | check_file (lua_State *L, int idx, const char *funcname) |
static int | _file_lock (lua_State *L, FILE *fh, const char *mode, const long start, long len, const char *funcname) |
static int | lfs_lock_dir (lua_State *L) |
static int | lfs_unlock_dir (lua_State *L) |
static int | lfs_g_setmode (lua_State *L, FILE *f, int arg) |
static int | lfs_f_setmode (lua_State *L) |
static int | file_lock (lua_State *L) |
static int | file_unlock (lua_State *L) |
static int | make_link (lua_State *L) |
static int | make_dir (lua_State *L) |
static int | remove_dir (lua_State *L) |
static int | dir_iter (lua_State *L) |
static int | dir_close (lua_State *L) |
static int | dir_iter_factory (lua_State *L) |
static int | dir_create_meta (lua_State *L) |
static int | lock_create_meta (lua_State *L) |
static const char * | mode2string (mode_t mode) |
static int | file_utime (lua_State *L) |
static void | push_st_mode (lua_State *L, STAT_STRUCT *info) |
static void | push_st_dev (lua_State *L, STAT_STRUCT *info) |
static void | push_st_ino (lua_State *L, STAT_STRUCT *info) |
static void | push_st_nlink (lua_State *L, STAT_STRUCT *info) |
static void | push_st_uid (lua_State *L, STAT_STRUCT *info) |
static void | push_st_gid (lua_State *L, STAT_STRUCT *info) |
static void | push_st_rdev (lua_State *L, STAT_STRUCT *info) |
static void | push_st_atime (lua_State *L, STAT_STRUCT *info) |
static void | push_st_mtime (lua_State *L, STAT_STRUCT *info) |
static void | push_st_ctime (lua_State *L, STAT_STRUCT *info) |
static void | push_st_size (lua_State *L, STAT_STRUCT *info) |
static void | push_st_blocks (lua_State *L, STAT_STRUCT *info) |
static void | push_st_blksize (lua_State *L, STAT_STRUCT *info) |
static const char * | perm2string (mode_t mode) |
static void | push_st_perm (lua_State *L, STAT_STRUCT *info) |
static int | _file_info_ (lua_State *L, int(*st)(const char *, STAT_STRUCT *)) |
static int | file_info (lua_State *L) |
static int | push_link_target (lua_State *L) |
static int | link_info (lua_State *L) |
static void | set_info (lua_State *L) |
LFS_EXPORT int | luaopen_lfs (lua_State *L) |
Variables | |
struct _stat_members | members [] |
static const struct luaL_Reg | fslib [] |
#define _O_BINARY 0 |
Definition at line 167 of file lfs.c.
Referenced by lfs_g_setmode().
#define _O_TEXT 0 |
Definition at line 166 of file lfs.c.
Referenced by lfs_g_setmode().
#define DIR_METATABLE "directory metatable" |
Definition at line 112 of file lfs.c.
Referenced by dir_create_meta(), dir_iter(), and dir_iter_factory().
#define LFS_LIBNAME "lfs" |
Definition at line 91 of file lfs.c.
Referenced by luaopen_lfs().
#define LFS_MAXPATHLEN _POSIX_PATH_MAX |
#define lfs_mkdir | ( | path | ) |
Definition at line 178 of file lfs.c.
Referenced by make_dir().
#define lfs_setmode | ( | file, | |
m ) ((void)file, (void)m, 0) |
Definition at line 168 of file lfs.c.
Referenced by lfs_g_setmode().
#define LFS_VERSION "1.8.0" |
Definition at line 90 of file lfs.c.
Referenced by set_info().
#define LOCK_METATABLE "lock metatable" |
Definition at line 123 of file lfs.c.
Referenced by lfs_lock_dir(), lfs_unlock_dir(), and lock_create_meta().
#define LSTAT_FUNC lstat |
Definition at line 171 of file lfs.c.
Referenced by link_info().
#define new_lib | ( | L, | |
l ) (lua_newtable(L), luaL_register(L, NULL, l)) |
Definition at line 104 of file lfs.c.
Referenced by luaopen_lfs().
#define STAT_FUNC stat |
Definition at line 170 of file lfs.c.
Referenced by file_info(), and make_link().
#define STAT_STRUCT struct stat |
Definition at line 169 of file lfs.c.
Referenced by _file_info_(), and make_link().
typedef void(* _push_function) (lua_State *L, STAT_STRUCT *info) |
typedef struct dir_data dir_data |
typedef struct lfs_Lock lfs_Lock |
|
static |
Definition at line 1010 of file lfs.c.
References lua_isstring(), lua_istable, lua_newtable, lua_pushfstring(), lua_pushinteger(), lua_pushnil(), lua_pushstring(), lua_rawset(), lua_settop(), lua_tostring, luaL_checkstring, luaL_error(), members, _stat_members::name, name, _stat_members::push, and STAT_STRUCT.
Referenced by file_info(), and link_info().
|
static |
Definition at line 343 of file lfs.c.
References funcname(), and luaL_error().
Referenced by file_lock(), and file_unlock().
|
static |
Definition at line 259 of file lfs.c.
References chdir_error, lua_pushboolean(), lua_pushfstring(), lua_pushnil(), and luaL_checkstring.
|
static |
Definition at line 318 of file lfs.c.
References funcname(), luaL_checkudata(), luaL_error(), and NULL.
Referenced by file_lock(), file_unlock(), and lfs_f_setmode().
|
static |
Definition at line 688 of file lfs.c.
References dir_data::closed, dir_data::dir, and lua_touserdata().
Referenced by dir_create_meta().
|
static |
Definition at line 741 of file lfs.c.
References dir_close(), dir_iter(), DIR_METATABLE, lua_newtable, lua_pushcfunction, lua_setfield(), and luaL_newmetatable().
Referenced by luaopen_lfs().
|
static |
Definition at line 640 of file lfs.c.
References dir_data::closed, dir_data::dir, DIR_METATABLE, lua_pushnil(), lua_pushstring(), luaL_argcheck, luaL_checkudata(), and NULL.
Referenced by dir_create_meta(), and dir_iter_factory().
|
static |
Definition at line 708 of file lfs.c.
References dir_data::closed, dir_data::dir, dir_iter(), DIR_METATABLE, lua_newuserdata, lua_pushcfunction, lua_pushnil(), lua_pushvalue(), lua_setmetatable(), luaL_checkstring, luaL_error(), luaL_getmetatable, and NULL.
|
static |
Definition at line 1054 of file lfs.c.
References _file_info_(), and STAT_FUNC.
|
static |
Definition at line 532 of file lfs.c.
References _file_lock(), check_file(), lua_pushboolean(), lua_pushfstring(), lua_pushnil(), luaL_checkstring, and luaL_optinteger().
|
static |
Definition at line 555 of file lfs.c.
References _file_lock(), check_file(), lua_pushboolean(), lua_pushfstring(), lua_pushnil(), and luaL_optinteger().
|
static |
Definition at line 820 of file lfs.c.
References lua_gettop(), luaL_checkstring, luaL_optinteger(), luaL_optnumber(), NULL, and pushresult().
|
static |
Definition at line 278 of file lfs.c.
References free, LFS_MAXPATHLEN, lua_pushnil(), lua_pushstring(), NULL, pusherror(), and realloc.
|
static |
|
static |
Definition at line 498 of file lfs.c.
References _O_BINARY, _O_TEXT, arg, lfs_setmode, lua_pushboolean(), lua_pushnil(), lua_pushstring(), luaL_checkoption(), NULL, and pusherror().
Referenced by lfs_f_setmode().
|
static |
Definition at line 458 of file lfs.c.
References free, lfs_Lock::ln, LOCK_METATABLE, lua_newuserdata, lua_pushnil(), lua_pushstring(), lua_setmetatable(), luaL_checklstring(), luaL_getmetatable, and malloc.
|
static |
Definition at line 486 of file lfs.c.
References free, lfs_Lock::ln, LOCK_METATABLE, luaL_checkudata(), and NULL.
Referenced by lock_create_meta().
|
static |
Definition at line 1121 of file lfs.c.
References _file_info_(), LSTAT_FUNC, lua_isstring(), lua_setfield(), lua_tostring, LUA_TTABLE, lua_type(), push_link_target(), and pusherror().
|
static |
Definition at line 768 of file lfs.c.
References lfs_unlock_dir(), LOCK_METATABLE, lua_newtable, lua_pushcfunction, lua_setfield(), and luaL_newmetatable().
Referenced by luaopen_lfs().
LFS_EXPORT int luaopen_lfs | ( | lua_State * | L | ) |
Definition at line 1173 of file lfs.c.
References dir_create_meta(), fslib, LFS_LIBNAME, lock_create_meta(), lua_pushvalue(), lua_setglobal, new_lib, and set_info().
|
static |
Definition at line 619 of file lfs.c.
References lfs_mkdir, luaL_checkstring, NULL, and pushresult().
|
static |
Definition at line 577 of file lfs.c.
References lua_pushnil(), lua_pushstring(), lua_toboolean(), luaL_checkstring, NULL, pushresult(), STAT_FUNC, and STAT_STRUCT.
|
static |
Definition at line 792 of file lfs.c.
Referenced by push_st_mode().
|
static |
Definition at line 946 of file lfs.c.
Referenced by push_st_perm().
|
static |
Definition at line 1066 of file lfs.c.
References free, lua_pushlstring(), luaL_checkstring, NULL, and realloc.
Referenced by link_info().
|
static |
|
static |
Definition at line 911 of file lfs.c.
References lua_pushinteger().
|
static |
Definition at line 905 of file lfs.c.
References lua_pushinteger().
|
static |
Definition at line 892 of file lfs.c.
References lua_pushinteger().
|
static |
Definition at line 844 of file lfs.c.
References lua_pushinteger().
|
static |
Definition at line 868 of file lfs.c.
References lua_pushinteger().
|
static |
Definition at line 850 of file lfs.c.
References lua_pushinteger().
|
static |
|
static |
Definition at line 886 of file lfs.c.
References lua_pushinteger().
|
static |
Definition at line 856 of file lfs.c.
References lua_pushinteger().
|
static |
|
static |
Definition at line 874 of file lfs.c.
References lua_pushinteger().
|
static |
Definition at line 898 of file lfs.c.
References lua_pushinteger().
|
static |
Definition at line 862 of file lfs.c.
References lua_pushinteger().
|
static |
Definition at line 234 of file lfs.c.
References lua_pushfstring(), lua_pushinteger(), lua_pushnil(), lua_pushstring(), and NULL.
Referenced by get_dir(), lfs_g_setmode(), link_info(), and pushresult().
|
static |
Definition at line 245 of file lfs.c.
References lua_pushboolean(), and pusherror().
Referenced by file_utime(), make_dir(), make_link(), and remove_dir().
|
static |
Definition at line 630 of file lfs.c.
References luaL_checkstring, NULL, and pushresult().
|
static |
Definition at line 1142 of file lfs.c.
References LFS_VERSION, lua_pushliteral, and lua_setfield().
Referenced by luaopen_lfs().
|
static |
Definition at line 1156 of file lfs.c.
Referenced by luaopen_lfs().
struct _stat_members members[] |
Definition at line 987 of file lfs.c.
Referenced by _file_info_().