summaryrefslogtreecommitdiffstats
path: root/source/lib/system.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-09-26 06:27:54 +0000
committerJeremy Allison <jra@samba.org>2004-09-26 06:27:54 +0000
commit3bcf619e73603bde12d9b9abfa65ac27b4b69ba6 (patch)
tree1753602648ba306854e746face300d72b862c9a8 /source/lib/system.c
parent51e994a49c4feb916a608f6782b75c3618fb88a7 (diff)
downloadsamba-3bcf619e73603bde12d9b9abfa65ac27b4b69ba6.tar.gz
samba-3bcf619e73603bde12d9b9abfa65ac27b4b69ba6.tar.xz
samba-3bcf619e73603bde12d9b9abfa65ac27b4b69ba6.zip
r2651: Added 'stat' command to smbclient to exercise the UNIX_FILE_BASIC
info level. Outputs data on the file in the same format the the stat command in Linux. Should be useful to people wanting to learn how to parse the UNIX extension output. Yes I will add the docs later :-). Jeremy.
Diffstat (limited to 'source/lib/system.c')
-rw-r--r--source/lib/system.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/lib/system.c b/source/lib/system.c
index a0007ec83cd..b27ac5c00ad 100644
--- a/source/lib/system.c
+++ b/source/lib/system.c
@@ -1580,3 +1580,29 @@ int sys_fsetxattr (int filedes, const char *name, const void *value, size_t size
return -1;
#endif
}
+
+/****************************************************************************
+ Return the major devicenumber for UNIX extensions.
+****************************************************************************/
+
+uint32 unix_dev_major(SMB_DEV_T dev)
+{
+#if defined(HAVE_DEVICE_MAJOR_FN)
+ return (uint32)major(dev);
+#else
+ return (uint32)(dev >> 8);
+#endif
+}
+
+/****************************************************************************
+ Return the minor devicenumber for UNIX extensions.
+****************************************************************************/
+
+uint32 unix_dev_minor(SMB_DEV_T dev)
+{
+#if defined(HAVE_DEVICE_MINOR_FN)
+ return (uint32)minor(dev);
+#else
+ return (uint32)(dev & 0xff);
+#endif
+}