cURL / Mailing Lists / curl-library / Single Mail

curl-library

vms_show hack explained

From: John E. Malmberg <wb8tyw_at_qsl.net>
Date: Wed, 13 Mar 2013 20:00:27 -0500

The vms_show hack can definitely be improved and simplified. I just
have not had the time to investigate it.

What is going on is that on VMS, the parameter to exit() is a packed
bitmap that encodes a pointer to a message text and also a severity code.

On exit, if that severity code is for warning or more severe level, the
message associated with the packed bitmap is displayed by the DCL shell.

This message can be suppressed by setting a bit in the bitmap, which is
done if the application has already displayed it.

Now what was done on VMS, is that the vms_show variable is being set to
indicate that an error message has been displayed.

Then on vms_special_exit() the Unix exit status is mapped to the VMS
packed exit code, and the vms_show is used to suppress the message.

But there is one more wrinkle. This VMS status code is useful for the
VMS shell, but is the wrong code for programs like bash, that may have
launched curl.

So when curl is run under Bash, it needs to encode the UNIX exit code so
that can be then decoded by Bash.

Normally this is done at compile time by mapping exit() to actually be
posix_exit() and the UNIX program does not need VMS specific code.

But curl was ported to use its own VMS specific exit codes first, and
those can not be passed to the posix_exit() routine.

So the vms_special_exit() needs to check to see which variant of exit
that it should call.

Now if we know at the time that vms_special_exit is called that any exit
status other than CURLE_OK means that an error message has been written,
there is no need to have the vms_show hack at all.

We just need to have the VMS specific wrapper to exit() handle
everything. If that a VMS specific wrapper is changed to be a macro in
a VMS header file, then this all can be hidden from the common Unix code.

One feature of the separate message file on VMS is that it can be built
as a shared image, and you can have a different shared image for
different languages, but one program executable. The VMS port of curl
does not take advantage of this, as the messages in the VMS message file
are never displayed.

Regards,
-John
wb8tyw_at_qsl.net
Personal Opinion Only

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-03-14