Browse Source

small corrections.

Roberto Ierusalimschy 29 years ago
parent
commit
40306b10db
2 changed files with 6 additions and 28 deletions
  1. 4 26
      iolib.c
  2. 2 2
      lua.c

+ 4 - 26
iolib.c

@@ -3,7 +3,7 @@
 ** Input/output library to LUA
 ** Input/output library to LUA
 */
 */
 
 
-char *rcs_iolib="$Id: iolib.c,v 1.36 1996/02/16 13:10:14 roberto Exp roberto $";
+char *rcs_iolib="$Id: iolib.c,v 1.38 1996/03/12 13:14:52 roberto Exp roberto $";
 
 
 #include <stdio.h>
 #include <stdio.h>
 #include <ctype.h>
 #include <ctype.h>
@@ -535,7 +535,7 @@ static void io_debug (void)
   {
   {
     char buffer[250];
     char buffer[250];
     fprintf(stderr, "lua_debug> ");
     fprintf(stderr, "lua_debug> ");
-    if (gets(buffer) == 0) return;
+    if (fgets(buffer, sizeof(buffer), stdin) == 0) return;
     if (strcmp(buffer, "cont") == 0) return;
     if (strcmp(buffer, "cont") == 0) return;
     lua_dostring(buffer);
     lua_dostring(buffer);
   }
   }
@@ -558,7 +558,7 @@ void lua_printstack (FILE *f)
         fprintf(f, "function %s", name);
         fprintf(f, "function %s", name);
         break;
         break;
       case 'f':
       case 'f':
-        fprintf(f, "fallback %s", name);
+        fprintf(f, "`%s' fallback", name);
         break;
         break;
       default:
       default:
       {
       {
@@ -574,7 +574,7 @@ void lua_printstack (FILE *f)
       }
       }
     }
     }
     if ((currentline = lua_currentline(func)) > 0)
     if ((currentline = lua_currentline(func)) > 0)
-      fprintf(f, "  at line %d", currentline);
+      fprintf(f, " at line %d", currentline);
     fprintf(f, "\n");
     fprintf(f, "\n");
   }
   }
 }
 }
@@ -611,25 +611,3 @@ void iolib_open (void)
  lua_setfallback("error", errorfb);
  lua_setfallback("error", errorfb);
 }
 }
 
 
-/*
-** Return user formatted time stamp
-*
-static void sys_localtime (void)
-{
- time_t t;
- struct tm *tm;
- lua_Object o = lua_getparam(1);
-
- time(&t); tm = localtime(&t);
- if (lua_isstring(o))
- {
-  char b[BUFSIZ];
-  if (strftime(b,sizeof(b),lua_getstring(o),tm)==0)
-   lua_pushstring(ctime(&t));
-  else
-   lua_pushstring(b);
- }
- else
-  lua_pushstring(ctime(&t));
-}
-*/

+ 2 - 2
lua.c

@@ -3,7 +3,7 @@
 ** Linguagem para Usuarios de Aplicacao
 ** Linguagem para Usuarios de Aplicacao
 */
 */
 
 
-char *rcs_lua="$Id: lua.c,v 1.6 1995/10/23 13:54:11 roberto Exp roberto $";
+char *rcs_lua="$Id: lua.c,v 1.7 1995/10/31 17:05:35 roberto Exp roberto $";
 
 
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
@@ -44,7 +44,7 @@ static void manual_input (void)
   if (isatty(fileno(stdin)))
   if (isatty(fileno(stdin)))
   {
   {
    char buffer[250];
    char buffer[250];
-   while (gets(buffer) != 0)
+   while (fgets(buffer, sizeof(buffer), stdin) != 0)
      lua_dostring(buffer);
      lua_dostring(buffer);
   }
   }
   else
   else