Skip to content

Commit 231ed74

Browse files
committed
termux-usb: fix -E arg
It was forgotten in the getopts options. Also remove MASK check, with more options it is more tricky to keep track of how many args we should have just after the getopts loop.
1 parent d3fe24d commit 231ed74

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

scripts/termux-usb.in

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e -u
33

44
SCRIPTNAME=termux-usb
55
show_usage () {
6-
echo "Usage: $SCRIPTNAME [-l | [-r] [-e command] device]"
6+
echo "Usage: $SCRIPTNAME [-l | [-r] [-E] [-e command] [device]"
77
echo "List or access USB devices. Devices cannot be accessed directly,"
88
echo " only using $SCRIPTNAME."
99
echo " -l list available devices"
@@ -18,22 +18,19 @@ show_usage () {
1818

1919
ACTION="permission"
2020
PARAMS=""
21-
MASK=0
22-
while getopts :hlre: option
21+
while getopts :hlre:E option
2322
do
2423
case "$option" in
2524
h) show_usage;;
26-
l) ACTION="list"; ((MASK |= 1));;
27-
r) PARAMS="$PARAMS --ez request true"; ((MASK |= 2));;
28-
e) ACTION="open"; export TERMUX_CALLBACK="$OPTARG"; ((MASK |= 2));;
25+
l) ACTION="list";;
26+
r) PARAMS="$PARAMS --ez request true";;
27+
e) ACTION="open"; export TERMUX_CALLBACK="$OPTARG";;
2928
E) export TERMUX_EXPORT_FD=true;;
3029
?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
3130
esac
3231
done
3332
shift $((OPTIND-1))
3433

35-
if [ $MASK -eq 3 ]; then echo "$SCRIPTNAME: -l cannot be combined with other options"; exit 1; fi
36-
3734
if [ "$ACTION" == "list" ]
3835
then
3936
if [ $# -gt 0 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi

0 commit comments

Comments
 (0)