static char *sccsid
= "@(#)umount.c 4.1 (Berkeley) %G%";
* This tries to unmount all of the block special file names
* as given in /etc/fstab.
register struct mtab
*mp
;
mf
= open("/etc/mtab", 0);
read(mf
, (char *)mtab
, NMOUNT
*2*NAMSIZ
);
if (strcmp(argv
[1], "-a") == 0){
if ( (fs_file
= fopen(FSTAB
, "r")) == NULL
){
fscanf(fs_file
, FSTABFMT
, FSTABARG(&fs
));
if (strcmp(fs
.fs_file
, "/") == 0)
fprintf(stderr
, "Unmounting special file %s\n",
if (umountfs(fs
.fs_spec
))
register struct mtab
*mp
;
while(p1
> name
&& *--p1
!= '/')
for (mp
= mtab
; mp
< &mtab
[NMOUNT
]; mp
++) {
for (p1
= mp
->file
; p1
< &mp
->file
[NAMSIZ
*2];)
while ((--mp
)->file
[0] == 0);
mf
= creat("/etc/mtab", 0644);
write(mf
, (char *)mtab
, (mp
-mtab
+1)*2*NAMSIZ
);
printf("%s not in mount table\n", name
);