about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-10-22 20:59:48 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-10-22 21:00:26 -0700
commit9792ac1e0979bee4ecccf2d65855a54ac372b57b (patch)
treecc1ec47f159be92bf45abd51355d5a70b5bb6a94 /src
parent1445cbc5b190a93e1d2bfc468ef5958a0ad3d1d5 (diff)
downloadteliva-9792ac1e0979bee4ecccf2d65855a54ac372b57b.tar.gz
drop support for '-' filename
lua.c now no longer refers to stdin/stdout/stderr.
Diffstat (limited to 'src')
-rw-r--r--src/lua.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/lua.c b/src/lua.c
index 7ab07d1..a6bbb2b 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -49,7 +49,6 @@ static void print_usage (void) {
   "  -i       enter interactive mode after executing " LUA_QL("script") "\n"
   "  -v       show version information\n"
   "  --       stop handling options\n"
-  "  -        execute stdin and stop handling options\n"
   ,
   progname);
   refresh();
@@ -200,7 +199,7 @@ static int loadline (lua_State *L) {
   if (!pushline(L, 1))
     return -1;  /* no input */
   for (;;) {  /* repeat until gets a complete line */
-    status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_strlen(L, 1), "=stdin");
+    status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_strlen(L, 1), "=keyboard");
     if (!incomplete(L, status)) break;  /* cannot try to add lines? */
     if (!pushline(L, 0))  /* no more input? */
       return -1;
@@ -230,7 +229,6 @@ static void dotty (lua_State *L) {
     }
   }
   lua_settop(L, 0);  /* clear stack */
-  fputs("\n", stdout);
   refresh();
   progname = oldprogname;
 }
@@ -242,8 +240,6 @@ static int handle_script (lua_State *L, char **argv, int n) {
   int narg = getargs(L, argv, n);  /* collect arguments */
   lua_setglobal(L, "arg");
   fname = argv[n];
-  if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0) 
-    fname = NULL;  /* stdin */
   status = luaL_loadfile(L, fname);
   lua_insert(L, -(narg+1));
   if (status == 0)
@@ -365,11 +361,8 @@ static int pmain (lua_State *L) {
   if (has_i)
     dotty(L);
   else if (script == 0 && !has_e && !has_v) {
-    if (lua_stdin_is_tty()) {
-      print_version();
-      dotty(L);
-    }
-    else dofile(L, NULL);  /* executes stdin as a file */
+    print_version();
+    dotty(L);
   }
   return 0;
 }