static const char *names[] =
{
"AUTH_TYPE",
"CONTENT_LENGTH",
"CONTENT_TYPE",
"DOCUMENT_ROOT",
"GATEWAY_INTERFACE",
"PATH_INFO",
"PATH_TRANSLATED",
"QUERY_STRING",
"REMOTE_ADDR",
"REMOTE_HOST",
"REMOTE_IDENT",
"REMOTE_USER",
"REQUEST_METHOD",
"SCRIPT_NAME",
"SERVER_NAME",
"SERVER_PORT",
"SERVER_PROTOCOL",
"SERVER_ROOT",
"SERVER_SOFTWARE",
};
static void
troll_environment()
{
extern char **environ;
int count = 0;
for (char **cpp = environ; *cpp; ++cpp)
{
char *cp = *cpp;
if (memcmp(cp, "HTTP_", 5) != 0)
continue;
char *vp = strchr(cp, '=');
if (!vp)
continue;
if (!count)
{
printf("Header Environment Variables
\n");
printf("\n");
}
rcstring name(cp, vp - cp);
rcstring value(vp + 1);
printf
(
"getenv(%s) = %s\n",
name.quote_c().quote_html().c_str(),
value.quote_c().quote_html().c_str()
);
++count;
}
if (count)
{
printf("
\n");
printf
(
"Listed %d environment variable%s\n",
count,
(count == 1 ? "" : "s")
);
}
}
int
main(int argc, char **argv)
{
printf("Content-Type: text/html\n");
printf("\n");
printf("\n");
printf("CGI Script Echo\n");
printf("\n");
printf("CGI Script Echo
\n");
printf("Command Line Arguments
\n");
switch (argc)
{
case 1:
printf("There are no command line arguments.\n");
break;
case 2:
printf("There is 1 command line argument.\n");
break;
default:
printf("There are %d command line arguments.\n", argc - 1);
}
printf("");
for (int j = 1; j < argc; ++j)
{
printf
(
"argv[%d] = %s\n",
j,
rcstring(argv[j]).quote_c().quote_html().c_str()
);
}
printf("
\n");
printf("Environment Variables
\n");
printf("");
int count = 0;
for (size_t j = 0; j < SIZEOF(names); ++j)
{
rcstring name = names[j];
printf("getenv(%s) = ", name.quote_c().quote_html().c_str());
const char *s = getenv(name.c_str());
if (!s)
printf("NULL");
else
{
rcstring value(s);
printf("%s", value.quote_c().quote_html().c_str());
++count;
}
printf("\n");
}
printf("
\n");
printf
(
"Listed %d environment variable%s\n",
count,
(count == 1 ? "" : "s")
);
troll_environment();
printf("\n");
exit(0);
return 0;
}
0707010000002d000081a4000000000000000000000001502f37be00000416000000000000000000000000000000000000002b00000000src/cgi-map-bom-radar/gmashup/bom_radar.cc
//
// junkyard - collection of programs too small to justify their own project
// Copyright (C) 2007, 2008 Peter Miller
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see
// .
//
#include
#include
gmashup_bom_radar::~gmashup_bom_radar()
{
}
gmashup_bom_radar::gmashup_bom_radar() :
show_towns(false),
show_grid(false)
{
}
0707010000002e000081a4000000000000000000000001502f37be000009c1000000000000000000000000000000000000002a00000000src/cgi-map-bom-radar/gmashup/bom_radar.h //
// junkyard - collection of programs too small to justify their own project
// Copyright (C) 2007, 2008 Peter Miller
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see
// .
//
#ifndef CGI_MAP_BOM_RADAR_MASHUP_H
#define CGI_MAP_BOM_RADAR_MASHUP_H
#include
/**
* The gmashup_bom_radar class is used to represent the interaction
* between a web browser running a Google Maps application, and a web
* server supplying it with BoMRain Radar data.
*/
class gmashup_bom_radar:
public gmashup
{
public:
/**
* The destructor.
*/
virtual ~gmashup_bom_radar();
/**
* The default constructor.
*/
gmashup_bom_radar();
protected:
// See base class for documentation.
void build_tile(int x, int y, int zoom);
// See base class for documentation.
void process_query_string();
// See base class for documentation.
void initial_map();
// See base class for documentation.
int tile_lifetime() const;
// See base class for documentation.
rcstring cache_dir();
private:
/**
* The show_towns instance variable is used to remember whether or
* not towns should be displayed in the tiles.
*/
bool show_towns;
/**
* The show_grid instance variable is used to remember whether or
* not the grid should be displayed in the tiles.
*/
bool show_grid;
/**
* The calculate_bounds method is used to construct the map bounds
* from the meta data.
*/
void calculate_bounds(rectangle &result);
/**
* The copy constructor. Do not use.
*/
gmashup_bom_radar(const gmashup_bom_radar &);
/**
* The assignment operator. Do not use.
*/
gmashup_bom_radar &operator=(const gmashup_bom_radar &);
};
#endif // CGI_MAP_BOM_RADAR_MASHUP_H
0707010000002f000081a4000000000000000000000001502f37be00002635000000000000000000000000000000000000003600000000src/cgi-map-bom-radar/gmashup/bom_radar/build_tile.cc //
// junkyard - collection of programs too small to justify their own project
// Copyright (C) 2007-2009 Peter Miller
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see
// .
//
#include
#include
#include
#include