-umountall(typelist)
- char **typelist;
-{
- register struct fstab *fs;
- struct fstab *allocfsent();
-
- if ((fs = getfsent()) == (struct fstab *)0)
- return;
- fs = allocfsent(fs);
- umountall(typelist);
- if (strcmp(fs->fs_file, "/") == 0) {
- freefsent(fs);
- return;
- }
- if (strcmp(fs->fs_type, FSTAB_RW) &&
- strcmp(fs->fs_type, FSTAB_RO) &&
- strcmp(fs->fs_type, FSTAB_RQ)) {
- freefsent(fs);
- return;
- }
- (void) umountfs(fs->fs_file, typelist);
- freefsent(fs);
-}
-
-struct fstab *
-allocfsent(fs)
- register struct fstab *fs;
-{
- register struct fstab *new;
- register char *cp;
- char *malloc();
-
- new = (struct fstab *)malloc((unsigned)sizeof (*fs));
- cp = malloc((unsigned)strlen(fs->fs_file) + 1);
- strcpy(cp, fs->fs_file);
- new->fs_file = cp;
- cp = malloc((unsigned)strlen(fs->fs_type) + 1);
- strcpy(cp, fs->fs_type);
- new->fs_type = cp;
- cp = malloc((unsigned)strlen(fs->fs_spec) + 1);
- strcpy(cp, fs->fs_spec);
- new->fs_spec = cp;
- new->fs_passno = fs->fs_passno;
- new->fs_freq = fs->fs_freq;
- return (new);
-}
-
-freefsent(fs)
- register struct fstab *fs;
-{
+ while ((fs = getfsent()) != NULL) {
+ /* Ignore the root. */
+ if (strcmp(fs->fs_file, "/") == 0)
+ continue;
+ /*
+ * !!!
+ * Historic practice: ignore unknown FSTAB_* fields.
+ */
+ if (strcmp(fs->fs_type, FSTAB_RW) &&
+ strcmp(fs->fs_type, FSTAB_RO) &&
+ strcmp(fs->fs_type, FSTAB_RQ))
+ continue;
+ /* If an unknown file system type, complain. */
+ if ((type = fsnametotype(fs->fs_vfstype)) == MOUNT_NONE) {
+ warnx("%s: unknown mount type", fs->fs_vfstype);
+ continue;
+ }
+ if (!selected(type))
+ continue;