[add] - list nfs servers nfsclient-sync
[deb_libnfs.git] / examples / nfsclient-sync.c
index 00e4c88042eba4a3e50553acb8e79460eb11c03d..bc19f48752c5d45be014e44f31c46e2487f6419e 100644 (file)
 
 /* Example program using the highlevel sync interface
  */
-
+#ifdef WIN32
+#include "win32_compat.h"
+#else
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/statvfs.h>
+#endif
 #define SERVER "10.1.1.27"
 #define EXPORT "/VIRTUAL"
 #define NFSFILE "/BOOKS/Classics/Dracula.djvu.truncated"
@@ -28,8 +35,6 @@
 #define _GNU_SOURCE
 
 #if defined(WIN32)
-#include <winsock2.h>
-typedef int off_t;
 #pragma comment(lib, "ws2_32.lib")
 WSADATA wsaData;
 #else
@@ -56,6 +61,21 @@ struct client {
 };
 
 
+void PrintServerList()
+{
+  struct nfs_server_list *srvrs;
+  struct nfs_server_list *srv;
+
+  srvrs = nfs_find_local_servers();
+
+  for (srv=srvrs; srv; srv = srv->next)
+  {
+      printf("Found nfs server: %s\n", srv->addr);
+
+  }
+  free_nfs_srvr_list(srvrs);
+}
+
 char buf[3*1024*1024+337];
 
 int main(int argc _U_, char *argv[] _U_)
@@ -81,6 +101,9 @@ int main(int argc _U_, char *argv[] _U_)
        client.server = SERVER;
        client.export = EXPORT;
        client.is_finished = 0;
+
+  PrintServerList();
+
        export = mount_getexports(SERVER);
        if (export != NULL) {
                printf("exports on server %s\n", SERVER);