From b78888fe3889c2477b0d0ce93d6ab14bcdd25000 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 6 Aug 2003 14:49:52 -0400 Subject: ENH: Added configuration of name of executable in man page header and version banner. --- Source/CursesDialog/ccmake.cxx | 1 + Source/MFCDialog/CMakeSetup.cpp | 1 + Source/cmDocumentation.cxx | 27 +++++++++++++++++++++++---- Source/cmDocumentation.h | 6 ++++++ Source/cmakemain.cxx | 1 + 5 files changed, 32 insertions(+), 4 deletions(-) diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index ceabe98..a21209c 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -102,6 +102,7 @@ int main(int argc, char** argv) cmake hcm; std::vector commands; hcm.GetCommandDocumentation(commands); + doc.SetName("ccmake"); doc.SetNameSection(cmDocumentationName); doc.SetUsageSection(cmDocumentationUsage); doc.SetDescriptionSection(cmDocumentationDescription); diff --git a/Source/MFCDialog/CMakeSetup.cpp b/Source/MFCDialog/CMakeSetup.cpp index 32a293d..29359cf 100644 --- a/Source/MFCDialog/CMakeSetup.cpp +++ b/Source/MFCDialog/CMakeSetup.cpp @@ -112,6 +112,7 @@ BOOL CMakeSetup::InitInstance() std::vector generators; hcm.GetCommandDocumentation(commands); hcm.GetGeneratorDocumentation(generators); + doc.SetName("CMakeSetup"); doc.SetNameSection(cmDocumentationName); doc.SetUsageSection(cmDocumentationUsage); doc.SetDescriptionSection(cmDocumentationDescription); diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index edfc841..fad347e 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -73,7 +73,7 @@ const cmDocumentationEntry cmDocumentationMailingList[] = const cmDocumentationEntry cmDocumentationAuthor[] = { {0, - "This manual page was generated by \"cmake --help-man\".", 0}, + "This manual page was generated by the \"--help-man\" option.", 0}, {0,0,0} }; @@ -151,7 +151,7 @@ void cmDocumentation::PrintCopyright(std::ostream& os) //---------------------------------------------------------------------------- void cmDocumentation::PrintVersion(std::ostream& os) { - os << "CMake version " CMake_VERSION_FULL "\n"; + os << this->GetNameString() << " version " CMake_VERSION_FULL "\n"; } //---------------------------------------------------------------------------- @@ -328,6 +328,12 @@ void cmDocumentation::Print(Form f, std::ostream& os) } //---------------------------------------------------------------------------- +void cmDocumentation::SetName(const char* name) +{ + this->NameString = name?name:""; +} + +//---------------------------------------------------------------------------- void cmDocumentation::SetNameSection(const cmDocumentationEntry* section) { this->SetSection(0, section, 0, this->NameSection); @@ -806,9 +812,9 @@ void cmDocumentation::PrintDocumentationHTML(std::ostream& os) void cmDocumentation::PrintDocumentationMan(std::ostream& os) { this->CreateManDocumentation(); - os << ".TH CMake 1 \"" + os << ".TH " << this->GetNameString() << " 1 \"" << cmSystemTools::GetCurrentDateTime("%B %d, %Y").c_str() - << "\" \"CMake " CMake_VERSION_FULL "\"\n"; + << "\" \"" << this->GetNameString() << " " CMake_VERSION_FULL "\"\n"; this->Print(ManForm, os); } @@ -944,3 +950,16 @@ void cmDocumentation::SetSection(const cmDocumentationEntry* header, cmDocumentationEntry empty = {0,0,0}; vec.push_back(empty); } + +//---------------------------------------------------------------------------- +const char* cmDocumentation::GetNameString() +{ + if(this->NameString.length() > 0) + { + return this->NameString.c_str(); + } + else + { + return "CMake"; + } +} diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 8aaf4dc..3a0ac18 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -50,6 +50,10 @@ public: void PrintDocumentation(Type ht, std::ostream& os); /** Set the program name for standard document generation. */ + void SetName(const char* name); + + /** Set the program name section for standard document + * generation. */ void SetNameSection(const cmDocumentationEntry*); /** Set the program usage for standard document generation. */ @@ -134,7 +138,9 @@ private: const cmDocumentationEntry* section, const cmDocumentationEntry* footer, std::vector&); + const char* GetNameString(); + std::string NameString; std::vector NameSection; std::vector UsageSection; std::vector DescriptionSection; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 5b142c3..c55f915 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -113,6 +113,7 @@ int do_cmake(int ac, char** av) std::vector generators; hcm.GetCommandDocumentation(commands); hcm.GetGeneratorDocumentation(generators); + doc.SetName("cmake"); doc.SetNameSection(cmDocumentationName); doc.SetUsageSection(cmDocumentationUsage); doc.SetDescriptionSection(cmDocumentationDescription); -- cgit v0.12