static char *sccsid
= "@(#)mount.c 4.7 (Berkeley) %G%";
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")) {
if (!strcmp(argv
[1], "-r")) {
if (!strcmp(argv
[1], "-f")) {
if (!strcmp(argv
[1], "-v")) {
while ( (fsp
= getfsent()) != 0) {
if (strcmp(fsp
->fs_file
, "/") == 0)
ro
= !strcmp(fsp
->fs_type
, FSTAB_RO
);
if (ro
==0 && strcmp(fsp
->fs_type
, FSTAB_RW
))
mountfs(fsp
->fs_spec
, fsp
->fs_file
, ro
);
if (argc
< 2 || argc
> 3) {
"usage: mount [ -a ] [ -r ] [ -f ] [ -v ] [ special dir ]\n");
mountfs(argv
[1], argv
[2], ro
);
register struct mtab
*mp
;
if (mount(spec
, name
, ro
) < 0) {
fprintf(stderr
, "%s on ", spec
);
fprintf(stderr
, "%s on %s%s\n", spec
, name
,
while (np
> spec
&& *--np
!= '/')
for (mp
= mtab
; mp
< &mtab
[NMOUNT
]; mp
++)
if (!strcmp(mp
->spec
, spec
))
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
);