From eadbb9cff4378fa64f81d6944a26c3a216757ad6 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 23 Apr 1996 09:43:07 -0300 Subject: [PATCH] "stat" is not ansi. --- iolib.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/iolib.c b/iolib.c index e5b175bf..cdbe3447 100644 --- a/iolib.c +++ b/iolib.c @@ -3,12 +3,11 @@ ** Input/output library to LUA */ -char *rcs_iolib="$Id: iolib.c,v 1.40 1996/03/19 22:28:37 roberto Exp roberto $"; +char *rcs_iolib="$Id: iolib.c,v 1.41 1996/04/22 19:28:37 roberto Exp roberto $"; #include #include #include -#include #include #include #include @@ -125,15 +124,12 @@ static void io_writeto (void) ** LUA interface: ** status = appendto (filename) ** where: -** status = 2 -> success (already exist) -** status = 1 -> success (new file) +** status = 1 -> success ** status = nil -> error */ static void io_appendto (void) { char *s = lua_check_string(1, "appendto"); - struct stat st; - int r = (stat(s, &st) == -1) ? 1 : 2; FILE *fp = fopen (s, "a"); if (fp == NULL) lua_pushnil(); @@ -141,7 +137,7 @@ static void io_appendto (void) { if (out != stdout) fclose (out); out = fp; - lua_pushnumber (r); + lua_pushnumber(1); } }