summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2008-03-01 09:02:41 -0600
committerVictor Lowther <victor.lowther@gmail.com>2008-03-01 09:02:41 -0600
commitfda3bb71c9e4d4fbfc730d1277085e241475ceb1 (patch)
treea987ac73b4ec986541a84110f9a20ab46b580ff4 /src
parent5d7e32ef87f97cb09890b7690f9f62c3395ab673 (diff)
Shortened quirk environment varialbe names.
Also made option handling code in pm-action easier to read.
Diffstat (limited to 'src')
-rw-r--r--src/pm-action.in47
1 files changed, 17 insertions, 30 deletions
diff --git a/src/pm-action.in b/src/pm-action.in
index ed537ca..3fe476b 100644
--- a/src/pm-action.in
+++ b/src/pm-action.in
@@ -26,7 +26,7 @@
# The rule here? Simplicity.
-help_options()
+help()
{
echo "${0##*/} [options]"
echo
@@ -45,7 +45,7 @@ help_options()
echo " --quirk-vbestate-restore"
echo " --quirk-vga-mode3"
echo " --quirk-none"
- echo
+ exit 0
}
if [ -n "$EUID" -a "$EUID" != "0" ]; then
@@ -56,34 +56,21 @@ fi
# Get the command line options
while [ $# -gt 0 ]
do
- case "$1" in
- --quirk-dpms-on)
- export DISPLAY_QUIRK_DPMS_ON="true" ;;
- --quirk-dpms-suspend)
- export DISPLAY_QUIRK_DPMS_SUSPEND="true" ;;
- --quirk-radeon-off)
- export DISPLAY_QUIRK_RADEON_OFF="true" ;;
- --quirk-reset-brightness)
- export DISPLAY_QUIRK_RESET_BRIGHTNESS="true" ;;
- --quirk-s3-bios)
- export DISPLAY_QUIRK_S3_BIOS="true" ;;
- --quirk-s3-mode)
- export DISPLAY_QUIRK_S3_MODE="true" ;;
- --quirk-vbe-post)
- export DISPLAY_QUIRK_VBE_POST="true" ;;
- --quirk-vbemode-restore)
- export DISPLAY_QUIRK_VBEMODE_RESTORE="true" ;;
- --quirk-vbestate-restore)
- export DISPLAY_QUIRK_VBESTATE_RESTORE="true" ;;
- --quirk-vga-mode3)
- export DISPLAY_QUIRK_VGA_MODE_3="true" ;;
- --quirk-none)
- export DISPLAY_QUIRK_NONE="true" ;;
- --help)
- help_options
- exit 0 ;;
- *)
- break ;; # terminate while loop
+ [ "${1##--}" = "$1" ] && break #if this matches, it is not an option!
+ [ "$1" = "--help" ] && help
+ case "${1##--quirk-}" in # just quirks, please
+ dpms-on) export QUIRK_DPMS_ON="true" ;;
+ dpms-suspend) export QUIRK_DPMS_SUSPEND="true" ;;
+ radeon-off) export QUIRK_RADEON_OFF="true" ;;
+ reset-brightness) export QUIRK_RESET_BRIGHTNESS="true" ;;
+ s3-bios) export QUIRK_S3_BIOS="true" ;;
+ s3-mode) export QUIRK_S3_MODE="true" ;;
+ vbe-post) export QUIRK_VBE_POST="true" ;;
+ vbemode-restore) export QUIRK_VBEMODE_RESTORE="true" ;;
+ vbestate-restore) export QUIRK_VBESTATE_RESTORE="true" ;;
+ vga-mode3) export QUIRK_VGA_MODE_3="true" ;;
+ none) export QUIRK_NONE="true" ;;
+ *) continue ;;
esac
shift
done