From 49aeaf04138e0fe90f7c691d568ff0baa2454cbe Mon Sep 17 00:00:00 2001
From: "Craig A. Berry" <craigberry@mac.com>
Date: Sat, 12 Mar 2016 18:32:21 -0600
Subject: [PATCH 2/5] VMS can't use %zd for off_t format.

%z is a C99-ism that VMS doesn't currently have; even though the
compiler is C99-compliant, the library isn't quite.  The off_t used
for the st_size element of the stat can be 32-bit or 64-bit, so
detect what we've got and pick a format accordingly.
---
 include/libssh2.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/libssh2.h b/include/libssh2.h
index c157757..9ef9ff1 100644
--- a/include/libssh2.h
+++ b/include/libssh2.h
@@ -202,7 +202,16 @@ typedef off_t libssh2_struct_stat_size;
 #endif
 
 #ifndef LIBSSH2_STRUCT_STAT_SIZE_FORMAT
-#  define LIBSSH2_STRUCT_STAT_SIZE_FORMAT      "%zd"
+#  ifdef __VMS
+/* We have to roll our own format here because %z is a C99-ism we don't have. */
+#    if __USE_OFF64_T || __USING_STD_STAT
+#      define LIBSSH2_STRUCT_STAT_SIZE_FORMAT      "%Ld"
+#    else
+#      define LIBSSH2_STRUCT_STAT_SIZE_FORMAT      "%d"
+#    endif
+#  else
+#    define LIBSSH2_STRUCT_STAT_SIZE_FORMAT      "%zd"
+#  endif
 typedef struct stat libssh2_struct_stat;
 typedef off_t libssh2_struct_stat_size;
 #endif
-- 
2.2.1


