SCCS-vsn: sbin/umount/umount.c 4.2
SCCS-vsn: bin/df/df.c 4.2
SCCS-vsn: sbin/swapon/swapon.c 4.2
-static char *sccsid = "@(#)df.c 4.1 (Berkeley) %G%";
+static char *sccsid = "@(#)df.c 4.2 (Berkeley) %G%";
#include <stdio.h>
#include <fstab.h>
#include <sys/param.h>
#include <stdio.h>
#include <fstab.h>
#include <sys/param.h>
perror(FSTAB), exit(1);
while (!feof(f)){
fscanf(f, FSTABFMT, FSTABARG(&fs));
perror(FSTAB), exit(1);
while (!feof(f)){
fscanf(f, FSTABFMT, FSTABARG(&fs));
+ if (strcmp(fs.fs_type, "rw") && strcmp(fs.fs_type, "ro"))
+ continue;
if (root[0] == 0)
strcpy(root, fs.fs_spec);
dfree(fs.fs_spec);
if (root[0] == 0)
strcpy(root, fs.fs_spec);
dfree(fs.fs_spec);
-static char *sccsid = "@(#)swapon.c 4.1 (Berkeley) %G%";
+static char *sccsid = "@(#)swapon.c 4.2 (Berkeley) %G%";
fprintf(stderr, "usage: swapon name...\n");
exit(1);
}
fprintf(stderr, "usage: swapon name...\n");
exit(1);
}
+ if (argc == 1 && !strcmp(*argv, "-a")) {
+ FILE *fs_file;
+ struct fstab fs;
+ if ((fs_file = fopen(FSTAB, "r")) == NULL){
+ perror(FSTAB);
+ exit(1);
+ }
+ while (!feof(fs_file)){
+ fscanf(fs_file, FSTABFMT, FSTABARG(&fs));
+ if (strcmp(fs.fs_type, "sw"))
+ continue;
+ fprintf(stderr, "Adding %s as swap device\n",
+ fs.fs_spec);
+ if (syscall(VSWAPON, fs.fs_spec) == -1) {
+ perror(fs.fs_spec);
+ stat = 1;
+ }
+ }
+ fclose(fs_file);
+ exit(stat);
+ }
do {
if (syscall(VSWAPON, *argv++) == -1) {
stat = 1;
do {
if (syscall(VSWAPON, *argv++) == -1) {
stat = 1;
-static char *sccsid = "@(#)umount.c 4.1 (Berkeley) %G%";
+static char *sccsid = "@(#)umount.c 4.2 (Berkeley) %G%";
#include <stdio.h>
#include <fstab.h>
/*
#include <stdio.h>
#include <fstab.h>
/*
- * umount name
- *
- * umount -a
- * This tries to unmount all of the block special file names
- * as given in /etc/fstab.
if (strcmp(argv[1], "-a") == 0){
FILE *fs_file;
struct fstab fs;
if (strcmp(argv[1], "-a") == 0){
FILE *fs_file;
struct fstab fs;
- if ( (fs_file = fopen(FSTAB, "r")) == NULL){
+ if ((fs_file = fopen(FSTAB, "r")) == NULL){
perror(FSTAB);
exit(1);
}
perror(FSTAB);
exit(1);
}
fscanf(fs_file, FSTABFMT, FSTABARG(&fs));
if (strcmp(fs.fs_file, "/") == 0)
continue;
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);
fprintf(stderr, "Unmounting special file %s\n",
fs.fs_spec);
fflush(stderr);