Ejemplo n.º 1
0
int main(int argn, char** argv)
{
  dmlite_manager* manager;
  dmlite_context* context;
  
  SECTION("Instantiation");
  
  /* Load the mock plug-in */
  manager = dmlite_manager_new();
  TEST_MANAGER_CALL(manager, dmlite_manager_load_plugin, "./plugin_mock.so", "plugin_mock");
  
  /* Instantiate */
  context = dmlite_context_new(manager);
  
  /* Set credentials (mock will ignore anyway) */
  dmlite_credentials creds;
  memset(&creds, 0, sizeof(creds));
  creds.client_name = "root";
  TEST_CONTEXT_CALL(context, dmlite_setcredentials, &creds);
  
  /* Do tests */
  testGetPools(context);
  testGet(context);
  testPut(context);
  
  /* Clean-up */
  dmlite_context_free(context);
  dmlite_manager_free(manager);
  
  return TEST_FAILURES;
}
Ejemplo n.º 2
0
void testGet(dmlite_context* context)
{
  SECTION("GET");
  
  /* Mock returns always a location with two chunks */
  dmlite_location* loc;
  TEST_CONTEXT_CALL_PTR(loc, context, dmlite_get, "/file");
  
  TEST_ASSERT_EQUAL(2, loc->nchunks);
  
  TEST_ASSERT_STR_EQUAL("host1.cern.ch", loc->chunks[0].host);
  TEST_ASSERT_STR_EQUAL("/storage/chunk01", loc->chunks[0].path);
  TEST_ASSERT_EQUAL(0, loc->chunks[0].offset);
  TEST_ASSERT_EQUAL(100, loc->chunks[0].size);
          
  TEST_ASSERT_STR_EQUAL("host2.cern.ch", loc->chunks[1].host);
  TEST_ASSERT_STR_EQUAL("/storage/chunk02", loc->chunks[1].path);
  TEST_ASSERT_EQUAL(101, loc->chunks[1].offset);
  TEST_ASSERT_EQUAL(50, loc->chunks[1].size);
  
  /* Second has an extra */
  char         buffer[64];
  dmlite_any*  extra = dmlite_any_dict_get(loc->chunks[1].extra, "token");
  dmlite_any_to_string(extra, buffer, sizeof(buffer));
  TEST_ASSERT_STR_EQUAL("123456789", buffer);
  dmlite_any_free(extra);
  
  dmlite_location_free(context, loc);
}
Ejemplo n.º 3
0
void testWrite(dmlite_context* context)
{
  dmlite_fd*       file;
  dmlite_any_dict* dict = dmlite_any_dict_new();
  char             buffer[64];
  
  SECTION("Read");
  
  /* Good to open */
  dmlite_any* token = dmlite_any_new_string("987654321");
  dmlite_any_dict_insert(dict, "token", token);
  dmlite_any_free(token);
  TEST_CONTEXT_CALL_PTR(file, context, dmlite_fopen, "/file", O_RDWR, dict);
  
  /* Write a chunk */
  TEST_ASSERT_EQUAL(10, dmlite_fwrite(file, "123456789", 10));
  
  /* Seek and read it back */
  TEST_ASSERT_EQUAL(0, dmlite_fseek(file, 0, SEEK_SET));
  TEST_ASSERT_EQUAL(10, dmlite_fread(file, buffer, 10));
  TEST_ASSERT_STR_EQUAL("123456789", buffer);
  
  
  /* Free */
  TEST_ASSERT_EQUAL(0, dmlite_fclose(file));
  dmlite_any_dict_free(dict);
}
Ejemplo n.º 4
0
void testRead(dmlite_context* context)
{
  dmlite_fd*       file;
  dmlite_any_dict* dict = dmlite_any_dict_new();
  char             buffer[64];
  memset(buffer, 0, sizeof(buffer));
  
  SECTION("Read");
  
  /* Bad token */
  file = dmlite_fopen(context, "/file", O_RDONLY, dict);
  TEST_ASSERT_EQUAL(NULL, file);
  TEST_ASSERT_EQUAL(DM_FORBIDDEN, dmlite_errno(context));
          
  /* Open non-existing */
  file = dmlite_fopen(context, "/does-not-exist", O_RDONLY, dict);
  TEST_ASSERT_EQUAL(NULL, file);
  TEST_ASSERT_EQUAL(DM_NO_SUCH_FILE, dmlite_errno(context));
  
  /* Good to open */
  dmlite_any* token = dmlite_any_new_string("123456789");
  dmlite_any_dict_insert(dict, "token", token);
  dmlite_any_free(token);
  TEST_CONTEXT_CALL_PTR(file, context, dmlite_fopen, "/file", O_RDONLY, dict);
  
  /* Read */
  TEST_ASSERT_EQUAL(4, dmlite_fread(file, buffer, 4));
  buffer[5] = '\0';
  TEST_ASSERT_STR_EQUAL("abcd", buffer);
  TEST_ASSERT_EQUAL(4, dmlite_fread(file, buffer, 4));
  buffer[5] = '\0';
  TEST_ASSERT_STR_EQUAL("efgh", buffer);
  
  /* Seek and read */
  TEST_ASSERT_EQUAL(0, dmlite_fseek(file, 10, SEEK_SET));
  TEST_ASSERT_EQUAL(4, dmlite_fread(file, buffer, 4));
  buffer[5] = '\0';
  TEST_ASSERT_STR_EQUAL("klmn", buffer);
  
  TEST_ASSERT_EQUAL(14, dmlite_ftell(file));
  
  TEST_ASSERT_EQUAL(0, dmlite_feof(file));
  
  /* Free */
  TEST_ASSERT_EQUAL(0, dmlite_fclose(file));
  dmlite_any_dict_free(dict);
}
Ejemplo n.º 5
0
void testPut(dmlite_context* context)
{
  char buffer[64];
  
  SECTION("PUT");
  
  /* Mock returns always one single location with one token */
  dmlite_location* loc;
  TEST_CONTEXT_CALL_PTR(loc, context, dmlite_put, "/file");
  
  TEST_ASSERT_EQUAL(1, loc->nchunks);
  
  TEST_ASSERT_STR_EQUAL("host1.cern.ch", loc->chunks[0].host);
  TEST_ASSERT_STR_EQUAL("/storage/chunk01", loc->chunks[0].path);
  TEST_ASSERT_EQUAL(0, loc->chunks[0].offset);
  TEST_ASSERT_EQUAL(0, loc->chunks[0].size);
  
    
  dmlite_any*  extra = dmlite_any_dict_get(loc->chunks[0].extra, "token");
  dmlite_any_to_string(extra, buffer, sizeof(buffer));
  TEST_ASSERT_STR_EQUAL("987654321", buffer);
  dmlite_any_free(extra);
  
  dmlite_location_free(context, loc);
  
  /* A donewriting without token will fail */
  dmlite_any_dict* dict = dmlite_any_dict_new();
  TEST_ASSERT_EQUAL(DM_FORBIDDEN, dmlite_donewriting(context,
                                                     "/storage/chunk01", dict));
  
  /* With token */
  dmlite_any* token = dmlite_any_new_string("987654321");
  dmlite_any_dict_insert(dict, "token", token);
  
  TEST_CONTEXT_CALL(context, dmlite_donewriting,
                    "/storage/chunk01", dict);
  
  dmlite_any_free(token);
  dmlite_any_dict_free(dict);
}
Ejemplo n.º 6
0
INTERNAL void
edid_parse_raw (void *edid_raw, edid_info * edid)
{
  memset (edid, 0, sizeof (edid_info));
  get_vendor_section (SECTION (VENDOR_SECTION, edid_raw), &(edid->vendor));
  get_version_section (SECTION (VERSION_SECTION, edid_raw), &(edid->version));
  get_display_section (SECTION (DISPLAY_SECTION, edid_raw), &(edid->features),
                       &(edid->version));
  get_established_timing_section (SECTION
                                  (ESTABLISHED_TIMING_SECTION, edid_raw),
                                  &(edid->timings1));
  get_std_timing_section (SECTION (STD_TIMING_SECTION, edid_raw),
                          edid->timings2, &(edid->version));
  get_dt_md_section (SECTION (DET_TIMING_SECTION, edid_raw), &(edid->version),
                     edid->det_mon);
}
Ejemplo n.º 7
0
static void php_info_aolserver(ZEND_MODULE_INFO_FUNC_ARGS)
{
	char buf[512];
	int uptime = Ns_InfoUptime();
	int i;
	
	php_info_print_table_start();
	php_info_print_table_row(2, "SAPI module version", "$Id$");
	php_info_print_table_row(2, "Build date", Ns_InfoBuildDate());
	php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile());
	php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog());
	php_info_print_table_row(2, "Installation path", Ns_InfoHomePath());
	php_info_print_table_row(2, "Hostname of server", Ns_InfoHostname());
	php_info_print_table_row(2, "Source code label", Ns_InfoLabel());
	php_info_print_table_row(2, "Server platform", Ns_InfoPlatform());
	snprintf(buf, 511, "%s/%s", Ns_InfoServerName(), Ns_InfoServerVersion());
	php_info_print_table_row(2, "Server version", buf);
	snprintf(buf, 511, "%d day(s), %02d:%02d:%02d", 
			uptime / 86400,
			(uptime / 3600) % 24,
			(uptime / 60) % 60,
			uptime % 60);
	php_info_print_table_row(2, "Server uptime", buf);
	php_info_print_table_end();

	SECTION("HTTP Headers Information");
	php_info_print_table_start();
	php_info_print_table_colspan_header(2, "HTTP Request Headers");
	php_info_print_table_row(2, "HTTP Request", NSG(conn)->request->line);
	for (i = 0; i < Ns_SetSize(NSG(conn)->headers); i++) {
		php_info_print_table_row(2, Ns_SetKey(NSG(conn)->headers, i), Ns_SetValue(NSG(conn)->headers, i));
	}

	php_info_print_table_colspan_header(2, "HTTP Response Headers");
	for (i = 0; i < Ns_SetSize(NSG(conn)->outputheaders); i++) {
		php_info_print_table_row(2, Ns_SetKey(NSG(conn)->outputheaders, i), Ns_SetValue(NSG(conn)->outputheaders, i));
	}
	php_info_print_table_end();
}
Ejemplo n.º 8
0
bool CONFIG::Load(std::istream & f)
{
	if (!SUPPRESS_ERROR && (!f || f.eof()))
	{
		return false;
	}

	iterator section = sections.insert(std::pair<std::string, SECTION>("", SECTION())).first;
	std::string line;
	while (f && !f.eof())
	{
		std::getline(f, line, '\n');
		bool process_success = ProcessLine(section, line);
		if (!process_success)
		{
			return false;
		}
	}

	//DebugPrint(std::cerr);

	return true;
}
Ejemplo n.º 9
0
void testGetPools(dmlite_context* context)
{
  dmlite_pool* pools;
  unsigned     nPools;
  char         buffer[64];
  
  SECTION("Get pools");
  
  /* Mock should return 1 */
  TEST_CONTEXT_CALL(context, dmlite_getpools, &nPools, &pools);
  TEST_ASSERT_EQUAL(1, nPools);
  
  TEST_ASSERT_STR_EQUAL("mock", pools[0].pool_type);
  TEST_ASSERT_STR_EQUAL("hardcoded", pools[0].pool_name);
  
  /* There is one dummy extra */
  dmlite_any* extra = dmlite_any_dict_get(pools[0].extra, "extra");
  dmlite_any_to_string(extra, buffer, sizeof(buffer));
  TEST_ASSERT_STR_EQUAL("something", buffer);
  dmlite_any_free(extra);
  
  /* Free */
  TEST_ASSERT_EQUAL(0, dmlite_pools_free(context, nPools, pools));
}
Ejemplo n.º 10
0
int main()
{
	{
		SECTION("orderedarray: simple insertion");
		mystl::orderedarray<int> a1;
		size_t ind;

		// insert a végére
		a1.insert(2);
		a1.insert(6);
		a1.insert(10);

		// insert az elejére
		a1.insert(-5);
		a1.insert(-10);
        
		// dupla insert
		a1.insert(2);
		a1.insert(8);
		a1.insert(6);

		// dupla insert az elejére
		a1.insert(-10);
		a1.insert(-10);
		a1.insert(9);
		a1.insert(-10);
        
		// dupla insert a végére
		a1.insert(30);
		a1.insert(15);
		a1.insert(30);
		a1.insert(30);
        
		// copy konstruktor
		mystl::orderedarray<int> a2 = a1;
		a2.insert(17);

		// operator =
		mystl::orderedarray<int> a3;

		a3 = a2;
		a3.insert(-1);

		std::cout << "a1: " << a1 << "\na2: " << a2 << "\na3: " << a3 << "\n";

		// keresés
		SECTION("orderedarray: find");
		{
			DEBUG_METHOD(ind = a2.find(2));

			if( ind == mystl::orderedarray<int>::npos )
				std::cout << "nincs benne a 2\n";
			else
			{
				const mystl::orderedarray<int>& a4 = a2;
				std::cout << "a2[a2.find(2)] == " << a4[ind] << "\n";
			}

			DEBUG_METHOD(ind = a2.find(-10));

			if( ind == mystl::orderedarray<int>::npos )
				std::cout << "nincs benne a -10\n";
			else
				std::cout << "benne van a -10\n";

			DEBUG_METHOD(ind = a2.find(30));

			if( ind == mystl::orderedarray<int>::npos )
				std::cout << "nincs benne a 30\n";
			else
				std::cout << "benne van a 30\n";
		}

		// törlés
		SECTION("orderedarray: erase");
		{
			std::cout << "erase(8)\n";
			a2.erase(8);

			DEBUG_METHOD(ind = a2.find(8));

			if( ind == mystl::orderedarray<int>::npos )
				std::cout << "nincs benne a 8\n";
			else
				std::cout << "benne van a 8\n";

			DEBUG_METHOD(a2.erase(-10));
			DEBUG_METHOD(a2.erase(30));
			DEBUG_METHOD(a2.erase(30));

			std::cout << "a2: " << a2 << "\n";
		}

		// clear
		SECTION("orderedarray: erase");
		{
			DEBUG_METHOD(a2.clear());
			std::cout << "\na2.size() == " << a2.size() << "\n";

			DEBUG_METHOD(ind = a2.find(30));

			if( ind == mystl::orderedarray<int>::npos )
				std::cout << "nincs benne a 30\n";
			else
				std::cout << "benne van a 30\n";

			a2.erase(10);
		}
	}

	{
		SECTION("list: simple insertion");

		mystl::list<int> l1;

		l1.push_back(10);
		l1.push_back(5);
		l1.push_back(1);
		l1.push_back(-7);
		l1.push_back(8);

		ASSERT(l1.front() == 10);
		ASSERT(l1.back() == 8);

		write("l1", l1);

		DEBUG_METHOD(l1.clear());
		write("l1", l1);

		SECTION("list: insert at front");

		l1.push_front(10);
		l1.push_front(3);
		l1.push_back(5);
		l1.push_front(6);
		l1.push_back(-1);

		write("l1", l1);

		SECTION("list: resize & copy");

		DEBUG_METHOD(l1.resize(10, 25));
		write("l1", l1);

		DEBUG_METHOD(mystl::list<int> l2(l1));
		mystl::list<int> l3;

		l3.push_back(34);
		l3.push_back(11);

		ASSERT(l2.front() == l1.front());
		ASSERT(l2.back() == l1.back());
		ASSERT(l3.back() == 11);

		DEBUG_METHOD(l2.push_front(2));
		DEBUG_METHOD(l3 = l1);

		write("l2", l2);
		write("l3", l3);

		SECTION("list: random insertion");
		{
			DEBUG_METHOD(l2.insert(l2.begin(), 55));
			DEBUG_METHOD(l2.insert(l2.end(), 44));

			ASSERT(l2.front() == 55);
			ASSERT(l2.back() == 44);

			write("l2", l2);

			mystl::list<int>::iterator it = l2.begin();

			for( int i = 0; i < 4; ++i )
				++it;

			std::cout << "*it == " << *it << "\n";

			DEBUG_METHOD(l2.insert(it, 3));
			DEBUG_METHOD(l2.insert(it, 5));
			DEBUG_METHOD(l2.insert(it, 1));

			write("l2", l2);
		}

		SECTION("list: iterators");
		{
			mystl::list<int>::iterator it1, it2;

			it1 = l1.begin();
			it2 = l2.end();

			DEBUG_METHOD(it1 == it2);
			DEBUG_METHOD(it1 != it2);
			DEBUG_METHOD(*it2);
			DEBUG_METHOD(++it2);
			DEBUG_METHOD(it2++);
			DEBUG_METHOD(--it1);
			DEBUG_METHOD(it1--);
		}

		SECTION("list: erase & remove");
		{
			write("l2", l2);

			DEBUG_METHOD(l2.erase(l2.begin()));
			DEBUG_METHOD(l2.erase(l2.end()));

			write("l2", l2);

			mystl::list<int>::iterator it = l2.begin();

			for( int i = 0; i < 4; ++i )
				++it;

			std::cout << "*it == " << *it << "\n";

			DEBUG_METHOD(l2.erase(it));
			DEBUG_METHOD(l2.erase(it));

			write("l2", l2);

			DEBUG_METHOD(l2.remove(25));
			write("l2", l2);
		}
	}

	{
		SECTION("list: types");

		class Apple
		{
		private:
			int i;

		public:
			Apple() {
				i = 0;
			}

			Apple(int j) {
				i = j;
			}

			void foo() {
				std::cout << "Apple::foo(): i == " << i << "\n";
			}
		};
        
		typedef mystl::list<Apple> applelist;
		typedef mystl::list<Apple*> appleptrlist;

		applelist apples;
		appleptrlist appleptrs;

		apples.push_back(6);
		apples.push_back(10);
		apples.push_front(-4);
		apples.push_back(5);

		appleptrs.push_back(new Apple(20));
		appleptrs.push_back(new Apple(1));
		appleptrs.push_front(new Apple(-4));
		appleptrs.push_back(new Apple(-3));
		appleptrs.push_front(new Apple(6));

		std::cout << "apples:\n";

		for( applelist::iterator it = apples.begin(); it != apples.end(); ++it )
			it->foo();

		std::cout << "\nappleptrs:\n";

		for( appleptrlist::iterator it = appleptrs.begin(); it != appleptrs.end(); ++it )
		{
			(*it)->foo();
			delete (*it);
		}
	}

	std::cout << "\n";
	_CrtDumpMemoryLeaks();

	system("pause");
	return 0;
}
Ejemplo n.º 11
0
bool CONFIG::ProcessLine(CONFIG::iterator & section, std::string & linestr)
{
	linestr = Trim(linestr);
	linestr = Strip(linestr, '\r');
	linestr = Strip(linestr, '\n');

	//remove comments
	std::string::size_type commentpos = linestr.find("#", 0);
	if (commentpos < linestr.length())
	{
		linestr = linestr.substr(0, commentpos);
	}

	linestr = Trim(linestr);

	//only continue if not a blank line or comment-only line
	if (linestr.length() > 0)
	{
		if (linestr.find("=", 0) < linestr.length())
		{
			//find the name part
			std::string::size_type equalpos = linestr.find("=", 0);
			std::string name = linestr.substr(0, equalpos);
			equalpos++;
			std::string val = linestr.substr(equalpos, linestr.length() - equalpos);
			name = Trim(name);
			val = Trim(val);

			//only continue if valid
			if (name.length() > 0 && val.length() > 0)
			{
				section->second[name] = val;
			}
			else if (!SUPPRESS_ERROR)
			{
				//std::cout << "a line started with an equal sign or ended with an equal sign:" << std::endl
				//          << linestr << std::endl;
				return false;
			}
		}
		else if (linestr.find("include ") == 0)
		{
			//configfile include
			std::string dir;
			std::string relpath = linestr.erase(0, 8);
			std::string::size_type pos = filename.rfind('/');
			if (pos != std::string::npos) dir = filename.substr(0, pos);
			std::string path = GetAbsolutePath(dir, relpath);
			bool include_load_success = Load(path);
			if (!SUPPRESS_ERROR && !include_load_success)
			{
				//std::cout << "the included file failed to load, bail" << std::endl;
				return false;
			}
		}
		else
		{
			//section header
			std::string section_name;
			section_name = Strip(linestr, '[');
			section_name = Strip(section_name, ']');
			section_name = Trim(section_name);

			// subsection
			size_t n = section_name.rfind('.');
			if (n != std::string::npos)
			{
				std::string parent = section_name.substr(0, n);
				std::string child = section_name.substr(n+1);

				/*
				SECTIONMAP::const_iterator parent_iter = sections.find(parent);
				if (!SUPPRESS_ERROR && (parent_iter == sections.end()))
				{
					std::cout << "warning: parent section " << parent << " doesn't exist. adding an empty one." << std::endl;
					return false;
				}

				SECTION::const_iterator child_iter = parent_iter->second.find(child);
				if (!SUPPRESS_ERROR && (child_iter != parent_iter->second.end()))
				{
					std::cout << "child already exists, this must be a duplicate section. error" << std::endl;
					return false;
				}
				*/
				sections[parent][child] = section_name;
			}
			/*
			SECTIONMAP::const_iterator already_exists = sections.find(section_name);
			if (!SUPPRESS_ERROR && (already_exists != sections.end()))
			{
				std::cout << "section " << section_name << " already exists, duplicate section in the file, error" << std::endl;
				return false;
				/// this shouldn't be an error case because included files will import sections.
				/// find a way to mark which sections were included, or keep a list of sections imported during this load?
				/// or perhaps just don't worry about it?
			}
			*/
			section = sections.insert(std::pair<std::string, SECTION>(section_name, SECTION())).first;
		}
	}

	return true;
}
Ejemplo n.º 12
0
   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, see
   <http://www.gnu.org/licenses/>.  */

#include "nacl-interfaces.h"

#define PASTE(a, b)     PASTE_1 (a, b)
#define PASTE_1(a, b)   a##b
#define STRINGIFY(x)    STRINGIFY_1 (x)
#define STRINGIFY_1(x)  #x

#if IS_IN (rtld) && PASTE (MODULE_, INTERFACE_MODULE) != MODULE_rtld
# error "This interface is also needed in rtld."
#endif

#define SECTION(which) \
  section ("nacl_"  STRINGIFY (INTERFACE_CATEGORY) "_interface_" #which)

static const struct nacl_interface PASTE (desc_, INTERFACE_TYPE)
  __attribute__ ((used, SECTION (names))) =
{
  .table_size = sizeof (struct INTERFACE_TYPE),
  .namelen = sizeof INTERFACE_STRING,
  .name = INTERFACE_STRING
};

struct INTERFACE_TYPE PASTE (__, INTERFACE_TYPE)
  __attribute__ ((SECTION (tables)));
PASTE (INTERFACE_MODULE, _hidden_data_def) (PASTE (__, INTERFACE_TYPE))
Ejemplo n.º 13
0
PHPAPI void php_print_info(int flag)
{
	char **env,*tmp1,*tmp2;
	char *php_uname;
	int expose_php = INI_INT("expose_php");
	time_t the_time;
	struct tm *ta, tmbuf;
	ELS_FETCH();
	SLS_FETCH();

	the_time = time(NULL);
	ta = php_localtime_r(&the_time, &tmbuf);

	PUTS("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n<html>\n");

	if (flag & PHP_INFO_GENERAL) {
		char *zend_version = get_zend_version();

		php_uname = php_get_uname();
		PUTS("<head>");
		php_info_print_style();
		PUTS("<title>phpinfo()</title></head><body>");

		php_info_print_box_start(1);
		if (expose_php) {
			PUTS("<a href=\"http://www.php.net/\"><img src=\"");
			if (SG(request_info).request_uri) {
				PUTS(SG(request_info).request_uri);
			}
			if ((ta->tm_mon==3) && (ta->tm_mday==1)) {
				PUTS("?="PHP_EGG_LOGO_GUID"\" border=0 align=\"right\" alt=\"Thies!\"></a>");
			} else {
				PUTS("?="PHP_LOGO_GUID"\" border=0 align=\"right\" alt=\"PHP Logo\"></a>");
			}
		}
		php_printf("<H1>PHP Version %s</H1>\n", PHP_VERSION);
		php_info_print_box_end();
		php_info_print_table_start();
		php_info_print_table_row(2, "System", php_uname );
		php_info_print_table_row(2, "Build Date", __DATE__ );
#ifdef CONFIGURE_COMMAND
		php_info_print_table_row(2, "Configure Command", CONFIGURE_COMMAND );
#endif
		if (sapi_module.pretty_name) {
			php_info_print_table_row(2, "Server API", sapi_module.pretty_name );
		}

#ifdef VIRTUAL_DIR
		php_info_print_table_row(2, "Virtual Directory Support", "enabled" );
#else
		php_info_print_table_row(2, "Virtual Directory Support", "disabled" );
#endif

		php_info_print_table_row(2, "Configuration File (php.ini) Path", php_ini_opened_path?php_ini_opened_path:PHP_CONFIG_FILE_PATH);

#if ZEND_DEBUG
		php_info_print_table_row(2, "ZEND_DEBUG", "enabled" );
#else
		php_info_print_table_row(2, "ZEND_DEBUG", "disabled" );
#endif

#ifdef ZTS
		php_info_print_table_row(2, "Thread Safety", "enabled" );
#else
		php_info_print_table_row(2, "Thread Safety", "disabled" );
#endif

#if HAVE_PHP_STREAM
		php_info_print_table_row(2, "Experimental PHP Streams", "enabled");
#endif
		
		php_info_print_table_end();

		/* Zend Engine */
		php_info_print_box_start(0);
		if (expose_php) {
			PUTS("<a href=\"http://www.zend.com/\"><img src=\"");
			if (SG(request_info).request_uri) {
				PUTS(SG(request_info).request_uri);
			}
			PUTS("?="ZEND_LOGO_GUID"\" border=\"0\" align=\"right\" alt=\"Zend logo\"></a>\n");
		}
		php_printf("This program makes use of the Zend scripting language engine:<BR>");
		zend_html_puts(zend_version, strlen(zend_version));
		php_printf("</BR>\n");
		php_info_print_box_end();
		efree(php_uname);
	}

	if ((flag & PHP_INFO_CREDITS) && expose_php) {	
		php_info_print_hr();
		PUTS("<h1 align=\"center\"><a href=\"");
		if (SG(request_info).request_uri) {
			PUTS(SG(request_info).request_uri);
		}
		PUTS("?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000\">");
		PUTS("PHP 4.0 Credits");
		PUTS("</a></h1>\n");
	}

	zend_ini_sort_entries(ELS_C);

	if (flag & PHP_INFO_CONFIGURATION) {
		php_info_print_hr();
		PUTS("<h1 align=\"center\">Configuration</h1>\n");
		SECTION("PHP Core\n");
		display_ini_entries(NULL);
	}

	if (flag & PHP_INFO_MODULES) {
		int show_info_func;

		show_info_func = 1;
		zend_hash_apply_with_argument(&module_registry, (int (*)(void *, void *)) _display_module_info, &show_info_func);

		SECTION("Additional Modules");
		php_info_print_table_start();
		show_info_func = 0;
		zend_hash_apply_with_argument(&module_registry, (int (*)(void *, void *)) _display_module_info, &show_info_func);
		php_info_print_table_end();
	}

	if (flag & PHP_INFO_ENVIRONMENT) {
		SECTION("Environment");
		php_info_print_table_start();
		php_info_print_table_header(2, "Variable", "Value");
		for (env=environ; env!=NULL && *env !=NULL; env++) {
			tmp1 = estrdup(*env);
			if (!(tmp2=strchr(tmp1,'='))) { /* malformed entry? */
				efree(tmp1);
				continue;
			}
			*tmp2 = 0;
			tmp2++;
			php_info_print_table_row(2, tmp1, tmp2);
			efree(tmp1);
		}
		php_info_print_table_end();
	}

	if (flag & PHP_INFO_VARIABLES) {
		pval **data;

		SECTION("PHP Variables");

		php_info_print_table_start();
		php_info_print_table_header(2, "Variable", "Value");
		if (zend_hash_find(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void **) &data) != FAILURE) {
			php_info_print_table_row(2, "PHP_SELF", (*data)->value.str.val);
		}
		if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_TYPE", sizeof("PHP_AUTH_TYPE"), (void **) &data) != FAILURE) {
			php_info_print_table_row(2, "PHP_AUTH_TYPE", (*data)->value.str.val);
		}
		if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_USER", sizeof("PHP_AUTH_USER"), (void **) &data) != FAILURE) {
			php_info_print_table_row(2, "PHP_AUTH_USER", (*data)->value.str.val);
		}
		if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE) {
			php_info_print_table_row(2, "PHP_AUTH_PW", (*data)->value.str.val);
		}
		php_print_gpcse_array("HTTP_GET_VARS", sizeof("HTTP_GET_VARS")-1 ELS_CC);
		php_print_gpcse_array("HTTP_POST_VARS", sizeof("HTTP_POST_VARS")-1 ELS_CC);
		php_print_gpcse_array("HTTP_POST_FILES", sizeof("HTTP_POST_FILES")-1 ELS_CC);
		php_print_gpcse_array("HTTP_COOKIE_VARS", sizeof("HTTP_COOKIE_VARS")-1 ELS_CC);
		php_print_gpcse_array("HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS")-1 ELS_CC);
		php_print_gpcse_array("HTTP_ENV_VARS", sizeof("HTTP_ENV_VARS")-1 ELS_CC);
		php_info_print_table_end();
	}

	if (flag & PHP_INFO_LICENSE) {
		SECTION("PHP License");
		php_info_print_box_start(0);
		PUTS("<P>\n");
		PUTS("This program is free software; you can redistribute it and/or modify ");
		PUTS("it under the terms of the PHP License as published by the PHP Group ");
		PUTS("and included in the distribution in the file:  LICENSE\n");
		PUTS("</P>\n");
		PUTS("<P>");
		PUTS("This program is distributed in the hope that it will be useful, ");
		PUTS("but WITHOUT ANY WARRANTY; without even the implied warranty of ");
		PUTS("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
		PUTS("</P>\n");
		PUTS("<P>");
		PUTS("If you did not receive a copy of the PHP license, or have any questions about ");
		PUTS("PHP licensing, please contact [email protected].\n");
		PUTS("</P>\n");
		php_info_print_box_end();
	}

	PUTS("</BODY></HTML>");
}