diff -urN util-linux-2.11g/mount/Makefile util-linux-2.11g-fstyp/mount/Makefile
--- util-linux-2.11g/mount/Makefile	Sat May 19 20:52:24 2001
+++ util-linux-2.11g-fstyp/mount/Makefile	Sun Jul  1 13:28:42 2001
@@ -11,9 +11,9 @@
 LINK = $(CC) $(LDFLAGS)
 
 SUID_PROGS = mount umount
-NOSUID_PROGS = swapon losetup
+NOSUID_PROGS = swapon losetup fstyp
 MAN5 = fstab.5 nfs.5
-MAN8 = mount.8 swapoff.8 swapon.8 umount.8 losetup.8
+MAN8 = mount.8 swapoff.8 swapon.8 umount.8 losetup.8 fstyp.8
 
 ifeq "$(HAVE_PIVOT_ROOT)" "yes"
 NOSUID_PROGS := $(NOSUID_PROGS) pivot_root
@@ -42,13 +42,13 @@
 %.o: %.c
 	$(COMPILE) $<
 
-mount: mount.o fstab.o sundries.o realpath.o mntent.o version.o \
-       mount_guess_fstype.o mount_by_label.o getusername.o \
+mount: mount.o fstab.o sundries.o match_fstype.o realpath.o mntent.o \
+       version.o mount_guess_fstype.o mount_by_label.o getusername.o \
        $(LIB)/setproctitle.o $(LIB)/env.o $(NFS_OBJS) $(LO_OBJS)
 	$(LINK) $^ -o $@
 
 umount: umount.o fstab.o sundries.o realpath.o mntent.o getusername.o \
-	version.o $(LIB)/env.o $(LO_OBJS)
+	match_fstype.o version.o $(LIB)/env.o $(LO_OBJS)
 	$(LINK) $^ -o $@
 
 swapon:	swapon.o version.o
@@ -60,6 +60,9 @@
 losetup: main_losetup.o $(LIB)/xstrncpy.o
 	$(LINK) $^ -o $@
 
+fstyp: fstyp.o mount_guess_fstype.o match_fstype.o version.o
+	$(LINK) $^ -o $@
+
 mount.o umount.o nfsmount.o losetup.o fstab.o realpath.o sundries.o: sundries.h
 
 mount.o umount.o fstab.o sundries.o: fstab.h
@@ -69,6 +72,8 @@
 mount.o mount_guess_fstype.o: mount_guess_fstype.h
 
 mount.o: $(LIB)/setproctitle.h
+
+mount.o umount.o fstyp.o: match_fstype.h
 
 mount.o umount.o getusername.o: getusername.h
 
diff -urN util-linux-2.11g/mount/fstyp.8 util-linux-2.11g-fstyp/mount/fstyp.8
--- util-linux-2.11g/mount/fstyp.8	Wed Dec 31 19:00:00 1969
+++ util-linux-2.11g-fstyp/mount/fstyp.8	Sun Jul  1 13:02:59 2001
@@ -0,0 +1,77 @@
+.\" Copyright (c) 2001 Martin K. Petersen <mkp@mkp.net>
+.\"
+.\" This is free documentation; you can redistribute it and/or
+.\" modify it under the terms of the GNU General Public License as
+.\" published by the Free Software Foundation; either version 2 of
+.\" the License, or (at your option) any later version.
+.\"
+.\" The GNU General Public License's references to "object code"
+.\" and "executables" are to be interpreted as the output of any
+.\" document formatting or typesetting system, including
+.\" intermediate and printed output.
+.\"
+.\" This manual is distributed in the hope that it will be useful,
+.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+.\" GNU General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU General Public
+.\" License along with this manual; if not, write to the Free
+.\" Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
+.\" USA.
+.\"
+.TH FSTYP 8 "21 March 2000" "Linux 2.2" "Linux Programmer's Manual"
+.SH NAME
+fstyp \- identify file systems
+.SH SYNOPSIS
+.BI "fstyp " "device"
+.LP
+.BI "fstyp [\-hV]"
+.SH DESCRIPTION
+The
+.B fstyp
+command tries to guess the filesystem type of a device and outputs its
+findings.
+
+If a filesystem can be successfully identified, its name is printed
+and 0 returned.
+
+If no known superblocks can be found,
+.B fstyp
+prints an empty string and returns a non-zero value.
+
+.B fstyp
+is often used in backup scripts to pick
+.B dump
+and
+.B restore
+commands appropriate for the filesystem type.
+
+Since
+.B fstyp
+relies on heuristics to identify the filesystem, there is no guarantee
+for correct results.  
+
+The detection algorithm used in
+.B fstyp 
+is the same as in the
+.BR mount(8)
+command.
+
+.SH OPTIONS
+.TP
+.B \-V
+Print version and exit.
+.TP
+.B \-h
+Print help message and exit.
+
+.SH FILES
+.I /proc/filesystems
+List of supported filesystem types.
+
+.SH "SEE ALSO"
+.BR umount (2),
+.BR mount (8),
+.BR dump (8),
+.BR restore (8)
diff -urN util-linux-2.11g/mount/fstyp.c util-linux-2.11g-fstyp/mount/fstyp.c
--- util-linux-2.11g/mount/fstyp.c	Wed Dec 31 19:00:00 1969
+++ util-linux-2.11g-fstyp/mount/fstyp.c	Sun Jul  1 13:25:41 2001
@@ -0,0 +1,78 @@
+/*
+ * fstyp.c
+ *
+ * Copyright (C) 2000, 2001 Martin K. Petersen <mkp@mkp.net>
+ *
+ * This program is free software; you can redistribute it and/or modify 
+ * it under the terms of the GNU General Public License as published by 
+ * the Free Software Foundation; either version 2 of the License, or 
+ * (at your option) any later version. 
+ * 
+ * This program is distributed in the hope that it will be useful, 
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
+ * GNU General Public License for more details. 
+ * 
+ * You should have received a copy of the GNU General Public License 
+ * along with this program; if not, write to the Free Software 
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */ 
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <getopt.h>
+
+#include "mount_guess_fstype.h"
+#include "nls.h"
+
+
+extern char version[];
+int verbose = 0;
+
+
+void usage (void);
+
+
+void
+usage (void)
+{
+	fprintf (stderr, "Usage: fstyp [-hV]\n       fstyp special\n");
+	exit (EXIT_FAILURE);
+}
+
+
+int
+main (int argc, char **argv) 
+{
+	char opt, *type = NULL;
+
+	setlocale(LC_ALL, "");
+	bindtextdomain(PACKAGE, LOCALEDIR);
+	textdomain(PACKAGE);
+
+	while ((opt = getopt(argc, argv, "hV")) != EOF) {
+		switch (opt) {
+		case 'V':
+			fprintf (stderr, "fstyp: %s\n", version);
+			exit (EXIT_FAILURE);
+		default:
+			usage();
+		}
+	}
+
+	if (argc != 2) 
+		usage();
+	
+	type = fstype (argv[1]);
+
+	if (type) {
+		fprintf (stdout, "%s\n", type);
+		exit (EXIT_SUCCESS);
+	}
+		
+	exit (EXIT_FAILURE);
+}
diff -urN util-linux-2.11g/mount/match_fstype.c util-linux-2.11g-fstyp/mount/match_fstype.c
--- util-linux-2.11g/mount/match_fstype.c	Wed Dec 31 19:00:00 1969
+++ util-linux-2.11g-fstyp/mount/match_fstype.c	Sun Jul  1 13:28:02 2001
@@ -0,0 +1,46 @@
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <mntent.h>
+#include "match_fstype.h"
+
+
+/* True if fstypes match.  Null *TYPES means match anything,
+   except that swap types always return false. */
+/* Accept nonfs,proc,devpts and nonfs,noproc,nodevpts
+   with the same meaning. */
+int
+matching_type (const char *type, const char *types) {
+     int no;			/* negated types list */
+     int len;
+     const char *p;
+
+     if (streq (type, MNTTYPE_SWAP))
+	  return 0;
+     if (types == NULL)
+	  return 1;
+
+     no = 0;
+     if (!strncmp(types, "no", 2)) {
+	  no = 1;
+	  types += 2;
+     }
+
+     /* Does type occur in types, separated by commas? */
+     len = strlen(type);
+     p = types;
+     while(1) {
+	     if (!strncmp(p, "no", 2) && !strncmp(p+2, type, len) &&
+		 (p[len+2] == 0 || p[len+2] == ','))
+		     return 0;
+	     if (strncmp(p, type, len) == 0 &&
+		 (p[len] == 0 || p[len] == ','))
+		     return !no;
+	     p = index(p,',');
+	     if (!p)
+		     break;
+	     p++;
+     }
+     return no;
+}
+
diff -urN util-linux-2.11g/mount/match_fstype.h util-linux-2.11g-fstyp/mount/match_fstype.h
--- util-linux-2.11g/mount/match_fstype.h	Wed Dec 31 19:00:00 1969
+++ util-linux-2.11g-fstyp/mount/match_fstype.h	Sun Jul  1 13:30:46 2001
@@ -0,0 +1,3 @@
+#define streq(s, t)     (strcmp ((s), (t)) == 0)
+
+int matching_type (const char *type, const char *types);
diff -urN util-linux-2.11g/mount/mount.c util-linux-2.11g-fstyp/mount/mount.c
--- util-linux-2.11g/mount/mount.c	Thu Jun  7 19:24:28 2001
+++ util-linux-2.11g-fstyp/mount/mount.c	Sun Jul  1 13:28:57 2001
@@ -57,6 +57,7 @@
 
 #include "mount_constants.h"
 #include "sundries.h"
+#include "match_fstype.h"
 #include "mntent.h"
 #include "fstab.h"
 #include "lomount.h"
diff -urN util-linux-2.11g/mount/mount_guess_fstype.c util-linux-2.11g-fstyp/mount/mount_guess_fstype.c
--- util-linux-2.11g/mount/mount_guess_fstype.c	Tue Jun 26 19:13:22 2001
+++ util-linux-2.11g-fstyp/mount/mount_guess_fstype.c	Sun Jul  1 13:27:57 2001
@@ -35,6 +35,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include "linux_fs.h"
+#include "match_fstype.h"
 #include "mount_guess_fstype.h"
 #include "sundries.h"		/* for xstrdup */
 #include "nls.h"
@@ -146,7 +147,7 @@
 		      strlen ( REISER2FS_SUPER_MAGIC_STRING)));
 }
 
-static char *
+char *
 fstype(const char *device) {
     int fd;
     char *type = NULL;
diff -urN util-linux-2.11g/mount/mount_guess_fstype.h util-linux-2.11g-fstyp/mount/mount_guess_fstype.h
--- util-linux-2.11g/mount/mount_guess_fstype.h	Mon May 15 08:05:01 2000
+++ util-linux-2.11g-fstyp/mount/mount_guess_fstype.h	Sun Jul  1 13:02:59 2001
@@ -8,6 +8,7 @@
 
 extern int verbose;
 
+char *fstype(const char *device);
 char *guess_fstype_from_superblock(const char *device);
 int procfsloop(int (*mount_fn)(struct mountargs *), struct mountargs *args,
 	       char **type);
diff -urN util-linux-2.11g/mount/sundries.c util-linux-2.11g-fstyp/mount/sundries.c
--- util-linux-2.11g/mount/sundries.c	Mon Jun 11 08:18:54 2001
+++ util-linux-2.11g-fstyp/mount/sundries.c	Sun Jul  1 13:19:24 2001
@@ -146,45 +146,6 @@
      exit (err);
 }
 
-/* True if fstypes match.  Null *TYPES means match anything,
-   except that swap types always return false. */
-/* Accept nonfs,proc,devpts and nonfs,noproc,nodevpts
-   with the same meaning. */
-int
-matching_type (const char *type, const char *types) {
-     int no;			/* negated types list */
-     int len;
-     const char *p;
-
-     if (streq (type, MNTTYPE_SWAP))
-	  return 0;
-     if (types == NULL)
-	  return 1;
-
-     no = 0;
-     if (!strncmp(types, "no", 2)) {
-	  no = 1;
-	  types += 2;
-     }
-
-     /* Does type occur in types, separated by commas? */
-     len = strlen(type);
-     p = types;
-     while(1) {
-	     if (!strncmp(p, "no", 2) && !strncmp(p+2, type, len) &&
-		 (p[len+2] == 0 || p[len+2] == ','))
-		     return 0;
-	     if (strncmp(p, type, len) == 0 &&
-		 (p[len] == 0 || p[len] == ','))
-		     return !no;
-	     p = index(p,',');
-	     if (!p)
-		     break;
-	     p++;
-     }
-     return no;
-}
-
 /* Make a canonical pathname from PATH.  Returns a freshly malloced string.
    It is up the *caller* to ensure that the PATH is sensible.  i.e.
    canonicalize ("/dev/fd0/.") returns "/dev/fd0" even though ``/dev/fd0/.''
diff -urN util-linux-2.11g/mount/sundries.h util-linux-2.11g-fstyp/mount/sundries.h
--- util-linux-2.11g/mount/sundries.h	Thu Jun  7 18:44:08 2001
+++ util-linux-2.11g-fstyp/mount/sundries.h	Sun Jul  1 13:21:32 2001
@@ -24,7 +24,6 @@
 char *canonicalize (const char *path);
 char *realpath (const char *path, char *resolved_path);
 void error (const char *fmt, ...);
-int matching_type (const char *type, const char *types);
 void *xmalloc (size_t size);
 char *xstrdup (const char *s);
 char *xstrndup (const char *s, int n);
diff -urN util-linux-2.11g/mount/umount.c util-linux-2.11g-fstyp/mount/umount.c
--- util-linux-2.11g/mount/umount.c	Thu Jun  7 19:46:45 2001
+++ util-linux-2.11g-fstyp/mount/umount.c	Sun Jul  1 13:29:09 2001
@@ -35,6 +35,7 @@
 #include <sys/mount.h>
 #include "mount_constants.h"
 #include "sundries.h"
+#include "match_fstype.h"
 #include "getusername.h"
 #include "lomount.h"
 #include "loop.h"
