/* ----------------------------------------------------------------
\n");
for (index = 1; index < argc; index++)
printf ("Argument %d : %s\n", index, argv [index]);
printf ("\n");
}
/* Print POST data variables coming from stdin, if present */
content_length = (size_t) env_get_number ("HTTP_CONTENT_LENGTH", 0);
if (content_length)
{
symbols = sym_create_table ();
if (symbols)
{
if (cgi_parse_file_vars (symbols, stdin, "", content_length) > 0)
{
printf ("\n");
sym_exec_all (symbols, dump_symbol);
printf ("\n");
}
sym_delete_table (symbols);
}
}
/* Print URL query variables coming from QUERY_STRING */
symbols = sym_create_table ();
if (symbols)
{
if (cgi_parse_query_vars (symbols,
env_get_string ("QUERY_STRING", ""), "") > 0)
{
printf ("\n");
sym_exec_all (symbols, dump_symbol);
printf ("\n");
}
sym_delete_table (symbols);
}
/* Print environment variables */
symbols = env2symb ();
if (symbols)
{
printf ("\n");
sym_exec_all (symbols, dump_symbol);
sym_delete_table (symbols);
printf ("\n");
}
curdir = get_curdir ();
printf ("Working directory: %s\n", curdir); printf ("
Current date and time: %s\n", time_str ()); printf ("\n"); mem_free (curdir); mem_assert (); return (EXIT_SUCCESS); } /* ------------------------------------------------------------------------- * This function is invoked by sym_exec_all() to process each item in * the symbol table. It always returns TRUE to keep sym_exec_all() going. */ static Bool dump_symbol (SYMBOL *symbol, ...) { printf ("%-20s = %s\n", symbol-> name, symbol-> value); return (TRUE); } /* ------------------------------------------------------------------------- * time_str * * Returns the current date and time formatted as: "yy/mm/dd hh:mm:ss". * The formatted time is in a static string that each call overwrites. */ static char * time_str (void) { static char formatted_time [18]; time_t time_secs; struct tm *time_struct; time_secs = time (NULL); time_struct = localtime (&time_secs); sprintf (formatted_time, "%2d/%02d/%02d %2d:%02d:%02d", time_struct-> tm_year + 1900, time_struct-> tm_mon + 1, time_struct-> tm_mday, time_struct-> tm_hour, time_struct-> tm_min, time_struct-> tm_sec); return (formatted_time); }