- while (!feof(fs_file)){
- fscanf(fs_file, FSTABFMT, FSTABARG(&fs));
- if (strcmp(fs.fs_file, "/") == 0)
- continue;
- if (strcmp(fs.fs_type, "rw") &&
- strcmp(fs.fs_type, "ro"))
- continue;
- fprintf(stderr, "Unmounting special file %s\n",
- fs.fs_spec);
- fflush(stderr);
- if (umountfs(fs.fs_spec))
- continue;
+ strcpy(cp, fs->fs_file);
+ umountall(typelist);
+ break;
+ }
+ if (fs) {
+ (void) umountfs(cp, typelist);
+ free(cp);
+ }
+}
+
+umountfs(name, typelist)
+ char *name;
+ int *typelist;
+{
+ char *mntpt;
+ struct stat stbuf;
+ int type;
+#ifdef NFS
+ register CLIENT *clp;
+ struct hostent *hp = 0;
+ struct sockaddr_in saddr;
+ struct timeval pertry, try;
+ enum clnt_stat clnt_stat;
+ int so = RPC_ANYSOCK;
+ char *hostp, *delimp;
+#endif /* NFS */
+
+ if (stat(name, &stbuf) < 0) {
+ if (getmntname(name, MNTFROM, &type) != 0)
+ mntpt = name;
+ else if ((mntpt = getmntname(name, MNTON, &type)) == 0) {
+ fprintf(stderr, "%s: not currently mounted\n", name);
+ return (0);
+ }
+ } else if ((stbuf.st_mode & S_IFMT) == S_IFBLK) {
+ if ((mntpt = getmntname(name, MNTON, &type)) == 0) {
+ fprintf(stderr, "%s: not currently mounted\n", name);
+ return (0);
+ }
+ } else if ((stbuf.st_mode & S_IFMT) == S_IFDIR) {
+ mntpt = name;
+ if (getmntname(mntpt, MNTFROM, &type) == 0) {
+ fprintf(stderr, "%s: not currently mounted\n", name);
+ return (0);