cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: System variables & cURL

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 19 Mar 2002 00:13:42 +0100 (MET)

On Mon, 18 Mar 2002, Stuart Halliday wrote:

> Why not make cURL place the exit code into a System variable so that a
> program or Script can simply read it?

Simple answer: because that's not portable!

The longer answer follows below.

> I've been a particular 'fan' of cURL for some time. I've been amazed at the
> sheer versatility of this program and I managed to get a RISC OS Programmer
> (Michael Curtis http://homepages.ihug.co.nz/~jamjars/michael/ ) to port
> V7.9.2 of cURL to the ARM/StrongARM 110 based processor Operating System -
> RISC OS.

I was in touch with Michael Curtis last year, and there are files in the
release archive that are meant to make it easier to build curl out-of-the-box
on RISC OS.

> I've been bug testing it and one particular aspect of cURL I find isn't as
> easy to use as I think it could be.
>
> The -w option allows the user of cURL to finds out valuable information of
> a connection. This is great and extremely useful. However this information
> is not easy to extract from cURL.

This is actully a matter of what system and environment you're using.

> 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? :-)

I can't speak for DOS/win32, but in unix and thus Linux, it isn't possible at
all (as Nico Baggus already explained).

> I asked the RISC OS cURL porter to add this functionality to cURL and
> whilst he could, he said he'd rather I discuss it with the cURL developers
> direct because if he did it himself he would be forever patching it. Best
> to see if the cURL developers would be willing to add it themselves.
>
> So is this a valid suggestion?
>
> Could information stored from a cURL session be stored into System
> Variables?

I would have no problems with adding a piece of code that would make this
happen for users of the RISC OS version of curl, or in fact any version of
curl where this behavior makes sense and is generally seen as "the way to do
it".

curl runs on so many platforms, it is impossible to make everything apply to
and work on all of them. Although I want curl to work as a good tool on as
many operating systems as possible.

I only have the condition that the code that does it, should be written nice
and clean, so that if there are more operating systems that want a similar
feature we could make those share the bigger parts of the code.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2002-03-19