- ret = nfs_access(nfs, NFSFILE, R_OK);
- if (ret != 0) {
- printf("Failed to access(%s) %s\n", NFSFILE, nfs_get_error(nfs));
+ switch (st.st_mode & S_IFMT) {
+#ifndef WIN32
+ case S_IFLNK:
+#endif
+ case S_IFREG:
+ printf("-");
+ break;
+ case S_IFDIR:
+ printf("d");
+ break;
+ case S_IFCHR:
+ printf("c");
+ break;
+ case S_IFBLK:
+ printf("b");
+ break;
+ }
+ printf("%c%c%c",
+ "-r"[!!(st.st_mode & S_IRUSR)],
+ "-w"[!!(st.st_mode & S_IWUSR)],
+ "-x"[!!(st.st_mode & S_IXUSR)]
+ );
+ printf("%c%c%c",
+ "-r"[!!(st.st_mode & S_IRGRP)],
+ "-w"[!!(st.st_mode & S_IWGRP)],
+ "-x"[!!(st.st_mode & S_IXGRP)]
+ );
+ printf("%c%c%c",
+ "-r"[!!(st.st_mode & S_IROTH)],
+ "-w"[!!(st.st_mode & S_IWOTH)],
+ "-x"[!!(st.st_mode & S_IXOTH)]
+ );
+ printf(" %2d", st.st_nlink);
+ printf(" %5d", st.st_uid);
+ printf(" %5d", st.st_gid);
+ printf(" %12" PRId64, st.st_size);
+
+ printf(" %s\n", nfsdirent->name);