X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2Fnfsclient-sync.c;h=29a4daf3dc9c24e3a7f53532155624ff622f3c3f;hb=5245608a6587cf6b5279ffc4fde701d8dce23bf3;hp=4bd2c0b942714b26d4c72ee8305842ecdec1b5f2;hpb=a41dbfe25ad6eebb1a5bc976fc2ed7f8591f07d2;p=deb_libnfs.git diff --git a/examples/nfsclient-sync.c b/examples/nfsclient-sync.c index 4bd2c0b..29a4daf 100644 --- a/examples/nfsclient-sync.c +++ b/examples/nfsclient-sync.c @@ -20,28 +20,35 @@ /* 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 #include -#include #include -#include #ifndef AROS #include #endif #endif -#ifdef AROS -#include "aros_compat.h" +#ifdef HAVE_UNISTD_H +#include #endif - + #include #include #include -#include #include #include #include @@ -156,7 +163,7 @@ int main(int argc, char *argv[]) ret = nfs_opendir(nfs, "/", &nfsdir); if (ret != 0) { - printf("Failed to opendir(\"/\")\n", nfs_get_error(nfs)); + printf("Failed to opendir(\"/\") %s\n", nfs_get_error(nfs)); exit(10); } while((nfsdirent = nfs_readdir(nfs, nfsdir)) != NULL) { @@ -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; @@ -203,7 +212,7 @@ int main(int argc, char *argv[]) "-w"[!!(st.st_mode & S_IWOTH)], "-x"[!!(st.st_mode & S_IXOTH)] ); - printf(" %2d", st.st_nlink); + printf(" %2d", (int)st.st_nlink); printf(" %5d", st.st_uid); printf(" %5d", st.st_gid); printf(" %12" PRId64, st.st_size);