static char *sccsid
= "@(#)mount.c 4.1 (Berkeley) %G%";
* mount -a Mount all file systems, as determined from the
* If the name entry in /etc/fstab is "/", don't mount.
* If the read only entry in /etc/fstab is "ro", mount read only
* The special file names in /etc/fstab are the block devices;
* this is what we want to mount.
* Tries to mount all of the files in /etc/fstab.
* mount special name Mount special on name
* mount special name -r Mount special on name, read/write
register struct mtab
*mp
;
mf
= open("/etc/mtab", 0);
read(mf
, (char *)mtab
, NMOUNT
*2*NAMSIZ
);
for (mp
= mtab
; mp
< &mtab
[NMOUNT
]; mp
++)
printf("%s on %s\n", mp
->spec
, mp
->file
);
if (strcmp(argv
[1], "-a") == 0)
fprintf(stderr
,"arg count\n");
if (mountfs(argv
[1], argv
[2], ro
))
if ( (fs_file
= fopen(FSTAB
, "r")) == NULL
){
fscanf(fs_file
, FSTABFMT
, FSTABARG(&fs
));
if (strcmp(fs
.fs_file
, "/") == 0)
fprintf(stderr
, "Mounting %s on %s %s",
FSRO(&fs
) ? "(Read Only)\n" : "\n");
mountfs(fs
.fs_spec
, fs
.fs_file
, FSRO(&fs
));
register struct mtab
*mp
;
if(mount(spec
, name
, ro
) < 0) {
while(np
> spec
&& *--np
!= '/')
for (mp
= mtab
; mp
< &mtab
[NMOUNT
]; mp
++) {
for (np
= mp
->spec
; np
< &mp
->spec
[NAMSIZ
-1];)
if ((*np
++ = *spec
++) == 0)
for (np
= mp
->file
; np
< &mp
->file
[NAMSIZ
-1];)
if ((*np
++ = *name
++) == 0)
while ((--mp
)->file
[0] == 0);
mf
= creat("/etc/mtab", 0644);
write(mf
, (char *)mtab
, (mp
-mtab
+1)*2*NAMSIZ
);