blob: 2a61fc7f3bb7a31f31c097c2680c76bde31eb04f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#!/bin/sh
# A unix-like su (one which invokes a sub-shell).
ARGS_DOC="[USER|- [COMMAND [ARG...]]]"
USAGE="Usage: $0 $ARGS_DOC"
DOC="Start a new shell, or COMMAND, as USER"
LOGIN=${LOGIN-/bin/login}
FMT=${FMT-/bin/fmt}
needs_arg=""
while :; do
case $needs_arg in
?*) needs_arg="";;
"")
case "$1" in
-e|-E|-g|-G|-u|-U|--envar|--envva|--env|--en|--e|--envvar-default|--envvar-defaul|--envvar-defau|--envvar-defa|--envvar-def|--envvar-def|--envvar-de|--envvar-d|--envvar-|--group|--grou|--gro|--gr|--g|--avail-group|--avail-grou|--avail-gro|--avail-gr|--avail-g|--user|--use|--us|--u|--avail-user|--avail-use|--avail-us|--avail-u)
needs_arg="$1";;
-e*|-E*|-g*|-G*|-u*|-U*|--envar=*|--envva=*|--env=*|--en=*|--e=*|--envvar-default=*|--envvar-defaul=*|--envvar-defau=*|--envvar-defa=*|--envvar-def=*|--envvar-def=*|--envvar-de=*|--envvar-d=*|--envvar-=*|--group=*|--grou=*|--gro=*|--gr=*|--g=*|--avail-group=*|--avail-grou=*|--avail-gro=*|--avail-gr=*|--avail-g=*|--user=*|--use=*|--us=*|--u=*|--avail-user=*|--avail-use=*|--avail-us=*|--avail-u=*)
:;;
--avail-|--avail|--avai|--ava|--av|--a|--avail-=*|--avail=*|--avai=*|--ava=*|--av=*|--a=*)
echo 1>&2 "$0: option \`$1' is ambiguous"
echo 1>&2 "Try \`$0 --help' or \`$0 --usage' for more information";
exit 1;;
--help|"-?")
echo "$USAGE"
echo "$DOC"
echo ""
echo " -?, --help Give this help list"
echo " -e ENTRY, --envvar=ENTRY Add ENTRY to the environment"
echo " -E ENTRY, --envvar-default=ENTRY"
echo " Use ENTRY as a default environment variable"
echo " -g GROUP, --group=GROUP Add GROUP to the effective groups"
echo " -G GROUP, --avail-group=GROUP Add GROUP to the available groups"
echo " -u USER, --user=USER Add USER to the effective uids"
echo " -U USER, --avail-user=USER Add USER to the available uids"
echo " --usage Give a short usage message"
echo " -V, --version Print program version"
exit 0;;
--usage)
(echo "Usage: $0 [-V?]"
echo " [-e ENTRY] [-E ENTRY] [-g GROUP] [-G GROUP] [-u USER] [-U USER] [--envvar=ENTRY] [--envvar-default=ENTRY] [--group=GROUP] [--avail-group=GROUP][--group=GROUP] [--avail-group=GROUP] [--user=USER] [--avail-user=USER][--help] [--usage] [--version] $ARGS_DOC") |$FMT -t
exit 0;;
--version|-V)
echo "STANDARD_HURD_VERSION_sush_"; exit 0;;
-*)
echo 1>&2 "$0: unrecognized option \`$1'"
echo 1>&2 "Try \`$0 --help' or \`$0 --usage' for more information";
exit 1;;
*)
break;;
esac;;
esac
done
case "$needs_arg" in ?*)
echo 1>&2 "$0: option \`$1' requires an argument"
echo 1>&2 "Try \`$0 --help' or \`$0 --usage' for more information";
exit 1;;
esac
exec $LOGIN --program-name="$0" -pxSLf -aHOME -aMOTD -aUMASK -aBACKUP_SHELLS "$@"
|