summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcgd <cgd@NetBSD.org>1994-04-14 03:34:13 +0000
committercgd <cgd@NetBSD.org>1994-04-14 03:34:13 +0000
commitecc12ef4198455e37d618eaf125fc5b44fbbfbd2 (patch)
tree00b0fde4b38455075d50fb1687af642d40c55c37
parent8034feb3a6e6599e9832dec0fdc9a91864649642 (diff)
fstypes will be strings soon
-rw-r--r--usr.bin/find/find.111
-rw-r--r--usr.bin/find/function.c77
2 files changed, 14 insertions, 74 deletions
diff --git a/usr.bin/find/find.1 b/usr.bin/find/find.1
index 6e431181acc..aac7f5a0299 100644
--- a/usr.bin/find/find.1
+++ b/usr.bin/find/find.1
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)find.1 8.1 (Berkeley) 6/6/93
-.\" $Id: find.1,v 1.6 1993/12/30 21:15:20 jtc Exp $
+.\" $Id: find.1,v 1.7 1994/04/14 03:34:13 cgd Exp $
.\"
.Dd June 6, 1993
.Dt FIND 1
@@ -151,13 +151,12 @@ was executed.
.It Ic -fstype Ar type
True if the file is contained in a file system of type
.Ar type .
-Currently supported types are ``local'', ``mfs'', ``nfs'', ``msdos'', ``isofs'',
-``fdesc'', ``kernfs'', ``rdonly'' and ``ufs''.
-The types ``local'' and ``rdonly'' are not specific file system types.
-The former matches any file system physically mounted on the system where
+Two special file system types are recognized: ``local'' and ``rdonly''.
+These do not describe actual file system types;
+the former matches any file system physically mounted on the system where
the
.Nm find
-is being executed and the latter matches any file system which is
+is being executed, and the latter matches any file system which is
mounted read-only.
.It Ic -group Ar gname
True if the file belongs to the group
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c
index c45465c9061..e0e3648234d 100644
--- a/usr.bin/find/function.c
+++ b/usr.bin/find/function.c
@@ -36,7 +36,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)function.c 8.1 (Berkeley) 6/6/93";*/
-static char rcsid[] = "$Id: function.c,v 1.12 1994/02/16 03:59:52 andrew Exp $";
+static char rcsid[] = "$Id: function.c,v 1.13 1994/04/14 03:34:16 cgd Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -345,6 +345,7 @@ f_fstype(plan, entry)
static int first = 1;
struct statfs sb;
static short val;
+ static char fstype[MFSNAMELEN+1];
char *p, save[2];
/* Only check when we cross mount point. */
@@ -383,7 +384,8 @@ f_fstype(plan, entry)
val = sb.f_flags;
break;
case F_MTTYPE:
- val = sb.f_type;
+ strncpy(fstype, sb.f_fstypename, MFSNAMELEN);
+ fstype[MFSNAMELEN] = '\0';
break;
default:
abort();
@@ -393,7 +395,7 @@ f_fstype(plan, entry)
case F_MTFLAG:
return (val & plan->mt_data);
case F_MTTYPE:
- return (val == plan->mt_data);
+ return (strncmp(fstype, plan->c_data, MFSNAMELEN) == 0);
default:
abort();
}
@@ -409,33 +411,6 @@ c_fstype(arg)
new = palloc(N_FSTYPE, f_fstype);
switch (*arg) {
- case 'f':
-#ifdef MOUNT_FDESC
- if (!strcmp(arg, "fdesc")) {
- new->flags = F_MTTYPE;
- new->mt_data = MOUNT_FDESC;
- return (new);
- }
-#endif
- break;
- case 'i':
-#ifdef MOUNT_ISOFS
- if (!strcmp(arg, "isofs")) {
- new->flags = F_MTTYPE;
- new->mt_data = MOUNT_ISOFS;
- return (new);
- }
-#endif
- break;
- case 'k':
-#ifdef MOUNT_KERNFS
- if (!strcmp(arg, "kernfs")) {
- new->flags = F_MTTYPE;
- new->mt_data = MOUNT_KERNFS;
- return (new);
- }
-#endif
- break;
case 'l':
if (!strcmp(arg, "local")) {
new->flags = F_MTFLAG;
@@ -443,35 +418,6 @@ c_fstype(arg)
return (new);
}
break;
- case 'm':
- if (!strcmp(arg, "mfs")) {
- new->flags = F_MTTYPE;
- new->mt_data = MOUNT_MFS;
- return (new);
- }
-#ifdef MOUNT_MSDOS
- if (!strcmp(arg, "msdos")) {
- new->flags = F_MTTYPE;
- new->mt_data = MOUNT_MSDOS;
- }
-#endif
- break;
- case 'n':
- if (!strcmp(arg, "nfs")) {
- new->flags = F_MTTYPE;
- new->mt_data = MOUNT_NFS;
- return (new);
- }
- break;
- case 'p':
-#ifdef MOUNT_PC
- if (!strcmp(arg, "pc")) {
- new->flags = F_MTTYPE;
- new->mt_data = MOUNT_PC;
- return (new);
- }
-#endif
- break;
case 'r':
if (!strcmp(arg, "rdonly")) {
new->flags = F_MTFLAG;
@@ -479,16 +425,11 @@ c_fstype(arg)
return (new);
}
break;
- case 'u':
- if (!strcmp(arg, "ufs")) {
- new->flags = F_MTTYPE;
- new->mt_data = MOUNT_UFS;
- return (new);
- }
- break;
}
- errx(1, "%s: unknown file type", arg);
- /* NOTREACHED */
+
+ new->flags = F_MTTYPE;
+ new->c_data = arg;
+ return (new);
}
/*