curl-library
[patch] 7.19.5 docs/example patches for VMS.
Date: Sun, 31 May 2009 21:47:43 -0500
These patches are needed to get these docs/examples modules to compile
on VMS.
For anyauthput.c: <stdint.h> is not present on VMS.
For debug.c and multi-debugcallback.c: VMS does not currently support
%zd and %zx format qualifiers.
For multi-debugcallback.c, passing a char value to a routine prototyped
for taking a unsigned char will cause a warning compiler diagnostic on
the HP VMS C compilers.
For ftpupload.c: On 64 bit VMS, %lld needs to be used with
CURL_SIZEOF_CURL_OFF_T is 8.
The %ld generates a compile time warning as the inline optimizer detects
the mis-match that the size does not match.
I tried to use the CURL_FORMAT_OFF_T to build the format string. This
is where I discovered that the configure script did not detect the
correct format string to use on VMS. The configure script picked %I64d
instead of %lld.
I do not know how to fix the configure script to get it right, nor could
I find any place in curl where the CURL_FORMAT_OFF_T is actually used.
Regards,
-John
wb8tyw_at_qsl.net
Personal Opinion Only
--- /src_root/curl-7.19.5/docs/examples/anyauthput.c Mon Sep 1 02:46:51 2008
+++ /lcl_root/curl-7.19.5/docs/examples/anyauthput.c Sun May 31 20:15:51 2009
@@ -13,7 +13,9 @@
#ifdef WIN32
# include <io.h>
#else
-# include <stdint.h>
+# ifndef __VMS
+# include <stdint.h>
+# endif
# include <unistd.h>
#endif
#include <sys/types.h>
--- /src_root/curl-7.19.5/docs/examples/debug.c Fri May 23 04:05:54 2008
+++ /lcl_root/curl-7.19.5/docs/examples/debug.c Sun May 31 20:29:36 2009
@@ -29,11 +29,19 @@
/* without the hex output, we can fit more on screen */
width = 0x40;
+#ifndef __VMS
fprintf(stream, "%s, %zd bytes (0x%zx)\n", text, size, size);
+#else
+ fprintf(stream, "%s, %010.10d bytes (0x%08.8x)\n", text, size, size);
+#endif
for(i=0; i<size; i+= width) {
+#ifndef __VMS
fprintf(stream, "%04zx: ", i);
+#else
+ fprintf(stream, "%04.4x: ", i);
+#endif
if(!nohex) {
/* hex not disabled, show it */
--- /src_root/curl-7.19.5/docs/examples/ftpupload.c Fri May 23 04:05:54 2008
+++ /lcl_root/curl-7.19.5/docs/examples/ftpupload.c Sun May 31 21:05:05 2009
@@ -65,7 +65,12 @@
printf("Couldnt open '%s': %s\n", LOCAL_FILE, strerror(errno));
return 1;
}
+
+#if (CURL_SIZEOF_CURL_OFF_T == 8)
+ printf("Local file size: %lld bytes.\n", file_info.st_size);
+#else
printf("Local file size: %ld bytes.\n", file_info.st_size);
+#endif
/* get a FILE * of the same file */
hd_src = fopen(LOCAL_FILE, "rb");
--- /src_root/curl-7.19.5/docs/examples/multi-debugcallback.c Fri May 23 04:05:55 2008
+++ /lcl_root/curl-7.19.5/docs/examples/multi-debugcallback.c Sun May 31 20:47:16 2009
@@ -38,11 +38,19 @@
/* without the hex output, we can fit more on screen */
width = 0x40;
+#ifndef __VMS
fprintf(stream, "%s, %zd bytes (0x%zx)\n", text, size, size);
+#else
+ fprintf(stream, "%s, %010.10d bytes (0x%08.8x)\n", text, size, size);
+#endif
for(i=0; i<size; i+= width) {
+#ifndef __VMS
fprintf(stream, "%04zx: ", i);
+#else
+ fprintf(stream, "%04.4x: ", i);
+#endif
if(!nohex) {
/* hex not disabled, show it */
@@ -74,7 +82,7 @@
static
int my_trace(CURL *handle, curl_infotype type,
- char *data, size_t size,
+ unsigned char *data, size_t size,
void *userp)
{
const char *text;
Received on 2009-06-01