void ShowInput(cgicc::Cgicc const& formData); void ShowOutput(cgicc::Cgicc const& formData); void ShowIllusOutput(IllusInputParms const&); void ShowCensusOutput(IllusInputParms const&, std::string const&, bool);   int main(int argc, char* argv[]) {      fs::path::default_name_check(fs::native);  fs::path argv0(argv[0]);     std::free(0);    initialize_fpu();  if(SIG_ERR == std::signal(SIGFPE, (void(*)(int))floating_point_error_handler)) { warning() << "Cannot install floating point error signal handler.\n"; return EXIT_FAILURE; }  if(argc == 2 && argv[1] == std::string("--capture")) { std::system("set > settings"); std::ofstream os ("stdin.txt" ,   std::ios_base::out | std::ios_base::binary | std::ios_base::trunc ); os << std::cin.rdbuf(); std::cout << "Environment and QUERY_STRING captured for later use\n" << "in debugging. File 'settings' can be turned into a\n" << "command script in an OS-dependent way. After executing\n" << "the script, run the program, redirected its input from\n" << "file 'stdin.txt'." ;   return EXIT_SUCCESS; } char const content_string[] = "ProductName=sample" "&IssueAge=45" "&RetirementAge=65" "&Gender=Female" "&UnderwritingClass=Preferred" "&Smoking=Smoker" "&SolveType=SolveEePrem" "&SolveBeginYear=0" "&SolveEndYear=10" "&SolveTarget=SolveForTarget" "&SolveTargetCashSurrenderValue=1000000" "&SolveTargetYear=20" "&SolveBasis=Current_basis"  "&SpecifiedAmount=1000000" "&DeathBenefitOption=a"   "&Payment=0" "&PaymentMode=annual" "&Dumpin=0" "&1035ExchangeAmount=0" "&1035ExchangeBasis=0" "&GeneralAccountRate=.055" "&GeneralAccountRateType=NetRate"  "&LoanRate=.055" "&LoanRateType=Fixed" "&Comments=" "&Census=" "&ShowOutput=on" "&submit=Submit" ;   if(argc == 2 && argv[1] == std::string("--write_content_string")) { std::ofstream os ("cgi.test.in" ,   std::ios_base::out | std::ios_base::binary | std::ios_base::trunc ); os << content_string; return EXIT_SUCCESS; }  if(argc == 2 && argv[1] == std::string("--enable_test")) { std::string s("CONTENT_LENGTH="); s += value_cast_ihs<std::string>(std::strlen(content_string)); putenv(s.c_str()); putenv("REQUEST_METHOD=POST"); }  try {  cgicc::Cgicc cgi;   std::cout << cgicc::HTTPHTMLHeader() << cgicc::HTMLDoctype(cgicc::HTMLDoctype::eStrict) << '\n'; std::cout << cgicc::html().set("lang", "EN").set("dir", "LTR") << '\n';    std::cout << cgicc::head() << '\n';   std::cout << cgicc::style() << cgicc::comment() << '\n'; std::cout << "BODY { color: black; background-color: white; }\n"; std::cout << "HR.half { width: 60%; align: center; }\n"; std::cout << "SPAN.red, STRONG.red { color: red; }\n"; std::cout << "DIV.smaller { font-size: small; }\n"; std::cout << "DIV.notice { border: solid thin; padding: 1em; margin: 1em 0; " << "background: #DDD; }\n"; std::cout << "SPAN.blue { color: blue; }\n"; std::cout << "COL.title { color: white; background-color: black; "; std::cout << "font-weight: bold; text-align: center; }\n"; std::cout << "COL.data { background-color: #DDD; text-align: left; }\n"; std::cout << "TD.data, TR.data { background-color: #DDD; text-align: left; }\n"; std::cout << "TD.grayspecial { background-color: #DDD; text-align: left; }\n"; std::cout << "TD.ltgray, TR.ltgray { background-color: #DDD; }\n"; std::cout << "TD.dkgray, TR.dkgray { background-color: #BBB; }\n"; std::cout << "COL.black, TD.black, TD.title, TR.title { color: white; " << "background-color: black; font-weight: bold; text-align: center; }\n"; std::cout << "COL.gray, TD.gray { background-color: #DDD; text-align: center; }\n"; std::cout << "TABLE.cgi { left-margin: auto; right-margin: auto; width: 90%; }\n";  std::cout << cgicc::comment() << cgicc::style() << '\n';  std::cout << cgicc::title() << "Let me illustrate...cgi v" << cgi.getVersion() << " Test Results" << cgicc::title() << '\n'; std::cout << cgicc::meta().set("name", "author").set("content", "Gregory W. Chicares") << '\n';  std::cout << cgicc::head() << '\n';   std::cout << cgicc::body() << '\n';  std::cout << cgicc::h1() << "Let me illustrate... cgi v" << cgi.getVersion() << " Test Results" << cgicc::h1() << '\n';   cgicc::CgiEnvironment const& env = cgi.getEnvironment();   std::cout << cgicc::comment() << "This page generated by GNU cgicc for " << env.getRemoteHost() << cgicc::comment() << '\n'; std::cout << cgicc::h4() << "Thanks for using Let me illustrate..." << ", " << env.getRemoteHost() << '(' << env.getRemoteAddr() << ")!" << cgicc::h4() << '\n';   if(cgi.queryCheckbox("save")) { cgi.save("save"); std::cout << cgicc::p(cgicc::h2("Data Saved")) << '\n';  std::cout << cgicc::div().set("class", "notice") << '\n'; std::cout << "Your data has been saved, and may be restored (by anyone) " << "via the same form.\n" << cgicc::div() << cgicc::p() << '\n'; }   if(cgi.queryCheckbox("restore")) { cgi.restore("save"); std::cout << cgicc::p(cgicc::h2("Data Restored")) << '\n';  std::cout << cgicc::div().set("class", "notice") << '\n'; std::cout << "The data displayed has been restored from a file on disk.\n" << cgicc::div() << cgicc::p() << '\n'; }     if(cgi.queryCheckbox("ShowEnvironment")) ShowEnvironment(env);       if(cgi.queryCheckbox("ShowInput")) ShowInput(cgi);      if(cgi.queryCheckbox("ShowOutput")) ShowOutput(cgi);   std::cout << cgicc::p() << cgicc::div().set("align","center"); std::cout << cgicc::a("Back to form").set("href", cgi.getEnvironment().getReferrer()) << '\n'; std::cout << cgicc::div() << cgicc::br() << cgicc::hr(cgicc::set("class","half")) << '\n';   std::cout << cgicc::div().set("align","center").set("class","smaller") << '\n'; std::cout << "GNU cgi" << cgicc::span("cc").set("class","red") << " v"; std::cout << cgi.getVersion(); std::cout << " by " << cgicc::a("Stephen F. Booth") .set("href", "http: << cgicc::br() << '\n'; std::cout << "Compiled at " << cgi.getCompileTime(); std::cout << " on " << cgi.getCompileDate() << cgicc::br() << '\n';   std::cout << cgicc::div() << '\n'; std::cout << cgicc::body() << cgicc::html() << '\n';   return EXIT_SUCCESS; }   catch(std::exception const& e) {       cgicc::html::reset();    cgicc::head::reset();        cgicc::body::reset(); cgicc::title::reset();   cgicc::h1::reset();          cgicc::h4::reset(); cgicc::comment::reset(); cgicc::td::reset();          cgicc::tr::reset(); cgicc::table::reset();   cgicc::div::reset(); cgicc::p::reset(); cgicc::a::reset();       cgicc::h2::reset();          cgicc::colgroup::reset();   std::cout << cgicc::HTTPHTMLHeader() << cgicc::HTMLDoctype(cgicc::HTMLDoctype::eStrict) << '\n'; std::cout << cgicc::html().set("lang","EN").set("dir","LTR") << '\n';    std::cout << cgicc::head() << '\n';   std::cout << cgicc::style() << cgicc::comment() << '\n'; std::cout << "BODY { color: black; background-color: white; }\n"; std::cout << "HR.half { width: 60%; align: center; }\n"; std::cout << "SPAN.red, STRONG.red { color: red; }\n"; std::cout << "DIV.notice { border: solid thin; padding: 1em; margin: 1em 0; " << "background: #DDD; }\n";  std::cout << cgicc::comment() << cgicc::style() << '\n';  std::cout << cgicc::title("GNU cgicc exception") << '\n'; std::cout << cgicc::meta().set("name", "author") .set("content", "Stephen F. Booth") << '\n'; std::cout << cgicc::head() << '\n';  std::cout << cgicc::body() << '\n';  std::cout << cgicc::h1() << "GNU cgi" << cgicc::span("cc", cgicc::set("class","red")) << " caught an exception" << cgicc::h1() << '\n';  std::cout << cgicc::div().set("align","center").set("class","notice") << '\n';  std::cout << cgicc::h2(e.what()) << '\n';   std::cout << cgicc::div() << '\n'; std::cout << cgicc::hr().set("class","half") << '\n'; std::cout << cgicc::body() << cgicc::html() << '\n';  return EXIT_SUCCESS; } }   void ShowEnvironment(cgicc::CgiEnvironment const& env) {   std::cout << cgicc::h2("Environment information from CgiEnvironment") << '\n';  std::cout << cgicc::div().set("align","center") << '\n';  std::cout << cgicc::table().set("border","0").set("rules","none").set("frame","void") .set("cellspacing","2").set("cellpadding","2") .set("class","cgi") << '\n'; std::cout << cgicc::colgroup().set("span","2") << '\n'; std::cout << cgicc::col().set("align","center").set("class","title").set("span","1") << '\n'; std::cout << cgicc::col().set("align","left").set("class","data").set("span","1") << '\n'; std::cout << cgicc::colgroup() << '\n';  std::cout << cgicc::tr() << cgicc::td("Request Method").set("class","title") << cgicc::td(env.getRequestMethod()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Path Info").set("class","title") << cgicc::td(env.getPathInfo()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Path Translated").set("class","title") << cgicc::td(env.getPathTranslated()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Script Name").set("class","title") << cgicc::td(env.getScriptName()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("HTTP Referrer").set("class","title") << cgicc::td(env.getReferrer()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("HTTP Cookie").set("class","title") << cgicc::td(env.getCookies()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Query String").set("class","title") << cgicc::td(env.getQueryString()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Content Length").set("class","title") << cgicc::td().set("class","data") << env.getContentLength() << cgicc::td() << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Post Data").set("class","title") << cgicc::td().set("class","data") << cgicc::pre(env.getPostData()).set("class","data") << cgicc::td() << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Remote Host").set("class","title") << cgicc::td(env.getRemoteHost()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Remote Address").set("class","title") << cgicc::td(env.getRemoteAddr()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Authorization Type").set("class","title") << cgicc::td(env.getAuthType()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Remote User").set("class","title") << cgicc::td(env.getRemoteUser()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Remote Identification").set("class","title") << cgicc::td(env.getRemoteIdent()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Content Type").set("class","title") << cgicc::td(env.getContentType()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("HTTP Accept").set("class","title") << cgicc::td(env.getAccept()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("User Agent").set("class","title") << cgicc::td(env.getUserAgent()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Server Software").set("class","title") << cgicc::td(env.getServerSoftware()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Server Name").set("class","title") << cgicc::td(env.getServerName()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Gateway Interface").set("class","title") << cgicc::td(env.getGatewayInterface()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Server Protocol").set("class","title") << cgicc::td(env.getServerProtocol()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Server Port").set("class","title") << cgicc::td().set("class","data") << env.getServerPort() << cgicc::td() << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("HTTPS").set("class","title") << cgicc::td().set("class","data") << (env.usingHTTPS() ? "true" : "false") << cgicc::td() << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Redirect Request").set("class","title") << cgicc::td(env.getRedirectRequest()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Redirect URL").set("class","title") << cgicc::td(env.getRedirectURL()).set("class","data") << cgicc::tr() << '\n'; std::cout << cgicc::tr() << cgicc::td("Redirect Status").set("class","title") << cgicc::td(env.getRedirectStatus()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::table() << cgicc::div() << '\n'; }  std::string GetValue(cgicc::Cgicc const& cgi, std::string const& name) { cgicc::const_form_iterator data = cgi.getElement(name); if(data != cgi.getElements().end()) {  return **data; } else { return "0"; } }   void
void ShowInput(cgicc::Cgicc const& formData);void ShowOutput(cgicc::Cgicc const& formData);void ShowIllusOutput(IllusInputParms const&);void ShowCensusOutput(IllusInputParms const&, std::string const&, bool);// TODO ?? gnu getopt should be used here.int main(int argc, char* argv[]){    // Set boost filesystem default name check function to native. Its    // facilities are used with names the user controls, and users    // may specify names that are not portable. The default name check    // function should be set before using this boost library, to    // ensure that it's used uniformly.    fs::path::default_name_check(fs::native);    fs::path argv0(argv[0]);    // This line forces mpatrol to link when it otherwise might not.    // It has no other effect according to C99 7.20.3.2/2, second    // sentence.    std::free(0);    // TODO ?? Instead, consider a singleton that checks the control    // word upon destruction?    initialize_fpu();    if(SIG_ERR == std::signal(SIGFPE, (void(*)(int))floating_point_error_handler))        {        warning() << "Cannot install floating point error signal handler.\n";        return EXIT_FAILURE;        }    if(argc == 2 && argv[1] == std::string("--capture"))        {        std::system("set > settings");        std::ofstream os            ("stdin.txt"            ,   std::ios_base::out              | std::ios_base::binary              | std::ios_base::trunc            );        os << std::cin.rdbuf();        std::cout            << "Environment and QUERY_STRING captured for later use\n"            << "in debugging. File 'settings' can be turned into a\n"            << "command script in an OS-dependent way. After executing\n"            << "the script, run the program, redirected its input from\n"            << "file 'stdin.txt'."            ;        // We've read stdin already, and it can't be rewound, so        // just exit.        return EXIT_SUCCESS;        }    char const content_string[] =        "ProductName=sample"        "&IssueAge=45"        "&RetirementAge=65"        "&Gender=Female"        "&UnderwritingClass=Preferred"        "&Smoking=Smoker"        "&SolveType=SolveEePrem"        "&SolveBeginYear=0"        "&SolveEndYear=10"        "&SolveTarget=SolveForTarget"        "&SolveTargetCashSurrenderValue=1000000"        "&SolveTargetYear=20"        "&SolveBasis=Current_basis"//        "&SAStrategy=SAInputScalar"        "&SpecifiedAmount=1000000"        "&DeathBenefitOption=a"//        "&sRetDBOpt=A"//        "&EePmtStrategy=PmtInputScalar"        "&Payment=0"        "&PaymentMode=annual"        "&Dumpin=0"        "&1035ExchangeAmount=0"        "&1035ExchangeBasis=0"        "&GeneralAccountRate=.055"        "&GeneralAccountRateType=NetRate"//        "&SeparateAccountRateType=NetRate" // not used yet        "&LoanRate=.055"        "&LoanRateType=Fixed"        "&Comments="        "&Census="        "&ShowOutput=on"        "&submit=Submit"        ;    // Write 'content_string' to a file suitable for piping into this    // program for standalone test.    if(argc == 2 && argv[1] == std::string("--write_content_string"))        {        std::ofstream os            ("cgi.test.in"            ,   std::ios_base::out              | std::ios_base::binary              | std::ios_base::trunc            );        os << content_string;        return EXIT_SUCCESS;        }    // Set CONTENT_LENGTH and REQUEST_METHOD for standalone test.    if(argc == 2 && argv[1] == std::string("--enable_test"))        {        std::string s("CONTENT_LENGTH=");        s += value_cast_ihs<std::string>(std::strlen(content_string));        putenv(s.c_str());        putenv("REQUEST_METHOD=POST");        }  try {    // Create a new cgicc::Cgicc object containing all the CGI data    cgicc::Cgicc cgi;    // Output the HTTP headers for an HTML document, and the HTML 4.0 DTD info    std::cout << cgicc::HTTPHTMLHeader() << cgicc::HTMLDoctype(cgicc::HTMLDoctype::eStrict) << '\n';    std::cout << cgicc::html().set("lang", "EN").set("dir", "LTR") << '\n';    // Set up the page's header and title.    // I will put in lfs to ease reading of the produced HTML.    std::cout << cgicc::head() << '\n';    // Output the style sheet portion of the header    std::cout << cgicc::style() << cgicc::comment() << '\n';    std::cout << "BODY { color: black; background-color: white; }\n";    std::cout << "HR.half { width: 60%; align: center; }\n";    std::cout << "SPAN.red, STRONG.red { color: red; }\n";    std::cout << "DIV.smaller { font-size: small; }\n";    std::cout << "DIV.notice { border: solid thin; padding: 1em; margin: 1em 0; "         << "background: #DDD; }\n";    std::cout << "SPAN.blue { color: blue; }\n";    std::cout << "COL.title { color: white; background-color: black; ";    std::cout << "font-weight: bold; text-align: center; }\n";    std::cout << "COL.data { background-color: #DDD; text-align: left; }\n";    std::cout << "TD.data, TR.data { background-color: #DDD; text-align: left; }\n";    std::cout << "TD.grayspecial { background-color: #DDD; text-align: left; }\n";    std::cout << "TD.ltgray, TR.ltgray { background-color: #DDD; }\n";    std::cout << "TD.dkgray, TR.dkgray { background-color: #BBB; }\n";    std::cout << "COL.black, TD.black, TD.title, TR.title { color: white; "          << "background-color: black; font-weight: bold; text-align: center; }\n";    std::cout << "COL.gray, TD.gray { background-color: #DDD; text-align: center; }\n";    std::cout << "TABLE.cgi { left-margin: auto; right-margin: auto; width: 90%; }\n";    std::cout << cgicc::comment() << cgicc::style() << '\n';    std::cout << cgicc::title() << "Let me illustrate...cgi v" << cgi.getVersion()         << " Test Results"         << cgicc::title() << '\n';    std::cout << cgicc::meta().set("name", "author").set("content", "Gregory W. Chicares")         << '\n';    std::cout << cgicc::head() << '\n';    // Start the HTML body    std::cout << cgicc::body() << '\n';    std::cout << cgicc::h1() << "Let me illustrate... cgi v" << cgi.getVersion()     << " Test Results" << cgicc::h1() << '\n';    // Get a pointer to the environment    cgicc::CgiEnvironment const& env = cgi.getEnvironment();    // Generic thank you message    std::cout << cgicc::comment() << "This page generated by GNU cgicc for "         << env.getRemoteHost() << cgicc::comment() << '\n';    std::cout << cgicc::h4() << "Thanks for using Let me illustrate..."         << ", " << env.getRemoteHost()         << '(' << env.getRemoteAddr() << ")!" << cgicc::h4() << '\n';    // If the user wants to save the submission, do it    if(cgi.queryCheckbox("save")) {      cgi.save("save");      std::cout << cgicc::p(cgicc::h2("Data Saved")) << '\n';      std::cout << cgicc::div().set("class", "notice") << '\n';      std::cout << "Your data has been saved, and may be restored (by anyone) "           << "via the same form.\n" << cgicc::div() << cgicc::p() << '\n';    }    // If the user wants to restore from the last submission, do it    if(cgi.queryCheckbox("restore")) {      cgi.restore("save");      std::cout << cgicc::p(cgicc::h2("Data Restored")) << '\n';      std::cout << cgicc::div().set("class", "notice") << '\n';      std::cout << "The data displayed has been restored from a file on disk.\n"           << cgicc::div() << cgicc::p() << '\n';    }    // If the user requested a dump of the environment,    // create a simple table showing the values of the    // environment variables    if(cgi.queryCheckbox("ShowEnvironment"))      ShowEnvironment(env);    // If the user requested, print out the raw form data from    // the vector of FormEntries.  This will contain every    // element in the list.    // This is one of two ways to get at form data, the other    // being the use of cgicc::Cgicc's getElement() methods.      if(cgi.queryCheckbox("ShowInput"))      ShowInput(cgi);    // If the user requested data via cgicc::Cgicc's getElement() methods, do it.    // This is different than the use of the list of FormEntries    // because it requires prior knowledge of the name of form elements.    // Usually they will be known, but you never know.    if(cgi.queryCheckbox("ShowOutput"))      ShowOutput(cgi);    // Now print out a footer with some fun info    std::cout << cgicc::p() << cgicc::div().set("align","center");    std::cout << cgicc::a("Back to form").set("href", cgi.getEnvironment().getReferrer())         << '\n';    std::cout << cgicc::div() << cgicc::br() << cgicc::hr(cgicc::set("class","half")) << '\n';    // Information on cgicc    std::cout << cgicc::div().set("align","center").set("class","smaller") << '\n';    std::cout << "GNU cgi" << cgicc::span("cc").set("class","red") << " v";    std::cout << cgi.getVersion();    std::cout << " by " << cgicc::a("Stephen F. Booth")                       .set("href", "http://home.earthlink.net/~sfbooth/")         << cgicc::br() << '\n';    std::cout << "Compiled at " << cgi.getCompileTime();    std::cout << " on " << cgi.getCompileDate() << cgicc::br() << '\n';    // End of document    std::cout << cgicc::div() << '\n';    std::cout << cgicc::body() << cgicc::html() << '\n';    // No chance for failure in this example    return EXIT_SUCCESS;  }  // Did any errors occur?  catch(std::exception const& e) {    // This is a dummy exception handler, as it doesn't really do    // anything except print out information.    // Reset all the HTML elements that might have been used to    // their initial state so we get valid output    cgicc::html::reset();    cgicc::head::reset();        cgicc::body::reset();    cgicc::title::reset();   cgicc::h1::reset();          cgicc::h4::reset();    cgicc::comment::reset(); cgicc::td::reset();          cgicc::tr::reset();    cgicc::table::reset();   cgicc::div::reset(); cgicc::p::reset();    cgicc::a::reset();       cgicc::h2::reset();          cgicc::colgroup::reset();    // Output the HTTP headers for an HTML document, and the HTML 4.0 DTD info    std::cout << cgicc::HTTPHTMLHeader() << cgicc::HTMLDoctype(cgicc::HTMLDoctype::eStrict) << '\n';    std::cout << cgicc::html().set("lang","EN").set("dir","LTR") << '\n';    // Set up the page's header and title.    // I will put in lfs to ease reading of the produced HTML.    std::cout << cgicc::head() << '\n';    // Output the style sheet portion of the header    std::cout << cgicc::style() << cgicc::comment() << '\n';    std::cout << "BODY { color: black; background-color: white; }\n";    std::cout << "HR.half { width: 60%; align: center; }\n";    std::cout << "SPAN.red, STRONG.red { color: red; }\n";    std::cout << "DIV.notice { border: solid thin; padding: 1em; margin: 1em 0; "         << "background: #DDD; }\n";    std::cout << cgicc::comment() << cgicc::style() << '\n';    std::cout << cgicc::title("GNU cgicc exception") << '\n';    std::cout << cgicc::meta().set("name", "author")                  .set("content", "Stephen F. Booth") << '\n';    std::cout << cgicc::head() << '\n';    std::cout << cgicc::body() << '\n';    std::cout << cgicc::h1() << "GNU cgi" << cgicc::span("cc", cgicc::set("class","red"))         << " caught an exception" << cgicc::h1() << '\n';    std::cout << cgicc::div().set("align","center").set("class","notice") << '\n';    std::cout << cgicc::h2(e.what()) << '\n';    // End of document    std::cout << cgicc::div() << '\n';    std::cout << cgicc::hr().set("class","half") << '\n';    std::cout << cgicc::body() << cgicc::html() << '\n';    return EXIT_SUCCESS;  }}// Print out a table of the CgiEnvironmentvoidShowEnvironment(cgicc::CgiEnvironment const& env){  // This is just a brain-dead dump of information.  // Almost all of this code is for HTML formatting  std::cout << cgicc::h2("Environment information from CgiEnvironment") << '\n';  std::cout << cgicc::div().set("align","center") << '\n';  std::cout << cgicc::table().set("border","0").set("rules","none").set("frame","void")                 .set("cellspacing","2").set("cellpadding","2")                 .set("class","cgi") << '\n';  std::cout << cgicc::colgroup().set("span","2") << '\n';  std::cout << cgicc::col().set("align","center").set("class","title").set("span","1")       << '\n';  std::cout << cgicc::col().set("align","left").set("class","data").set("span","1")       << '\n';  std::cout << cgicc::colgroup() << '\n';  std::cout << cgicc::tr() << cgicc::td("Request Method").set("class","title")       << cgicc::td(env.getRequestMethod()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Path Info").set("class","title")       << cgicc::td(env.getPathInfo()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Path Translated").set("class","title")       << cgicc::td(env.getPathTranslated()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Script Name").set("class","title")       << cgicc::td(env.getScriptName()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("HTTP Referrer").set("class","title")       << cgicc::td(env.getReferrer()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("HTTP Cookie").set("class","title")       << cgicc::td(env.getCookies()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Query String").set("class","title")       << cgicc::td(env.getQueryString()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Content Length").set("class","title")       << cgicc::td().set("class","data") << env.getContentLength()       << cgicc::td() << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Post Data").set("class","title")       << cgicc::td().set("class","data")       << cgicc::pre(env.getPostData()).set("class","data") << cgicc::td()       << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Remote Host").set("class","title")       << cgicc::td(env.getRemoteHost()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Remote Address").set("class","title")       << cgicc::td(env.getRemoteAddr()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Authorization Type").set("class","title")       << cgicc::td(env.getAuthType()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Remote User").set("class","title")       << cgicc::td(env.getRemoteUser()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Remote Identification").set("class","title")        << cgicc::td(env.getRemoteIdent()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Content Type").set("class","title")       << cgicc::td(env.getContentType()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("HTTP Accept").set("class","title")        << cgicc::td(env.getAccept()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("User Agent").set("class","title")       << cgicc::td(env.getUserAgent()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Server Software").set("class","title")        << cgicc::td(env.getServerSoftware()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Server Name").set("class","title")       << cgicc::td(env.getServerName()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Gateway Interface").set("class","title")        << cgicc::td(env.getGatewayInterface()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Server Protocol").set("class","title")        << cgicc::td(env.getServerProtocol()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Server Port").set("class","title")       << cgicc::td().set("class","data") << env.getServerPort()       << cgicc::td() << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("HTTPS").set("class","title")       << cgicc::td().set("class","data") << (env.usingHTTPS() ? "true" : "false")       << cgicc::td() << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Redirect Request").set("class","title")       << cgicc::td(env.getRedirectRequest()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Redirect URL").set("class","title")       << cgicc::td(env.getRedirectURL()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::tr() << cgicc::td("Redirect Status").set("class","title")       << cgicc::td(env.getRedirectStatus()).set("class","data") << cgicc::tr() << '\n';  std::cout << cgicc::table() << cgicc::div() << '\n';}std::string GetValue(cgicc::Cgicc const& cgi, std::string const& name){    cgicc::const_form_iterator data = cgi.getElement(name);    if(data != cgi.getElements().end())        {        // iterator refers to a valid element        return **data;        }    else        {        return "0";        }}// Print out the value of every form elementvoidShowInput(cgicc::Cgicc const& data){  std::cout << cgicc::h2("Form Data via vector") << '\n';  std::cout << cgicc::div().set("align","center") << '\n';  std::cout << cgicc::table().set("border","0").set("rules","none").set("frame","void")                 .set("cellspacing","2").set("cellpadding","2")                 .set("class","cgi") << '\n';  std::cout << cgicc::colgroup().set("span","2") << '\n';  std::cout << cgicc::col().set("align","center").set("span","2") << '\n';  std::cout << cgicc::colgroup() << '\n';  std::cout << cgicc::tr().set("class","title") << cgicc::td("Element Name")       << cgicc::td("Element Value") << cgicc::tr() << '\n';  // Iterate through the vector, and print out each value  cgicc::const_form_iterator iter;  for(iter = data.getElements().begin();      iter != data.getElements().end();      ++iter) {    std::cout << cgicc::tr().set("class","data") << cgicc::td(iter->getName())         << cgicc::td(iter->getValue()) << cgicc::tr() << '\n';  }  std::cout << cgicc::table() << cgicc::div() << '\n';}