diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2019-07-30 13:04:15 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2019-07-30 13:08:48 (GMT) |
commit | 40f507bedff94e269f9c32c941f65ed82fc25a67 (patch) | |
tree | 4749bd1500ad6d9442afdf7719e07ed810e7c5cf /src/doxygen.cpp | |
parent | 3c47ea4ff918a63eb3a3e5f67354b6975c839743 (diff) | |
download | Doxygen-40f507bedff94e269f9c32c941f65ed82fc25a67.zip Doxygen-40f507bedff94e269f9c32c941f65ed82fc25a67.tar.gz Doxygen-40f507bedff94e269f9c32c941f65ed82fc25a67.tar.bz2 |
Reduce code duplication when printing version string
Diffstat (limited to 'src/doxygen.cpp')
-rw-r--r-- | src/doxygen.cpp | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 92e5292..6f59411 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -10127,16 +10127,9 @@ static void devUsage() //---------------------------------------------------------------------------- // print the usage of doxygen -static void usage(const char *name) +static void usage(const char *name,const char *versionString) { - if (strlen(getGitVersion())) - { - msg("Doxygen version %s (%s)\nCopyright Dimitri van Heesch 1997-2015\n\n",getVersion(),getGitVersion()); - } - else - { - msg("Doxygen version %s\nCopyright Dimitri van Heesch 1997-2015\n\n",getVersion()); - } + msg("Doxygen version %s\nCopyright Dimitri van Heesch 1997-2019\n\n",versionString); msg("You can use doxygen in a number of ways:\n\n"); msg("1) Use doxygen to generate a template configuration file:\n"); msg(" %s [-s] -g [configName]\n\n",name); @@ -10353,6 +10346,16 @@ static int computeIdealCacheParam(uint v) void readConfiguration(int argc, char **argv) { + QCString versionString; + if (strlen(getGitVersion())>0) + { + versionString = QCString(getVersion())+" ("+getGitVersion()+")"; + } + else + { + versionString = getVersion(); + } + /************************************************************************** * Handle arguments * **************************************************************************/ @@ -10596,40 +10599,26 @@ void readConfiguration(int argc, char **argv) g_dumpSymbolMap = TRUE; break; case 'v': - if (strlen(getGitVersion())) - { - msg("%s (%s)\n",getVersion(),getGitVersion()); - } - else - { - msg("%s\n",getVersion()); - } + msg("%s\n",versionString.data()); cleanUpDoxygen(); exit(0); break; case '-': if (qstrcmp(&argv[optind][2],"help")==0) { - usage(argv[0]); + usage(argv[0],versionString); exit(0); } else if (qstrcmp(&argv[optind][2],"version")==0) { - if (strlen(getGitVersion())) - { - msg("%s (%s)\n",getVersion(),getGitVersion()); - } - else - { - msg("%s\n",getVersion()); - } + msg("%s\n",versionString.data()); cleanUpDoxygen(); exit(0); } else { err("Unknown option \"-%s\"\n",&argv[optind][1]); - usage(argv[0]); + usage(argv[0],versionString); exit(1); } break; @@ -10645,12 +10634,12 @@ void readConfiguration(int argc, char **argv) break; case 'h': case '?': - usage(argv[0]); + usage(argv[0],versionString); exit(0); break; default: err("Unknown option \"-%c\"\n",argv[optind][1]); - usage(argv[0]); + usage(argv[0],versionString); exit(1); } optind++; @@ -10680,7 +10669,7 @@ void readConfiguration(int argc, char **argv) else { err("Doxyfile not found and no input file specified!\n"); - usage(argv[0]); + usage(argv[0],versionString); exit(1); } } @@ -10694,7 +10683,7 @@ void readConfiguration(int argc, char **argv) else { err("configuration file %s not found!\n",argv[optind]); - usage(argv[0]); + usage(argv[0],versionString); exit(1); } } |