diff --git a/lua.c b/lua.c index cc698d0b..351d538f 100644 --- a/lua.c +++ b/lua.c @@ -1,5 +1,5 @@ /* -** $Id: lua.c,v 1.29 1999/12/20 13:03:20 roberto Exp roberto $ +** $Id: lua.c,v 1.30 1999/12/21 17:34:23 roberto Exp roberto $ ** Lua stand-alone interpreter ** See Copyright Notice in lua.h */ @@ -67,16 +67,22 @@ static int ldo (int (*f)(lua_State *L, const char *), const char *name) { static void print_message (void) { fprintf(stderr, -"Lua: command line options:\n" -" -v print version information\n" -" -d turn debug on\n" -" -e stat dostring `stat'\n" -" -q interactive mode without prompt\n" -" -i interactive mode with prompt\n" -" - execute stdin as a file\n" -" -f name dofile `name' with following arguments in table `arg'\n" -" a=b set global `a' with string `b'\n" -" name dofile `name'\n\n"); + "usage: lua [options]. Available options are:\n" + " - execute stdin as a file\n" + " -d turn debug on\n" + " -e stat execute string `stat'\n" + " -f name execute file `name' with remaining arguments in table `arg'\n" + " -i enter interactive mode with prompt\n" + " -q enter interactive mode without prompt\n" + " -v print version information\n" + " a=b set global `a' to string `b'\n" + " name execute file `name'\n" +); +} + + +static void print_version (void) { + printf("%s %s\n", LUA_VERSION, LUA_COPYRIGHT); } @@ -166,7 +172,7 @@ int main (int argc, char *argv[]) { lua_userinit(); if (argc < 2) { /* no arguments? */ if (isatty(0)) { - printf("%s %s\n", LUA_VERSION, LUA_COPYRIGHT); + print_version(); manual_input(1); } else @@ -186,10 +192,13 @@ int main (int argc, char *argv[]) { break; case 'd': lua_setdebug(lua_state, 1); + if (i==argc-1) { /* last argument? */ + print_version(); + manual_input(1); + } break; case 'v': - printf("%s %s\n(written by %s)\n", - LUA_VERSION, LUA_COPYRIGHT, LUA_AUTHORS); + print_version(); break; case 'e': i++; @@ -210,9 +219,7 @@ int main (int argc, char *argv[]) { } getargs(argc-i, argv+i); /* collect following arguments */ file_input(argv, i); - return 0; /* stop running arguments */ - case '-': - i = argc; /* end loop */ + i = argc; /* stop running arguments */ break; default: print_message(); diff --git a/lua.h b/lua.h index f57b0e3d..3f72b5e3 100644 --- a/lua.h +++ b/lua.h @@ -1,5 +1,5 @@ /* -** $Id: lua.h,v 1.42 1999/12/02 16:24:45 roberto Exp roberto $ +** $Id: lua.h,v 1.43 1999/12/06 11:41:28 roberto Exp roberto $ ** Lua - An Extensible Extension Language ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil ** e-mail: lua@tecgraf.puc-rio.br @@ -12,7 +12,7 @@ #define lua_h #define LUA_VERSION "Lua 3.x" -#define LUA_COPYRIGHT "Copyright (C) 1994-1999 TeCGraf, PUC-Rio" +#define LUA_COPYRIGHT "Copyright (C) 1994-2000 TeCGraf, PUC-Rio" #define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo" @@ -221,7 +221,7 @@ extern lua_State *lua_state; /****************************************************************************** -* Copyright (c) 1994-1999 TeCGraf, PUC-Rio. All rights reserved. +* Copyright (C) 1994-2000 TeCGraf, PUC-Rio. All rights reserved. * * Permission is hereby granted, without written agreement and without license * or royalty fees, to use, copy, modify, and distribute this software and its