Configure check for sys/time.h
[deb_libnfs.git] / examples / nfsclient-sync.c
index 4bd2c0b942714b26d4c72ee8305842ecdec1b5f2..9ca58b467c8461f97c9043d1fcc120d2edd0416c 100644 (file)
 
 /* Example program using the highlevel sync interface
  */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef AROS
+#include "aros_compat.h"
+#endif
 #ifdef WIN32
 #include "win32_compat.h"
 #pragma comment(lib, "ws2_32.lib")
 WSADATA wsaData;
+#define PRId64 "ll"
 #else
+#include <inttypes.h>
 #include <string.h>
-#include <fcntl.h>
 #include <sys/stat.h>
-#include <unistd.h>
 #ifndef AROS
 #include <sys/statvfs.h>
 #endif
 #endif
 
-#ifdef AROS
-#include "aros_compat.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
 #endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
-#include <inttypes.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -166,7 +173,7 @@ int main(int argc, char *argv[])
                        continue;
                }
 
-               snprintf(path, 1024, "%s/%s", "/", nfsdirent->name);
+               sprintf(path, "%s/%s", "/", nfsdirent->name);
                ret = nfs_stat(nfs, path, &st);
                if (ret != 0) {
                        fprintf(stderr, "Failed to stat(%s) %s\n", path, nfs_get_error(nfs));
@@ -174,7 +181,9 @@ int main(int argc, char *argv[])
                }
 
                switch (st.st_mode & S_IFMT) {
+#ifndef WIN32
                case S_IFLNK:
+#endif
                case S_IFREG:
                        printf("-");
                        break;