home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 8
/
amigaformatcd08.iso
/
in_the_mag
/
html_tutorial
/
cgi_qs.ada
< prev
next >
Wrap
Text File
|
1996-09-03
|
1KB
|
51 lines
-- (C) M.A.Smith University of Brighton
--
-- Permission is granted to use this code
-- provided this declaration and copyright notice remains intact.
--
-- 26 August 1995
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/html" ); 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;