summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-04-14 14:21:29 +0000
committerMiles Bader <miles@gnu.org>1995-04-14 14:21:29 +0000
commit0543e0a9a7acd2b39f8afc1bd00c78ea2de6978e (patch)
treec69f609100adbb24cd14014bea74bc608a7b5eaa /utils
parent5d0490f7a88ac00a1f1d44e400cf9a7106168222 (diff)
Move the test for a valid translator to just before we use it.
Gratuitously change the "unknown" value for type to "". Don't use `--' when invoking settrans, as getopt doesn't seem to be handling it correctly. Use `usage' not `USAGE'.
Diffstat (limited to 'utils')
-rwxr-xr-xutils/mount.sh30
1 files changed, 16 insertions, 14 deletions
diff --git a/utils/mount.sh b/utils/mount.sh
index 667b0481..a403b8d8 100755
--- a/utils/mount.sh
+++ b/utils/mount.sh
@@ -3,12 +3,12 @@
# A simple version of mount for the hurd
#
-USAGE="Usage: $0: [ -rnvf | -o DEVOPTS | -t TYPE ] ( DEVICE NODE | DEVICE | NODE )"
+usage="Usage: $0: [ -rnv | -o DEVOPTS | -t TYPE | -f FSTAB ] ( DEVICE NODE | DEVICE | NODE )"
PATH=/bin
default_type=ufs
-type=-
+type=""
fstab=/etc/fstab
exec=true
echo=false
@@ -19,13 +19,13 @@ while :; do
-n) exec=false; margs="$margs -n"; shift;;
-r) targs="$targs -r"; shift;;
-t) case "$type" in
- -|$2) type=$2; shift 2; margs="$margs -t $type";;
- *) echo 1>&2 $0: filesystem type specified multiple times
+ ""|"$2") type="$2"; shift 2; margs="$margs -t $type";;
+ *) echo 1>&2 $0: "$2": Filesystem type inconsistent with "$type"
exit 7;;
esac;;
-f) fstab=$2; shift 2;;
-o) targs="$targs $2"; shift 2;;
- -*) echo 1>&2 $0: $1: unknown flag; echo 1>&2 "$USAGE"; exit 1;;
+ -*) echo 1>&2 $0: $1: unknown flag; echo 1>&2 "$usage"; exit 1;;
*) break;;
esac
done
@@ -35,11 +35,6 @@ case "$targs" in ?*)
margs="$margs -o \"$targs\""
esac
-if [ X"$type" != X"-" && ! -x /hurd/$type ]; then
- echo 1>&2 $0: $type: unknown filesystem type
- exit 1
-fi
-
case $# in
1)
# Lookup the given single arg in /etc/fstab for the rest of the args
@@ -60,12 +55,19 @@ END
2)
# Do the mount, by putting an active translator on the node
- case "$type" in -) type=$default_type;; esac
- $echo && echo settrans -a $2 -- /hurd/$type $targs $1
- $exec && settrans -a $2 -- /hurd/$type $targs $1
+
+ case "$type" in "") type="$default_type";; esac
+
+ if [ ! -x /hurd/$type ]; then
+ echo 1>&2 $0: $type: unknown filesystem type
+ exit 1
+ fi
+
+ $echo && echo settrans -a $2 /hurd/$type $targs $1
+ $exec && settrans -a $2 /hurd/$type $targs $1
;;
*)
- echo 1>&2 "$USAGE"; exit 1
+ echo 1>&2 "$usage"; exit 1
;;
esac