::
cgi_qs.ada
package unix_if is
function get_env( str:in String ) return String;
end unix_if;
with Interfaces.C, Interfaces.C.Strings;
use Interfaces.C, Interfaces.C.Strings;
package body unix_if is
function get_env( str:in String ) return String is
function getenv( str:in Char_array ) return Chars_ptr;
pragma import (C, getenv, "getenv");
res : Chars_ptr;
begin
res := getenv( to_c( str, append_nul=>TRUE ) );
if res = null_PTR then
return "";
else
return value(res);
end if;
end get_env;
end unix_if;
with Simple_io, unix_if;
use Simple_io, unix_if;
procedure main is
begin
new_line;
put( "Content-type: text/plain" ); new_line(2);
put( "<HTML> " ); new_line;
put( "<HEAD> " ); new_line;
put( "</HEAD> " ); new_line;
put( "<body> " ); new_line;
put( "<P>" ); new_line;
put( "The data sent to the form processing program " ); new_line;
put( "in the environment variable QUERY_STRING is:" ); new_line;
put( "<P>" ); new_line;
put( get_env( "QUERY_STRING" ) ); new_line;
put( "<P>" ); new_line;
put( "</body> " ); new_line;
put( "</HTML> " ); new_line;
end main;
© M.A.Smith University of Brighton.
Created September 1995 last modified May 1997.
Comments, suggestions, etc.
M.A.Smith@brighton.ac.uk
*
[Home page]