From 146bec22e9ff91e8274becd719149f7ab9c7cfb9 Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 22 Nov 2019 14:56:50 +0100 Subject: Better termination message In case a `WARN_LOGFILE` is used it in this file no clear whether doxygen finished correctly or exited beforehand in case a fatal error. Now a 'Exiting...' is also given in the warning log file in case an error is a fatal error. --- src/commentscan.l | 3 +- src/configimpl.l | 73 +++++++++++++++++++------------------------- src/defgen.cpp | 3 +- src/diagram.cpp | 3 +- src/docbookgen.cpp | 3 +- src/docsets.cpp | 12 +++----- src/dot.cpp | 4 +-- src/dotgfxhierarchytable.cpp | 2 +- src/dotgraph.cpp | 2 +- src/doxygen.cpp | 24 +++++---------- src/eclipsehelp.cpp | 3 +- src/formula.cpp | 5 ++- src/htmlgen.cpp | 3 +- src/htmlhelp.cpp | 9 ++---- src/latexgen.cpp | 9 ++---- src/mangen.cpp | 6 ++-- src/message.cpp | 28 +++++++++++++++++ src/message.h | 2 ++ src/outputgen.cpp | 3 +- src/perlmodgen.cpp | 3 +- src/qhp.cpp | 3 +- src/rtfgen.cpp | 3 +- src/util.cpp | 6 ++-- 23 files changed, 101 insertions(+), 111 deletions(-) diff --git a/src/commentscan.l b/src/commentscan.l index 2b10f87..9d09fa1 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -327,8 +327,7 @@ class DocCmdMapper { if (m_map.find(p->cmdName)!=0) { - err("DocCmdMapper: command %s already added\n",p->cmdName); - exit(1); + term(1,"DocCmdMapper: command %s already added\n",p->cmdName); } Cmd *cmd = new Cmd; cmd->func = p->handler; diff --git a/src/configimpl.l b/src/configimpl.l index 0cc5c88..ba95dce 100644 --- a/src/configimpl.l +++ b/src/configimpl.l @@ -56,6 +56,16 @@ void config_err(const char *fmt, ...) vfprintf(stderr, (QCString(error_str) + fmt).data(), args); va_end(args); } +void config_term(const int exitVal, const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + vfprintf(stderr, (QCString(error_str) + fmt).data(), args); + va_end(args); + fprintf(stderr, "%s\n", "Exiting..."); + exit(exitVal); +} + void config_warn(const char *fmt, ...) { va_list args; @@ -213,13 +223,11 @@ QCString &ConfigImpl::getString(const char *fileName,int num,const char *name) c ConfigOption *opt = m_dict->find(name); if (opt==0) { - config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } else if (opt->kind()!=ConfigOption::O_String) { - config_err("%s<%d>: Internal error: Requested option %s not of string type!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested option %s not of string type!\n",fileName,num,name); } return *((ConfigString *)opt)->valueRef(); } @@ -229,13 +237,11 @@ QStrList &ConfigImpl::getList(const char *fileName,int num,const char *name) con ConfigOption *opt = m_dict->find(name); if (opt==0) { - config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } else if (opt->kind()!=ConfigOption::O_List) { - config_err("%s<%d>: Internal error: Requested option %s not of list type!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested option %s not of list type!\n",fileName,num,name); } return *((ConfigList *)opt)->valueRef(); } @@ -245,13 +251,11 @@ QCString &ConfigImpl::getEnum(const char *fileName,int num,const char *name) con ConfigOption *opt = m_dict->find(name); if (opt==0) { - config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } else if (opt->kind()!=ConfigOption::O_Enum) { - config_err("%s<%d>: Internal error: Requested option %s not of enum type!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested option %s not of enum type!\n",fileName,num,name); } return *((ConfigEnum *)opt)->valueRef(); } @@ -261,13 +265,11 @@ int &ConfigImpl::getInt(const char *fileName,int num,const char *name) const ConfigOption *opt = m_dict->find(name); if (opt==0) { - config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } else if (opt->kind()!=ConfigOption::O_Int) { - config_err("%s<%d>: Internal error: Requested option %s not of integer type!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested option %s not of integer type!\n",fileName,num,name); } return *((ConfigInt *)opt)->valueRef(); } @@ -277,13 +279,11 @@ bool &ConfigImpl::getBool(const char *fileName,int num,const char *name) const ConfigOption *opt = m_dict->find(name); if (opt==0) { - config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } else if (opt->kind()!=ConfigOption::O_Bool) { - config_err("%s<%d>: Internal error: Requested option %s not of boolean type!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested option %s not of boolean type!\n",fileName,num,name); } return *((ConfigBool *)opt)->valueRef(); } @@ -566,9 +566,8 @@ static QCString configStringRecode( void *cd = portable_iconv_open(outputEncoding,inputEncoding); if (cd==(void *)(-1)) { - fprintf(stderr,"Error: unsupported character conversion: '%s'->'%s'\n", + config_term(1,"Error: unsupported character conversion: '%s'->'%s'\n", inputEncoding.data(),outputEncoding.data()); - exit(1); } size_t iLeft=(size_t)inputSize; size_t oLeft=(size_t)outputSize; @@ -583,9 +582,8 @@ static QCString configStringRecode( } else { - fprintf(stderr,"Error: failed to translate characters from %s to %s: %s\n", + config_term(1,"Error: failed to translate characters from %s to %s: %s\n", inputEncoding.data(),outputEncoding.data(),strerror(errno)); - exit(1); } portable_iconv_close(cd); return output; @@ -638,9 +636,8 @@ static FILE *findFile(const char *fileName) static void readIncludeFile(const char *incName) { if (includeDepth==MAX_INCLUDE_DEPTH) { - config_err("maximum include depth (%d) reached, %s is not included. Aborting...\n", + config_term(1,"maximum include depth (%d) reached, %s is not included. Aborting...\n", MAX_INCLUDE_DEPTH,incName); - exit(1); } QCString inc = incName; @@ -678,8 +675,7 @@ static void readIncludeFile(const char *incName) } else { - config_err("@INCLUDE = %s: not found!\n",inc.data()); - exit(1); + config_term(1,"@INCLUDE = %s: not found!\n",inc.data()); } } @@ -1161,9 +1157,8 @@ void ConfigImpl::init() ConfigOption * opt = ConfigImpl::instance()->get(depName); if (opt==0) { - config_warn("Config option '%s' has invalid depends relation on unknown option '%s'\n", + config_term(1,"Config option '%s' has invalid depends relation on unknown option '%s'\n", option->name().data(),depName.data()); - exit(1); } } } @@ -1229,8 +1224,7 @@ static QCString configFileToString(const char *name) } if (!fileOpened) { - config_err("cannot open file '%s' for reading\n",name); - exit(1); + config_term(1,"cannot open file '%s' for reading\n",name); } return ""; } @@ -1408,9 +1402,8 @@ void Config::checkAndCorrect() QFileInfo fi(headerFile); if (!fi.exists()) { - err("tag HTML_HEADER: header file '%s' " + term(1,"tag HTML_HEADER: header file '%s' " "does not exist\n",headerFile.data()); - exit(1); } } // Test to see if HTML footer is valid @@ -1420,9 +1413,8 @@ void Config::checkAndCorrect() QFileInfo fi(footerFile); if (!fi.exists()) { - err("tag HTML_FOOTER: footer file '%s' " + term(1,"tag HTML_FOOTER: footer file '%s' " "does not exist\n",footerFile.data()); - exit(1); } } @@ -1435,9 +1427,8 @@ void Config::checkAndCorrect() QFileInfo fi(MathJaxCodefile); if (!fi.exists()) { - err("tag MATHJAX_CODEFILE file '%s' " + term(1,"tag MATHJAX_CODEFILE file '%s' " "does not exist\n",MathJaxCodefile.data()); - exit(1); } } QCString &path = Config_getString(MATHJAX_RELPATH); @@ -1455,9 +1446,8 @@ void Config::checkAndCorrect() QFileInfo fi(latexHeaderFile); if (!fi.exists()) { - err("tag LATEX_HEADER: header file '%s' " + term(1,"tag LATEX_HEADER: header file '%s' " "does not exist\n",latexHeaderFile.data()); - exit(1); } } // Test to see if LaTeX footer is valid @@ -1467,9 +1457,8 @@ void Config::checkAndCorrect() QFileInfo fi(latexFooterFile); if (!fi.exists()) { - err("tag LATEX_FOOTER: footer file '%s' " + term(1,"tag LATEX_FOOTER: footer file '%s' " "does not exist\n",latexFooterFile.data()); - exit(1); } } diff --git a/src/defgen.cpp b/src/defgen.cpp index f5e12aa..6ae98a6 100644 --- a/src/defgen.cpp +++ b/src/defgen.cpp @@ -572,9 +572,8 @@ void generateDEF() dir.setPath(QDir::currentDirPath()); if (!dir.mkdir(outputDirectory)) { - err("tag OUTPUT_DIRECTORY: Output directory '%s' does not " + term(1,"tag OUTPUT_DIRECTORY: Output directory '%s' does not " "exist and cannot be created\n",outputDirectory.data()); - exit(1); } else { diff --git a/src/diagram.cpp b/src/diagram.cpp index edc895d..3d0c22a 100644 --- a/src/diagram.cpp +++ b/src/diagram.cpp @@ -1101,8 +1101,7 @@ void ClassDiagram::writeFigure(FTextStream &output,const char *path, f1.setName(epsName.data()); if (!f1.open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",f1.name().data()); - exit(1); + term(1,"Could not open file %s for writing\n",f1.name().data()); } FTextStream t(&f1); diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp index 083aac3..8040c92 100644 --- a/src/docbookgen.cpp +++ b/src/docbookgen.cpp @@ -289,8 +289,7 @@ void DocbookGenerator::init() QDir d(dir); if (!d.exists() && !d.mkdir(dir)) { - err("Could not create output directory %s\n",dir.data()); - exit(1); + term(1,"Could not create output directory %s\n",dir.data()); } createSubDirs(d); diff --git a/src/docsets.cpp b/src/docsets.cpp index 055532a..b33aea5 100644 --- a/src/docsets.cpp +++ b/src/docsets.cpp @@ -62,8 +62,7 @@ void DocSets::initialize() QFile makefile(mfName); if (!makefile.open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",mfName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",mfName.data()); } FTextStream ts(&makefile); @@ -113,8 +112,7 @@ void DocSets::initialize() QFile plist(plName); if (!plist.open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",plName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",plName.data()); } FTextStream ts(&plist); @@ -149,8 +147,7 @@ void DocSets::initialize() m_nf = new QFile(notes); if (!m_nf->open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",notes.data()); - exit(1); + term(1,"Could not open file %s for writing\n",notes.data()); } //QCString indexName=Config_getBool(GENERATE_TREEVIEW)?"main":"index"; QCString indexName="index"; @@ -170,8 +167,7 @@ void DocSets::initialize() m_tf = new QFile(tokens); if (!m_tf->open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",tokens.data()); - exit(1); + term(1,"Could not open file %s for writing\n",tokens.data()); } m_tts.setDevice(m_tf); m_tts << "" << endl; diff --git a/src/dot.cpp b/src/dot.cpp index 5ad3916..2fb3b3e 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -272,7 +272,7 @@ void writeDotGraphFromFile(const char *inFile,const char *outDir, QDir d(outDir); if (!d.exists()) { - err("Output dir %s does not exist!\n",outDir); exit(1); + term(1,"Output dir %s does not exist!\n",outDir); } QCString imgExt = getDotImageExtension(); @@ -325,7 +325,7 @@ void writeDotImageMapFromFile(FTextStream &t, QDir d(outDir); if (!d.exists()) { - err("Output dir %s does not exist!\n",outDir.data()); exit(1); + term(1,"Output dir %s does not exist!\n",outDir.data()); } QCString mapName = baseName+".map"; diff --git a/src/dotgfxhierarchytable.cpp b/src/dotgfxhierarchytable.cpp index 0a7942f..df9f48f 100644 --- a/src/dotgfxhierarchytable.cpp +++ b/src/dotgfxhierarchytable.cpp @@ -86,7 +86,7 @@ void DotGfxHierarchyTable::writeGraph(FTextStream &out, // store the original directory if (!d.exists()) { - err("Output dir %s does not exist!\n",path); exit(1); + term(1,"Output dir %s does not exist!\n",path); } // put each connected subgraph of the hierarchy in a row of the HTML output diff --git a/src/dotgraph.cpp b/src/dotgraph.cpp index 9b7ddb7..c17523b 100644 --- a/src/dotgraph.cpp +++ b/src/dotgraph.cpp @@ -147,7 +147,7 @@ bool DotGraph::prepareDotFile() { if (!m_dir.exists()) { - err("Output dir %s does not exist!\n", m_dir.path().data()); exit(1); + term(1,"Output dir %s does not exist!\n", m_dir.path().data()); } QCString sigStr(33); diff --git a/src/doxygen.cpp b/src/doxygen.cpp index d4d55e7..52381b8 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -8800,10 +8800,9 @@ static void computePageRelations(Entry *root) PageDef *subPd = Doxygen::pageSDict->find(bi.name); if (pd==subPd) { - err("page defined at line %d of file %s with label %s is a direct " + term(1,"page defined at line %d of file %s with label %s is a direct " "subpage of itself! Please remove this cyclic dependency.\n", pd->docLine(),pd->docFile().data(),pd->name().data()); - exit(1); } else if (subPd) { @@ -8828,10 +8827,9 @@ static void checkPageRelations() { if (ppd==pd) { - err("page defined at line %d of file %s with label %s is a subpage " + term(1,"page defined at line %d of file %s with label %s is a subpage " "of itself! Please remove this cyclic dependency.\n", pd->docLine(),pd->docFile().data(),pd->name().data()); - exit(1); } ppd=ppd->getOuterScope(); } @@ -9164,8 +9162,7 @@ static void generateConfigFile(const char *configFile,bool shortList, } else { - err("Cannot open file %s for writing\n",configFile); - exit(1); + term(1,"Cannot open file %s for writing\n",configFile); } } static void compareDoxyfile() @@ -9182,8 +9179,7 @@ static void compareDoxyfile() } else { - err("Cannot open file %s for writing\n",configFile); - exit(1); + term(1,"Cannot open file %s for writing\n",configFile); } } //---------------------------------------------------------------------------- @@ -9821,17 +9817,15 @@ void readFormulaRepository(QCString dir, bool cmp) { if ((f=Doxygen::formulaDict->find(formText))==0) { - err("discrepancy between formula repositories! Remove " + term(1,"discrepancy between formula repositories! Remove " "formula.repository and from_* files from output directories."); - exit(1); } QCString formLabel; formLabel.sprintf("\\form#%d",f->getId()); if (formLabel != formName) { - err("discrepancy between formula repositories! Remove " + term(1,"discrepancy between formula repositories! Remove " "formula.repository and from_* files from output directories."); - exit(1); } new_repository++; } @@ -9848,9 +9842,8 @@ void readFormulaRepository(QCString dir, bool cmp) } if (cmp && (current_repository != new_repository)) { - err("size discrepancy between formula repositories! Remove " + term(1,"size discrepancy between formula repositories! Remove " "formula.repository and from_* files from output directories."); - exit(1); } } @@ -11661,9 +11654,8 @@ void generateOutput() QDir searchDir(searchDirName); if (!searchDir.exists() && !searchDir.mkdir(searchDirName)) { - err("Could not create search results directory '%s' $PWD='%s'\n", + term(1,"Could not create search results directory '%s' $PWD='%s'\n", searchDirName.data(),QDir::currentDirPath().data()); - exit(1); } HtmlGenerator::writeSearchData(searchDirName); if (!serverBasedSearch) // client side search index diff --git a/src/eclipsehelp.cpp b/src/eclipsehelp.cpp index 2757308..04f2947 100644 --- a/src/eclipsehelp.cpp +++ b/src/eclipsehelp.cpp @@ -72,8 +72,7 @@ void EclipseHelp::initialize() m_tocfile = new QFile(name); if (!m_tocfile->open(IO_WriteOnly)) { - err("Could not open file %s for writing\n", name.data()); - exit(1); + term(1,"Could not open file %s for writing\n", name.data()); } // -- initialize its text stream diff --git a/src/formula.cpp b/src/formula.cpp index 3d8e6ce..a17b9b7 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -51,7 +51,10 @@ void FormulaList::generateBitmaps(const char *path) int x1,y1,x2,y2; QDir d(path); // store the original directory - if (!d.exists()) { err("Output dir %s does not exist!\n",path); exit(1); } + if (!d.exists()) + { + term(1,"Output dir %s does not exist!\n",path); + } QCString oldDir = QDir::currentDirPath().utf8(); // go to the html output directory (i.e. path) QDir::setCurrent(d.absPath()); diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index df39d32..ab3bfa4 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -733,8 +733,7 @@ void HtmlGenerator::init() QDir d(dname); if (!d.exists() && !d.mkdir(dname)) { - err("Could not create output directory %s\n",dname.data()); - exit(1); + term(1,"Could not create output directory %s\n",dname.data()); } //writeLogo(dname); if (!Config_getString(HTML_HEADER).isEmpty()) diff --git a/src/htmlhelp.cpp b/src/htmlhelp.cpp index c514102..6101984 100644 --- a/src/htmlhelp.cpp +++ b/src/htmlhelp.cpp @@ -308,8 +308,7 @@ void HtmlHelp::initialize() m_fromUtf8 = portable_iconv_open(str,"UTF-8"); if (m_fromUtf8==(void *)(-1)) { - err("unsupported character conversion for CHM_INDEX_ENCODING: '%s'->'UTF-8'\n", str); - exit(1); + term(1,"unsupported character conversion for CHM_INDEX_ENCODING: '%s'->'UTF-8'\n", str); } /* open the contents file */ @@ -317,8 +316,7 @@ void HtmlHelp::initialize() cf = new QFile(fName); if (!cf->open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",fName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",fName.data()); } /* Write the header of the contents file */ cts.setDevice(cf); @@ -334,8 +332,7 @@ void HtmlHelp::initialize() kf = new QFile(fName); if (!kf->open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",fName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",fName.data()); } /* Write the header of the contents file */ kts.setDevice(kf); diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 094232f..bd86038 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -288,8 +288,7 @@ static void writeLatexMakefile() QFile file(fileName); if (!file.open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",fileName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",fileName.data()); } // inserted by KONNO Akihisa 2002-03-05 QCString latex_command = theTranslator->latexCommandName(); @@ -387,8 +386,7 @@ static void writeMakeBat() bool generateBib = !Doxygen::citeDict->isEmpty(); if (!file.open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",fileName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",fileName.data()); } FTextStream t(&file); t << "set Dir_Old=%cd%\n"; @@ -468,8 +466,7 @@ void LatexGenerator::init() QDir d(dir); if (!d.exists() && !d.mkdir(dir)) { - err("Could not create output directory %s\n",dir.data()); - exit(1); + term(1,"Could not create output directory %s\n",dir.data()); } writeLatexMakefile(); diff --git a/src/mangen.cpp b/src/mangen.cpp index 06d3c4a..f4eba20 100644 --- a/src/mangen.cpp +++ b/src/mangen.cpp @@ -112,14 +112,12 @@ void ManGenerator::init() QDir d(manOutput); if (!d.exists() && !d.mkdir(manOutput)) { - err("Could not create output directory %s\n",manOutput.data()); - exit(1); + term(1,"Could not create output directory %s\n",manOutput.data()); } d.setPath(manOutput + "/" + getSubdir()); if (!d.exists() && !d.mkdir(manOutput + "/" + getSubdir())) { - err("Could not create output directory %s/%s\n",manOutput.data(), getSubdir().data()); - exit(1); + term(1,"Could not create output directory %s/%s\n",manOutput.data(), getSubdir().data()); } createSubDirs(d); } diff --git a/src/message.cpp b/src/message.cpp index ddf757a..4b430da 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -251,6 +251,34 @@ extern void err_full(const char *file,int line,const char *fmt, ...) va_end(args); } +void term(const int exitVal, const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + vfprintf(warnFile, (QCString(error_str) + fmt).data(), args); + va_end(args); + if (warnFile != stderr) + { + for (int i = 0; i < strlen(error_str); i++) fprintf(warnFile, " "); + fprintf(warnFile, "%s\n", "Exiting..."); + } + exit(exitVal); +} + +extern void term_full(const int exitVal, const char *file,int line,const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + do_warn(TRUE, file, line, error_str, fmt, args); + va_end(args); + if (warnFile != stderr) + { + for (int i = 0; i < strlen(error_str); i++) fprintf(warnFile, " "); + fprintf(warnFile, "%s\n", "Exiting..."); + } + exit(exitVal); +} + void printlex(int dbg, bool enter, const char *lexName, const char *fileName) { const char *enter_txt = "entering"; diff --git a/src/message.h b/src/message.h index 3b1a294..56e7e27 100644 --- a/src/message.h +++ b/src/message.h @@ -30,6 +30,8 @@ extern void warn_doc_error(const char *file,int line,const char *fmt, ...); extern void warn_uncond(const char *fmt, ...); extern void err(const char *fmt, ...); extern void err_full(const char *file,int line,const char *fmt, ...); +extern void term(const int exitVal, const char *fmt, ...); +extern void term_full(const int exitVal, const char *file,int line,const char *fmt, ...); void initWarningFormat(); extern void printlex(int dbg, bool enter, const char *lexName, const char *fileName); diff --git a/src/outputgen.cpp b/src/outputgen.cpp index 53d2d7f..ea8fd5e 100644 --- a/src/outputgen.cpp +++ b/src/outputgen.cpp @@ -46,8 +46,7 @@ void OutputGenerator::startPlainFile(const char *name) file = new QFile(fileName); if (!file->open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",fileName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",fileName.data()); } t.setDevice(file); } diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index be226b7..bf20d45 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -2271,9 +2271,8 @@ bool PerlModGenerator::createOutputDir(QDir &perlModDir) dir.setPath(QDir::currentDirPath()); if (!dir.mkdir(outputDirectory)) { - err("tag OUTPUT_DIRECTORY: Output directory '%s' does not " + term(1,"tag OUTPUT_DIRECTORY: Output directory '%s' does not " "exist and cannot be created\n",outputDirectory.data()); - exit(1); } else { diff --git a/src/qhp.cpp b/src/qhp.cpp index 6260d09..484475c 100644 --- a/src/qhp.cpp +++ b/src/qhp.cpp @@ -168,8 +168,7 @@ void Qhp::finalize() QFile file(fileName); if (!file.open(IO_WriteOnly)) { - err("Could not open file %s for writing\n", fileName.data()); - exit(1); + term(1,"Could not open file %s for writing\n", fileName.data()); } m_doc.dumpTo(file); } diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 92740f4..2702cca 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -175,8 +175,7 @@ void RTFGenerator::init() QDir d(dir); if (!d.exists() && !d.mkdir(dir)) { - err("Could not create output directory %s\n",dir.data()); - exit(1); + term(1,"Could not create output directory %s\n",dir.data()); } rtf_Style.setAutoDelete(TRUE); diff --git a/src/util.cpp b/src/util.cpp index f58a630..92b97b6 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -7950,10 +7950,9 @@ static int transcodeCharacterBuffer(const char *fileName,BufStr &srcBuf,int size void *cd = portable_iconv_open(outputEncoding,inputEncoding); if (cd==(void *)(-1)) { - err("unsupported character conversion: '%s'->'%s': %s\n" + term(1,"unsupported character conversion: '%s'->'%s': %s\n" "Check the INPUT_ENCODING setting in the config file!\n", inputEncoding,outputEncoding,strerror(errno)); - exit(1); } int tmpBufSize=size*4+1; BufStr tmpBuf(tmpBufSize); @@ -7971,9 +7970,8 @@ static int transcodeCharacterBuffer(const char *fileName,BufStr &srcBuf,int size } else { - err("%s: failed to translate characters from %s to %s: check INPUT_ENCODING\n", + term(1,"%s: failed to translate characters from %s to %s: check INPUT_ENCODING\n", fileName,inputEncoding,outputEncoding); - exit(1); } portable_iconv_close(cd); return newSize; -- cgit v0.12