curl-library
Re: [patch] 7.19.5 docs/example patches for VMS.
Date: Thu, 04 Jun 2009 23:56:43 -0500
Daniel Stenberg wrote:
> On Sun, 31 May 2009, John E. Malmberg wrote:
>
>> For debug.c and multi-debugcallback.c: VMS does not currently support
>> %zd and %zx format qualifiers.
>
> I think we should strive towards not using #ifdefs like this in the
> examples. For example, I'd much rather typecast to (int) and use mere %d
> in the fprintf() cases.
>
Makes sense.
Here is a revised patch that will build on VMS and it should build
everywhere else.
In anyauthput.c, VMS does not have the stdint.h header file, and can
compile the module with out it.
In debug.c and multi-debugcallback.c use the older format qualifiers to
get similar output.
In ftpupload.c, use the CURL_FORMAT_OFF_T macro to set the format
qualifier 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
+++ 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
+++ docs/examples/debug.c Thu Jun 4 23:08:32 2009
@@ -29,11 +29,11 @@
/* without the hex output, we can fit more on screen */
width = 0x40;
- fprintf(stream, "%s, %zd bytes (0x%zx)\n", text, size, size);
+ fprintf(stream, "%s, %010.10d bytes (0x%08.8x)\n", text, size, size);
for(i=0; i<size; i+= width) {
- fprintf(stream, "%04zx: ", i);
+ fprintf(stream, "%04.4x: ", i);
if(!nohex) {
/* hex not disabled, show it */
--- /src_root/curl-7.19.5/docs/examples/ftpupload.c Fri May 23 04:05:54 2008
+++ docs/examples/ftpupload.c Thu Jun 4 23:06:09 2009
@@ -65,7 +65,7 @@
printf("Couldnt open '%s': %s\n", LOCAL_FILE, strerror(errno));
return 1;
}
- printf("Local file size: %ld bytes.\n", file_info.st_size);
+ printf("Local file size: " CURL_FORMAT_OFF_T " bytes.\n", file_info.st_size);
/* 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
+++ docs/examples/multi-debugcallback.c Thu Jun 4 23:09:10 2009
@@ -38,11 +38,11 @@
/* without the hex output, we can fit more on screen */
width = 0x40;
- fprintf(stream, "%s, %zd bytes (0x%zx)\n", text, size, size);
+ fprintf(stream, "%s, %010.10d bytes (0x%08.8x)\n", text, size, size);
for(i=0; i<size; i+= width) {
- fprintf(stream, "%04zx: ", i);
+ fprintf(stream, "%04.4x: ", i);
if(!nohex) {
/* hex not disabled, show it */
@@ -74,7 +74,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-05