diff options
Diffstat (limited to 'cd-tool.cpp')
| -rw-r--r-- | cd-tool.cpp | 23 | 
1 files changed, 21 insertions, 2 deletions
diff --git a/cd-tool.cpp b/cd-tool.cpp index 2886cc4..bf3d879 100644 --- a/cd-tool.cpp +++ b/cd-tool.cpp @@ -17,7 +17,7 @@   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   */ -/* $Id: cd-tool.cpp,v 1.15 2003-12-04 01:47:37 pixel Exp $ */ +/* $Id: cd-tool.cpp,v 1.16 2003-12-06 04:26:16 pixel Exp $ */  #include <getopt.h>  #include <stdio.h> @@ -29,13 +29,14 @@  #include "Input.h"  #include "Output.h"  #include "Buffer.h" +#include "BLua.h"  #include "cdreader.h"  #include "cdutils.h"  #include "generic.h"  #include "Main.h"  #include "cdabstract.h" -  #include "isobuilder.h" +#include "luacd.h"  int lga = 0;  struct option long_options[] = { @@ -78,6 +79,7 @@ void showhelp(void) {  "   insert-file <file> <path>    - insert the file to <path>\n"  "   insert <file> <addr>         - insert some sectors at <addr>\n"  "   copy <isofile>               - copy to another iso\n" +"   lua <luascript>              - interpret LUA script\n"  "\n", argv[0]);  } @@ -319,6 +321,23 @@ virtual int startup() throw (GeneralException) {          delete o; o = 0;          delete b; b = 0;          delete buf; buf = 0; +    } else if (!strcmp(argv[optind], "lua")) { +	optind++; +	if ((argc - 1) != optind) { +	    showhelp(); +	    printm(M_ERROR, "lua needs one argument.\n"); +	    throw Exit(-1); +	} +	arg1 = argv[optind]; +        Lua * L = new Lua(); +        LuaInput::pushconstruct(L); +        LuaOutput::pushconstruct(L); +        LuaBuffer::pushconstruct(L); +        L->push("cdutil"); +        Luacdutils lcdutil(cdutil); +        lcdutil.push(L); +        L->settable(LUA_GLOBALSINDEX); +        L->load(&Input(arg1));      } else {  	showhelp();  	printm(M_ERROR, "Command %s unknow.\n", argv[optind]);  | 
