cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: System variables & cURL was Re: --stderr in curl 7.9.3 for win32

From: Nico Baggus <nico_baggus_at_compuserve.com>
Date: Mon, 18 Mar 2002 22:58:51 +0100

>Under RISC OS a commandline program would simply write important
>information like the value of 'http_code' for example into a System
>Variable called 'curl_http_code' to be read at the programmers leisure.

>DOS/win32 programs do this too surely and I'm sure Linux programs are in
>the same boat? Or is there something about System Variables that I'm not
>aware of on these Platforms? :-)

Well, Dos can do this through a lot of trickery because there is no
separation
between processes. Windows becomes allready a lot harder to do, if possible.
VMS is no problem, the usermode code is more or less run as a subroutine
from the command interpreter, and a call-back is supplied to pass stuff back
to the
interpreter or to ask it to do something usefull. (if wanted/needed).

Unix is quite different, the environment variables are kept in a process
private
data array, location unknown, and a child process just gets a copy of it.
A program like a shell can (and will) keep several of those arrays
f.e. the one that is internal, en the one that is `exported' (i.e.
inheritable
by a child proces).
So to pass variables to a shell you sometimes have to escape to some `weird'
constructions
like progams printing stuff to the standard output like "export TERM=xxyyxx;
export TZ=someting..."
and have the program called like : eval `tset -sQ` (use back ticks) there.
just run the tset program alone wihtout `` and eval to show my point.

Regards,
Nico Baggus
Received on 2002-03-18