Fixed uint64_t printf.
This commit is contained in:
parent
8faefc0a8a
commit
b5cd8fe120
@ -20,12 +20,15 @@
|
|||||||
#ifdef HAVE_NETINET_IN_H
|
#ifdef HAVE_NETINET_IN_H
|
||||||
# include <netinet/in.h>
|
# include <netinet/in.h>
|
||||||
#endif
|
#endif
|
||||||
# ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_ARPA_INET_H
|
#ifdef HAVE_ARPA_INET_H
|
||||||
# include <arpa/inet.h>
|
# include <arpa/inet.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_INTTYPES_H
|
||||||
|
# include <inttypes.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -33,6 +36,22 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
/* last resort for systems not defining PRIu64 in inttypes.h */
|
||||||
|
#ifndef __PRI64_PREFIX
|
||||||
|
#ifdef WIN32
|
||||||
|
#define __PRI64_PREFIX "I64"
|
||||||
|
#else
|
||||||
|
#if __WORDSIZE == 64
|
||||||
|
#define __PRI64_PREFIX "l"
|
||||||
|
#else
|
||||||
|
#define __PRI64_PREFIX "ll"
|
||||||
|
#endif /* __WORDSIZE */
|
||||||
|
#endif /* WIN32 */
|
||||||
|
#endif /* !__PRI64_PREFIX */
|
||||||
|
#ifndef PRIu64
|
||||||
|
#define PRIu64 __PRI64_PREFIX "u"
|
||||||
|
#endif /* PRIu64 */
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
unsigned long hostaddr;
|
unsigned long hostaddr;
|
||||||
@ -186,13 +205,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(attrs.flags & LIBSSH2_SFTP_ATTR_SIZE) {
|
if(attrs.flags & LIBSSH2_SFTP_ATTR_SIZE) {
|
||||||
/* attrs.filesize is an uint64_t according to
|
printf("%8" PRIu64 " ", attrs.filesize);
|
||||||
the docs but there is no really good and
|
|
||||||
portable 64bit type for C before C99, and
|
|
||||||
correspondingly there was no good printf()
|
|
||||||
option for it... */
|
|
||||||
|
|
||||||
printf("%8lld ", attrs.filesize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s\n", mem);
|
printf("%s\n", mem);
|
||||||
|
@ -26,6 +26,9 @@
|
|||||||
#ifdef HAVE_ARPA_INET_H
|
#ifdef HAVE_ARPA_INET_H
|
||||||
# include <arpa/inet.h>
|
# include <arpa/inet.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_INTTYPES_H
|
||||||
|
# include <inttypes.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -33,6 +36,22 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
/* last resort for systems not defining PRIu64 in inttypes.h */
|
||||||
|
#ifndef __PRI64_PREFIX
|
||||||
|
#ifdef WIN32
|
||||||
|
#define __PRI64_PREFIX "I64"
|
||||||
|
#else
|
||||||
|
#if __WORDSIZE == 64
|
||||||
|
#define __PRI64_PREFIX "l"
|
||||||
|
#else
|
||||||
|
#define __PRI64_PREFIX "ll"
|
||||||
|
#endif /* __WORDSIZE */
|
||||||
|
#endif /* WIN32 */
|
||||||
|
#endif /* !__PRI64_PREFIX */
|
||||||
|
#ifndef PRIu64
|
||||||
|
#define PRIu64 __PRI64_PREFIX "u"
|
||||||
|
#endif /* PRIu64 */
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
unsigned long hostaddr;
|
unsigned long hostaddr;
|
||||||
@ -193,13 +212,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(attrs.flags & LIBSSH2_SFTP_ATTR_SIZE) {
|
if(attrs.flags & LIBSSH2_SFTP_ATTR_SIZE) {
|
||||||
/* attrs.filesize is an uint64_t according to
|
printf("%8" PRIu64 " ", attrs.filesize);
|
||||||
the docs but there is no really good and
|
|
||||||
portable 64bit type for C before C99, and
|
|
||||||
correspondingly there was no good printf()
|
|
||||||
option for it... */
|
|
||||||
|
|
||||||
printf("%8lld ", attrs.filesize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s\n", mem);
|
printf("%s\n", mem);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user