[Oberon] obc GetEnv - Got it!

Jan Verhoeven jan at verhoeven272.nl
Wed Nov 24 19:46:07 CET 2010


On Wednesday 24 November 2010 19:21:06 Duke Normandin wrote:
> Hi....
>
> I had an out-dated OBC pdf doc file. I now see:
>
> [quote]
> PROCEDURE GetEnv * (name : ARRAY OF CHAR; VAR s : ARRAY OF CHAR) IS
> "Args_GetEnv";
> fetch an environment variable into a string buffer
> [/quote]

I'm on the list.... Again.

> However, as you know, I need to get at the Env. Vars, STDIN and
> STDOUT. I don't think OBC is up to the task.  

stdin and stdout are defined in 'Files'.
See http://fruttenboel.verhoeven272.nl/obc/obcdefs.html.gz

When a program is running on the console, the GetEnv will fetch the 
normal env vars that you can also see with the echo command.
When a program is ran by Apache as a CGI program, the Env Vars are the 
actual CGI vars. That's the neat part and the tricky part.

On your Linux system (I use Slackware) make sure you have Apache running 
and configured well. Then, in your /var/www/htdocs directory make sure 
you have the righjt symlinks. AND, your CGI programs NEED to reside in 
the /va/www/cgi-bin directory.
If you use a candycane Linux your mileage will vary and all folders will 
be named differently. Still, ther're all mentioned in the Apache config 
file.

jan at Beryllium:~$ ls -l /var/www/htdocs/
total 0
lrwxrwxrwx 1 root root 30 2010-07-01 01:11 
MHCdoc -> /home/com.mhccorp/mhc/mod/doc//

lrwxrwxrwx 1 root root 32 2009-02-20 22:59 
familie -> /home/jan/internet/verhoeven272//

lrwxrwxrwx 1 root root 27 2010-08-22 19:21 
fotos -> /home/jan/Keep/Jpg/Olympus//

lrwxrwxrwx 1 root root 31 2009-02-20 23:00 
fruttenboel -> /home/jan/internet/fruttenboel//

lrwxrwxrwx 1 root root 19 2009-02-20 22:59 net -> /home/jan/internet//

lrwxrwxrwx 1 root root 24 2009-06-29 15:49 
vedt -> /home/jan/internet/VEDT//
jan at Beryllium:~$

With these symlinks, I can have Apache serve my webpages stored on my 
local machine. When testing my pages (and CGI's) I access the webpages 
via http;//localhost/fruttenboel
These things are totally different from loading pages in your browser 
via file:///home/jan/internet/fruttenboel In the latter case, the 
browser just sees a file, not a webpage. In the latter case, the 
browser accesses a directory. When approached via Apache, Apache will 
serve the index.html file when no specific file was requested.

See also http://fruttenboel.verhoeven272.nl/cgi/testcgi.html

-- 
Met vriendelijke groeten,

Jan Verhoeven
http://www.verhoeven272.nl



More information about the Oberon mailing list