@@ -59,7 +59,7 @@ get_delay () {
5959}
6060
6161call_api () {
62- /data/data/com.termux/files/usr/libexec/termux-api Sensor " $@ "
62+ /data/data/com.termux/files/usr/libexec/termux-api Sensor " $@ "
6363}
6464
6565set_flag () {
@@ -76,28 +76,28 @@ usage_error () {
7676PARAMS=()
7777while getopts :h,a,c,l,s:d: option
7878do
79- case " $option " in
80- h) show_usage ;;
81- a) set_flag $ALL_SENSORS_FLAG ; PARAMS+=(' -a' ' sensors' ' --ez' ' all' ' true' );;
82- c) set_flag $CLEANUP_FLAG ; PARAMS=(' -a' ' cleanup' ) ;;
83- l) set_flag $LIST_FLAG ; PARAMS=(' -a' ' list' ) ;;
84- s) set_flag $SENSOR_FLAG ; get_sensors " $OPTARG " ; PARAMS+=(' -a' ' sensors' ' --es' ' sensors' " $OPTARG " ) ;;
85- d) set_flag $DELAY_FLAG ; get_delay $OPTARG ; PARAMS+=(' --ei' ' delay' $OPTARG ) ;;
86- ? ) echo " $SCRIPTNAME : illegal option -$OPTARG " ; exit 1;
87- esac
79+ case " $option " in
80+ h) show_usage ;;
81+ a) set_flag $ALL_SENSORS_FLAG ; PARAMS+=(' -a' ' sensors' ' --ez' ' all' ' true' );;
82+ c) set_flag $CLEANUP_FLAG ; PARAMS=(' -a' ' cleanup' ) ;;
83+ l) set_flag $LIST_FLAG ; PARAMS=(' -a' ' list' ) ;;
84+ s) set_flag $SENSOR_FLAG ; get_sensors " $OPTARG " ; PARAMS+=(' -a' ' sensors' ' --es' ' sensors' " $OPTARG " ) ;;
85+ d) set_flag $DELAY_FLAG ; get_delay $OPTARG ; PARAMS+=(' --ei' ' delay' $OPTARG ) ;;
86+ ? ) echo " $SCRIPTNAME : illegal option -$OPTARG " ; exit 1;
87+ esac
8888done
8989shift $(( OPTIND - 1 ))
9090
9191# Validate options were set properly
9292
9393if [ $(( FLAGS & CLEANUP_FLAG)) -ne 0 ] && [ $FLAGS -ne $CLEANUP_FLAG ]; then
94- usage_error " No other options should be specified with -c cleanup!"
94+ usage_error " No other options should be specified with -c cleanup!"
9595elif [ $(( FLAGS & LIST_FLAG)) -ne 0 ] && [ $FLAGS -ne $LIST_FLAG ]; then
96- usage_error " No other options should be specified with -l list!"
96+ usage_error " No other options should be specified with -l list!"
9797elif [ $(( FLAGS & DELAY_FLAG)) -ne 0 ] && [ $(( FLAGS & (ALL_SENSORS_FLAG | SENSOR_FLAG)) ) -eq 0 ]; then
98- usage_error " Use -s <sensors> or -a option when using -d delay!"
98+ usage_error " Use -s <sensors> or -a option when using -d delay!"
9999elif [ $(( FLAGS & ALL_SENSORS_FLAG)) -ne 0 ] && [ $(( FLAGS & SENSOR_FLAG)) -ne 0 ]; then
100- usage_error " Listed sensors will be ignored with -a all option!"
100+ usage_error " Listed sensors will be ignored with -a all option!"
101101fi
102102
103103call_api " ${PARAMS[@]} "
0 commit comments