+/*
+ * It is important to unmount the files in
+ * reverse! order from the order they were mounted,
+ * so that file systems mounted as children to other
+ * file systems get removed in the right order.
+ */
+umountall()
+{
+ struct fstab fs;
+ struct fstab *fsp;
+ if ( (fsp = getfsent()) == 0)
+ return;
+ fs = *fsp; /* save info locally; it is static from getfsent() */
+ umountall();
+ if (strcmp(fs.fs_file, "/") == 0)
+ return;
+ if (strcmp(fs.fs_type, FSTAB_RW) &&
+ strcmp(fs.fs_type, FSTAB_RO))
+ return;
+ if (umountfs(fs.fs_spec) < 0)
+ fprintf(stdout, "Unmount of special file %s FAILED\n", fs.fs_spec);
+ else
+ fprintf(stdout, "Unmounted special file %s\n", fs.fs_spec);
+ fflush(stdout);
+}