diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lfs.c | 15 |
1 files changed, 3 insertions, 12 deletions
| @@ -100,8 +100,7 @@ typedef struct dir_data { | |||
| 100 | #else | 100 | #else |
| 101 | #define _O_TEXT 0 | 101 | #define _O_TEXT 0 |
| 102 | #define _O_BINARY 0 | 102 | #define _O_BINARY 0 |
| 103 | #define lfs_setmode(L,file,m) ((void)((void)file,m), \ | 103 | #define lfs_setmode(L,file,m) 0 |
| 104 | luaL_error(L, LUA_QL("setmode") " not supported on this platform"), -1) | ||
| 105 | #define STAT_STRUCT struct stat | 104 | #define STAT_STRUCT struct stat |
| 106 | #define STAT_FUNC stat | 105 | #define STAT_FUNC stat |
| 107 | #define LSTAT_FUNC lstat | 106 | #define LSTAT_FUNC lstat |
| @@ -281,10 +280,9 @@ static int lfs_unlock_dir(lua_State *L) { | |||
| 281 | } | 280 | } |
| 282 | #endif | 281 | #endif |
| 283 | 282 | ||
| 284 | #ifdef _WIN32 | ||
| 285 | static int lfs_g_setmode (lua_State *L, FILE *f, int arg) { | 283 | static int lfs_g_setmode (lua_State *L, FILE *f, int arg) { |
| 286 | static const int mode[] = {_O_TEXT, _O_BINARY}; | 284 | static const int mode[] = {_O_BINARY, _O_TEXT}; |
| 287 | static const char *const modenames[] = {"text", "binary", NULL}; | 285 | static const char *const modenames[] = {"binary", "text", NULL}; |
| 288 | int op = luaL_checkoption(L, arg, NULL, modenames); | 286 | int op = luaL_checkoption(L, arg, NULL, modenames); |
| 289 | int res = lfs_setmode(L, f, mode[op]); | 287 | int res = lfs_setmode(L, f, mode[op]); |
| 290 | if (res != -1) { | 288 | if (res != -1) { |
| @@ -307,13 +305,6 @@ static int lfs_g_setmode (lua_State *L, FILE *f, int arg) { | |||
| 307 | return 3; | 305 | return 3; |
| 308 | } | 306 | } |
| 309 | } | 307 | } |
| 310 | #else | ||
| 311 | static int lfs_g_setmode (lua_State *L, FILE *f, int arg) { | ||
| 312 | lua_pushboolean(L, 0); | ||
| 313 | lua_pushliteral(L, "setmode not supported on this platform"); | ||
| 314 | return 2; | ||
| 315 | } | ||
| 316 | #endif | ||
| 317 | 308 | ||
| 318 | static int lfs_f_setmode(lua_State *L) { | 309 | static int lfs_f_setmode(lua_State *L) { |
| 319 | return lfs_g_setmode(L, check_file(L, 1, "setmode"), 2); | 310 | return lfs_g_setmode(L, check_file(L, 1, "setmode"), 2); |
