diff --git a/src/ChangeLog b/src/ChangeLog index 2eab49bf92..a91b09a966 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,6 @@ +2002-08-06 John Levon + + * lyx_main.C: fix cmdline batch handling 2002-08-06 André Pönitz diff --git a/src/lyx_main.C b/src/lyx_main.C index 47c2fdd300..285606c2bf 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -25,6 +25,7 @@ #include "lyxlex.h" #include "bufferlist.h" +#include "buffer.h" #include "lyxserver.h" #include "kbmap.h" #include "lyxfunc.h" @@ -116,12 +117,21 @@ LyX::LyX(int & argc, char * argv[]) files.push_back(i18nLibFileSearch("examples", "splash.lyx")); } -#if 0 // FIXME: GUII // Execute batch commands if available if (!batch_command.empty()) { lyxerr[Debug::INIT] << "About to handle -x '" << batch_command << "'" << endl; + Buffer * last_loaded = 0; + + vector::iterator it = files.begin(); + vector::iterator end = files.end(); + for (; it != end; ++it) { + last_loaded = bufferlist.loadLyXFile(*it); + } + + files.clear(); + // no buffer loaded, create one if (!last_loaded) last_loaded = bufferlist.newFile("tmpfile", string()); @@ -131,13 +141,11 @@ LyX::LyX(int & argc, char * argv[]) // try to dispatch to last loaded buffer first bool const dispatched = last_loaded->dispatch(batch_command, &success); - // if this was successful, finish - if (dispatched) { + if (success) { QuitLyX(); exit(!success); } } -#endif lyx_gui::start(batch_command, files); }