diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2015-10-26 22:59:23 +0100 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2015-10-26 22:59:23 +0100 |
commit | 45ddc6eda8d94a1e4fd2e380d8671a1249822ac2 (patch) | |
tree | 5efbac53bacaa87fdbd3ce65a1c5278e93028a38 /lr.c | |
parent | 84aa26871a4e29c7d5ae3faf5fca55fefab9e01c (diff) | |
download | lr-45ddc6eda8d94a1e4fd2e380d8671a1249822ac2.tar.gz lr-45ddc6eda8d94a1e4fd2e380d8671a1249822ac2.tar.xz lr-45ddc6eda8d94a1e4fd2e380d8671a1249822ac2.zip |
add fstype for Solaris
Tested on SunOS omnios 5.11 omnios-85fef88 i86pc i386 i86pc
Diffstat (limited to 'lr.c')
-rw-r--r-- | lr.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lr.c b/lr.c index 8c7892c..d7cf116 100644 --- a/lr.c +++ b/lr.c @@ -40,6 +40,7 @@ #include <errno.h> #include <fnmatch.h> #include <grp.h> +#include <limits.h> #include <pwd.h> #include <regex.h> #include <search.h> @@ -50,6 +51,11 @@ #include <time.h> #include <unistd.h> +/* For Solaris. */ +#if !defined(FNM_CASEFOLD) && defined(FNM_IGNORECASE) +#define FNM_CASEFOLD FNM_IGNORECASE +#endif + static int Dflag; static int Hflag; static int Lflag; @@ -673,6 +679,33 @@ scan_filesystems() scanned_filesystems = 1; } +#elif defined(__SVR4) +#include <sys/mnttab.h> +void +scan_filesystems() +{ + FILE *mtab; + struct mnttab mnt; + struct stat st; + + mtab = fopen("/etc/mnttab", "r"); + if (!mtab) + return; + + while (getmntent(mtab, &mnt) == 0) { + if (stat(mnt.mnt_mountp, &st) < 0) + continue; + + struct idmap *newkey = malloc(sizeof (struct idmap)); + newkey->id = st.st_dev; + newkey->name = strdup(mnt.mnt_fstype); + tsearch(newkey, &filesystems, idorder); + }; + + fclose(mtab); + + scanned_filesystems = 1; +} #elif defined(__FreeBSD__) || defined(__OpenBSD__) || (defined(__APPLE__) && defined(__MACH__)) #include <sys/param.h> #include <sys/ucred.h> |