home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / bin / im-switch < prev    next >
Encoding:
Text File  |  2010-06-22  |  17.0 KB  |  504 lines

  1. #!/bin/sh
  2. # Copyright (C) 2006        Osamu Aoki  <osamu@debian.org>
  3. # Copyright (C) 2005 - 2006 Kenshi Muto <kmuto@debian.org>
  4. #  Modified for Debian package.
  5. # Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This
  6. # copyrighted material is made available to anyone wishing to use, modify,
  7. # copy, or redistribute it subject to the terms and conditions of the
  8. # GNU General Public License version 2.
  9. #
  10. # You should have received a copy of the GNU General Public License
  11. # along with this program; if not, write to the Free Software
  12. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  13.  
  14. # system wide configuration directory
  15. XINPUT_PATH=/etc/X11/xinit/xinput.d
  16. # user specific customization directory
  17. DOTXINPUT_PATH=${HOME}/.xinput.d
  18. # All im-switch related alternatives start with xinput-
  19. ALTER_XINPUT=/etc/alternatives/xinput-
  20. # location for special hook scripts installed by each IM packages
  21. HOOKDIR=/usr/share/im-switch
  22.  
  23. # $LNG is locale <languag>e_<region> without .<encoding> and .<encoding>@EURO
  24. LNG=${LC_ALL:-${LC_CTYPE:-${LANG}}}
  25. LNG=${LNG%@*}
  26. LNG=${LNG%.*}
  27.  
  28. [ -z "$LNG" ] && LNG="all_ALL" || true
  29.  
  30. USERID=$(id -u)
  31. VER=1.20
  32.  
  33. VERBOSE=0
  34.  
  35. # echo to STDERR when VERBOSE is on.
  36. vecho() {
  37.     if [ $VERBOSE -eq 1 ] ; then
  38.         echo "$1" >&2
  39.     fi
  40. }
  41.  
  42. # echo local setups to STDERR when VERBOSE is on.
  43. vlang() {
  44.     if [ $VERBOSE -eq 1 ] ; then
  45.       echo "LC_ALL=\"$LC_ALL\"" >&2
  46.       echo "LC_CTYPE=\"$LC_CTYPE\"" >&2
  47.       echo "LANG=\"$LANG\"" >&2
  48.       echo "LNG=\"$LNG\"" >&2
  49.     fi
  50. }
  51.  
  52. # echo command line info to STDERR when VERBOSE is on.
  53. errcmd() {
  54. echo "Error: \"${0##*/}\" invoked with \"$ORGAT\" as options." >&2
  55. echo "Error: Try \"${0##*/} -h\" for usage." >&2
  56. }
  57.  
  58. # echo missing dependency information for $1=$LNG
  59. dependency() {
  60.     if [ -z "$1" ] ; then
  61.         return
  62.     fi
  63.     if [ -r  ${HOME}/$(basename "$1") ]; then
  64.         DEPENDS=$(grep -e "DEPENDS=" ${HOME}/$(basename $1) | sed -e 's/DEPENDS=//' -e 's/"//g')
  65.     elif [ -r "${XINPUT_PATH}/$1" ]; then
  66.         DEPENDS=$(grep -e "DEPENDS=" $XINPUT_PATH/$1 | sed -e 's/DEPENDS=//' -e 's/"//g')
  67.     else
  68.         DEPENDS=""
  69.     fi
  70.     vecho "From the package dependency information requires"
  71.     vecho "  \"$DEPENDS\"."
  72.     if [ -z "$DEPENDS" ]; then
  73.         return
  74.     fi
  75.     RESULT=""
  76.     # split with ","
  77.     IFS=","
  78.     for i in `echo "$DEPENDS"`; do 
  79.         INSTALLED=0
  80.     # split with |
  81.     IFS="|"
  82.     for j in `echo "$i"`; do 
  83.             unset IFS
  84.             vecho "checking status of \"$j\" package"
  85.             if dpkg -s $j 2>/dev/null | grep -q -e "Status: install ok installed" ; then
  86.                 vecho "+++ \"$j\" package is installed."
  87.                 INSTALLED=1
  88.             else
  89.                 vecho "---- \"$j\" package is NOT installed."
  90.             fi
  91.         done
  92.     done
  93.     if [ $INSTALLED -eq 0 ]; then 
  94.         if [ -z "$RESULT" ]; then
  95.             RESULT="( $i )"
  96.         else
  97.             RESULT="${RESULT} and ( $i )"
  98.         fi
  99.     fi
  100.     if [ -n "$RESULT" ]; then
  101.         echo "Please install following packages:"
  102.         echo "  $(echo \"$RESULT\" | sed -e 's/|/ or /g') ."
  103.     fi
  104. }
  105.  
  106. # echo current system wide default IM setup name
  107. current_system_im () {
  108.     if [ -r "${ALTER_XINPUT}${LNG}" ]; then
  109.     /usr/sbin/update-alternatives --display xinput-$LNG | \
  110.     sed -ne 's/^ *link currently points to \([^ ]*\)/\1/p' | \
  111.     sed -e "s%${XINPUT_PATH}/%%"
  112.     elif [ -r "${ALTER_XINPUT}all_ALL" ]; then
  113.     /usr/sbin/update-alternatives --display xinput-all_ALL | \
  114.     sed -ne 's/^ *link currently points to \([^ ]*\)/\1/p' | \
  115.     sed -e "s%${XINPUT_PATH}/%%"
  116.     else
  117.     echo "No system wide default \"${ALTER_XINPUT}${LNG} or ${ALTER_XINPUT}all_ALL\" is defined."
  118.     exit 1
  119.     fi
  120. }
  121.  
  122. # echo current user IM setup name
  123. current_user_im () {
  124. if [ -h ${DOTXINPUT_PATH}/$LNG ]; then
  125.     readlink ${DOTXINPUT_PATH}/$LNG | \
  126.     sed -e "s%${XINPUT_PATH}/%%" -e "s%${DOTXINPUT_PATH}/%~/.xinput.d/%"
  127. fi
  128. }
  129.  
  130. # echo IM setup candidates
  131. possible_im () {
  132.     ( (/usr/bin/find $XINPUT_PATH    -type f| sed -e "s%$XINPUT_PATH/%%") ; \
  133.       (/usr/bin/find $DOTXINPUT_PATH -type f| sed -e "s%$DOTXINPUT_PATH/%%" ; ) ) | \
  134.     sort -u
  135.     # XXX FIXME : should test for executable
  136. }
  137.  
  138. # run system hook script when system wide IM setup is changed
  139. # So far, I have not see its use yet.
  140. #   $PREVIOUS
  141. #   $DEFAULT
  142. runhookscripts () {
  143.     if [ "$DEFAULT" != "$PREVIOUS" ]; then
  144.         [ "$PREVIOUS" -a -x "$HOOKDIR/$PREVIOUS" ] &&  $HOOKDIR/$PREVIOUS remove
  145.         [ "$DEFAULT" -a -x "$HOOKDIR/$DEFAULT" ] &&  $HOOKDIR/$DEFAULT install
  146.     fi
  147. }
  148.  
  149. list() {
  150.     echo "Your input method setup under $LNG locale as below."
  151.     echo "======================================================="
  152.     if [ "$USERID" -eq 0 ]; then
  153.         echo "No private configuration can be defined for root account."
  154.     elif [ -r "${DOTXINPUT_PATH}/${LNG}" ]; then
  155.         if [ -L "${DOTXINPUT_PATH}/${LNG}" ]; then
  156.       echo "The configuration \"${DOTXINPUT_PATH}/${LNG}\" is defined as a link pointing to"
  157.       echo "$(basename $(readlink "${DOTXINPUT_PATH}/${LNG}"))"
  158.         else
  159.       echo "The private configuration is a static file \"${DOTXINPUT_PATH}/${LNG}\" ."
  160.         fi
  161.     echo "This private configuration supersedes the system wide default."
  162.     elif [ -L "${DOTXINPUT_PATH}/all_ALL" ]; then
  163.         if [ -L "${DOTXINPUT_PATH}/all_ALL" ]; then
  164.       echo "The configuration \"${DOTXINPUT_PATH}/all_ALL\" is defined as a link pointing to"
  165.       echo "$(basename $(readlink "${DOTXINPUT_PATH}/all_ALL"))"
  166.         else
  167.       echo "The private configuration is a static file \"${DOTXINPUT_PATH}/all_ALL\" ."
  168.         fi
  169.     echo "This private configuration supersedes the system wide default."
  170.     else
  171.     echo "No private \"${DOTXINPUT_PATH}/${LNG} or ${DOTXINPUT_PATH}/all_ALL\" is defined."
  172.     fi
  173.     echo "======================================================="
  174.     if [ -r "${ALTER_XINPUT}${LNG}" ]; then
  175.     echo "The system wide default is pointed by \"${ALTER_XINPUT}${LNG}\" ."
  176.     /usr/sbin/update-alternatives --display xinput-$LNG | sed -e "s%$XINPUT_PATH/%%"
  177.     elif [ -r "${ALTER_XINPUT}all_ALL" ]; then
  178.     echo "The system wide default is pointed by \"${ALTER_XINPUT}all_ALL\" ."
  179.     /usr/sbin/update-alternatives --display xinput-all_ALL | sed -e "s%$XINPUT_PATH/%%"
  180.     else
  181.     echo "No system wide default \"${ALTER_XINPUT}${LNG} or ${ALTER_XINPUT}all_ALL\" is defined."
  182.     fi
  183.     vecho "======================================================="
  184.     vecho "The system wide default input methods are available for the locales:"
  185.     for i in `/bin/ls $ALTER_XINPUT* | sed -e "s%$ALTER_XINPUT%%"`; do
  186.         vecho -n "$i "
  187.     done
  188.     vecho
  189.     echo "======================================================="
  190.     echo "The available input method configuration files are:"
  191.     for i in `possible_im` ; do
  192.         if [ -r $DOTXINPUT_PATH/$i ]; then
  193.             echo -n "~/.xinput.d/$i "
  194.         else
  195.             echo -n "$i "
  196.         fi
  197.     done
  198.     echo
  199.     vecho "======================================================="
  200.     vecho "The available input method hook scripts are in $HOOKDIR:"
  201.     for i in `/usr/bin/find $HOOKDIR -type f| sed -e "s%$HOOKDIR/%%"`; do
  202.         vecho -n "$i "
  203.     done
  204.     vecho
  205.     echo "======================================================="
  206. }
  207.  
  208. # set IM to defaults
  209. auto() {
  210.     if [ "$USERID" -eq 0 ]; then
  211.         if [ ! -r "${ALTER_XINPUT}${LNG}" ]; then
  212.         echo "No system wide default defined just for locale ${LNG} ."
  213.         echo "Use \"all_ALL\" quasi-locale and set IM."
  214.             LNG="all_ALL"
  215.         fi
  216.     PREVIOUS=$(current_system_im)
  217.     /usr/sbin/update-alternatives --auto xinput-$LNG
  218.     else
  219.     if [ -r "${DOTXINPUT_PATH}/${LNG}" ]; then
  220.         PREVIOUS=$(current_user_im)
  221.         mv ${DOTXINPUT_PATH}/${LNG} ${DOTXINPUT_PATH}/${LNG}.backup
  222.     fi
  223.     fi
  224.     DEFAULT=$(current_system_im)
  225.     dependency $DEFAULT
  226.     runhookscripts
  227. }
  228.  
  229. # set im setup pointing to to $1 script in $XINPUT_PATH
  230. setalt() {
  231.     if [ "$USERID" -eq 0 ]; then
  232.         vecho "You are root user."
  233.         # sanity check
  234.         if [ ! -r "$XINPUT_PATH/$1" ] ; then
  235.             echo "Error: no system wide configuration file \"$1\" exists." >&2
  236.         echo "Error: No action taken." >&2
  237.             exit 1
  238.         fi
  239.     if [ ! -r "${ALTER_XINPUT}${LNG}" ]; then
  240.         echo "No system wide default defined just for locale $LNG ."
  241.         echo "Use \"all_ALL\" quasi-locale and set IM."
  242.             LNG="all_ALL"
  243.     fi
  244.     PREVIOUS=$(current_system_im)
  245.     /usr/sbin/update-alternatives --set xinput-$LNG $XINPUT_PATH/${1}
  246.         DEFAULT=$(current_system_im)
  247.         vecho "Changed system wide default from $PREVIOUS to $DEFAULT."
  248.     else
  249.         # sanity check
  250.         if [ ! -r "$XINPUT_PATH/${1}" -a ! -r "$DOTXINPUT_PATH/${1}" ] ; then
  251.             echo "Error: no configuration file \"${1}\" exists." >&2
  252.         echo "Error: No action taken." >&2
  253.             exit 1
  254.         fi
  255.         vecho "You are non-root user."
  256.     if [ ! -d ${DOTXINPUT_PATH} ]; then
  257.         mkdir -p ${DOTXINPUT_PATH}
  258.             vecho "Creating  ${DOTXINPUT_PATH} directory."
  259.         fi
  260.     if [ -r "${DOTXINPUT_PATH}/${LNG}" ]; then
  261.         PREVIOUS=$(current_user_im)
  262.             mv ${DOTXINPUT_PATH}/${LNG} ${DOTXINPUT_PATH}/${LNG}.backup
  263.             vecho "Backed up user configuration pointing to $PREVIOUS."
  264.     fi
  265.         if [ -r "$DOTXINPUT_PATH/${1}" ] ; then
  266.             ln -s $DOTXINPUT_PATH/${1} ${DOTXINPUT_PATH}/$LNG
  267.         else
  268.             ln -s $XINPUT_PATH/${1} ${DOTXINPUT_PATH}/$LNG
  269.         fi
  270.         DEFAULT=$(current_user_im)
  271.         vecho "Set user configuration pointing to $DEFAULT."
  272.     fi
  273.     dependency "$DEFAULT"
  274.     runhookscripts
  275. }
  276.  
  277. # set im setup pointing to to a script in $XINPUT_PATH by terminal menu
  278. cfgalt() {
  279.     if [ "$USERID" -eq 0 ]; then
  280.         vecho "You are root user."
  281.     if [ ! -r "${ALTER_XINPUT}${LNG}" ]; then
  282.         echo "No system wide default defined just for locale $LNG ."
  283.         echo "Use \"all_ALL\" quasi-locale and set IM."
  284.             LNG="all_ALL"
  285.     fi
  286.     PREVIOUS=$(current_system_im)
  287.         echo    "System wide default for ${LNG} locale is marked with [+]."
  288.     /usr/sbin/update-alternatives --config xinput-$LNG
  289.         DEFAULT=$(current_system_im)
  290.         vecho "Changed system wide default from $PREVIOUS to $DEFAULT."
  291.     else
  292.         vecho "You are non-root user."
  293.     if [ ! -d ${DOTXINPUT_PATH} ]; then
  294.         mkdir -p ${DOTXINPUT_PATH}
  295.             vecho "Creating  ${DOTXINPUT_PATH} directory."
  296.         fi
  297.         PREVIOUS_SYS=$(current_system_im)
  298.     if [ -r "${DOTXINPUT_PATH}/${LNG}" ]; then
  299.         PREVIOUS=$(current_user_im)
  300.             cp -a ${DOTXINPUT_PATH}/${LNG} ${DOTXINPUT_PATH}/${LNG}.backup
  301.             vecho "Backed up user configuration pointing to $PREVIOUS."
  302.     fi
  303.         vecho "    PREVIOUS_SYS=\"$PREVIOUS_SYS\""
  304.         vecho "    PREVIOUS=\"$PREVIOUS\""
  305.         COUNT=`possible_im | wc -l`
  306.         if [ "x$DISPLAY" != "x" ]; then
  307.             zenity_ucfgalt 
  308.         else
  309.             console_ucfgalt
  310.         fi
  311.     fi
  312.     DEFAULT=$(current_user_im)
  313.     vecho "Set user configuration pointing to $DEFAULT."
  314.     dependency "$DEFAULT"
  315.     runhookscripts
  316. }
  317.  
  318. # set user im setup pointing to to a script in $XINPUT_PATH by console menu
  319. console_ucfgalt() {
  320. echo "Input Method Switcher                     im-switch Version: $VER"
  321. echo "  Selection    Input Method Candidates for ${DOTXINPUT_PATH}/${LNG}:"
  322. echo "  ------------------------------------------------------------------"
  323. INDEX=0
  324. for i in `possible_im`; do
  325.     INDEX=$(($INDEX+1))
  326.     if [ -r $DOTXINPUT_PATH/$i ]; then
  327.         if [ "$PREVIOUS" = "~/.xinput.d/$i" ]; then
  328.             echo -n "*"
  329.         else
  330.             echo -n " "
  331.         fi
  332.         if [ "$PREVIOUS_SYS" = "~/.xinput.d/$i" ]; then
  333.             echo -n "+"
  334.         else
  335.             echo -n " "
  336.         fi
  337.         echo "    $INDEX        ~/.xinput.d/$i "
  338.     else
  339.         if [ "$PREVIOUS" = "$i" ]; then
  340.             echo -n "*"
  341.         else
  342.             echo -n " "
  343.         fi
  344.         if [ "$PREVIOUS_SYS" = "$i" ]; then
  345.             echo -n "+"
  346.         else
  347.             echo -n " "
  348.         fi
  349.         echo "    $INDEX        $i"
  350.     fi
  351. done
  352. echo    "System wide default for ${LNG} (or all_ALL) locale is marked with [+]."
  353. echo    "Type \"REMOVE\" to remove user selection to enable system default."
  354. echo -n "Press enter to keep the current selection[*], or type selection number: "
  355. read SEL
  356. echo
  357. if [ -z "$SEL" ]; then
  358.     # No action because INDEX is larger than 0
  359.     SEL=0
  360. fi
  361. if [ "$SEL" != "REMOVE" ]; then
  362.     INDEX=0
  363.     for i in `possible_im`; do
  364.         INDEX=$(($INDEX+1))
  365.         if [ "$SEL" -eq "$INDEX" ]; then
  366.             if [ -r "$DOTXINPUT_PATH/$i" ] ; then
  367.                 ln -fs $DOTXINPUT_PATH/$i ${DOTXINPUT_PATH}/$LNG
  368.             else
  369.                 ln -fs $XINPUT_PATH/$i ${DOTXINPUT_PATH}/$LNG
  370.             fi
  371.         fi
  372.     done
  373. else
  374.     if [ -h "$DOTXINPUT_PATH/$LNG" ] ; then
  375.         rm ${DOTXINPUT_PATH}/$LNG
  376.         vecho "${DOTXINPUT_PATH}/$LNG removed"
  377.     fi
  378. fi
  379. echo "Please read /usr/share/doc/im-switch/README.Debian.gz ."
  380. echo "Please restart the X session to activate the selected Imput Method."
  381. }
  382.  
  383. menuitem_im () {
  384. echo $1 | sed \
  385. -e "s/^~\/\.xinput\.d\//User local configuration at ~\/\.xinput\.d\/: /" \
  386. -e "s/default-xim$/Use xim (default-xim)/" \
  387. -e "s/default$/Use setting by the sysadmin. (default)/" \
  388. -e "s/ibus$/Use IBus (ibus)/" \
  389. -e "s/lo-gtk$/Use thai IM_MODULE (lo-gtk)/" \
  390. -e "s/none$/Do not use Input Method. (none)/" \
  391. -e "s/scim-bridge$/Use SCIM via scim-bridge (scim-bridge)/" \
  392. -e "s/scim-immodule$/Use SCIM via IM_MODULE (scim-immodule)/" \
  393. -e "s/scim$/Use SCIM via xim (scim)/" \
  394. -e "s/skim$/Use SCIM via IM_MODULE (skim)/" \
  395. -e "s/th-gtk$/Use thai IM_MODULE (th-gtk)/" \
  396. -e "s/th-xim$/Use thai xim (th-xim)/"
  397. }
  398. # set user im setup pointing to to a script in $XINPUT_PATH by zenity menu
  399. zenity_ucfgalt() {
  400. ZCMD0="zenity --title=\"Input Method Switcher (ver $VER)\" --width=600 --height=400 --text=\"Select User Input Method for ${LNG} . User choice supercedes system choice marked as default.\" --list --radiolist --hide-column=2 --column \"User\" --column \"im\" --column \"system\" --column \"Description of Input Method\""
  401. ZCMD=""
  402. for i in `possible_im`; do
  403.     if [ -r $DOTXINPUT_PATH/$i ]; then
  404.         if [ "$PREVIOUS" = "~/.xinput.d/$i" ]; then
  405.             ZCMD="$ZCMD TRUE"
  406.         else
  407.             ZCMD="$ZCMD FALSE"
  408.         fi
  409.         ZCMD="$ZCMD ~/.xinput.d/$i"
  410.         if [ "$PREVIOUS_SYS" = "~/.xinput.d/$i" ]; then
  411.             ZCMD="$ZCMD default"
  412.         else
  413.             ZCMD="$ZCMD \" \""
  414.         fi
  415.         ZCMD="$ZCMD \"$(menuitem_im ~/.xinput.d/$i)\""
  416.     else
  417.         if [ "$PREVIOUS" = "$i" ]; then
  418.             ZCMD="$ZCMD TRUE"
  419.         else
  420.             ZCMD="$ZCMD FALSE"
  421.         fi
  422.         ZCMD="$ZCMD $i"
  423.         if [ "$PREVIOUS_SYS" = "$i" ]; then
  424.             ZCMD="$ZCMD default"
  425.         else
  426.             ZCMD="$ZCMD \" \""
  427.         fi
  428.         ZCMD="$ZCMD \"$(menuitem_im $i)\""
  429.     fi
  430. done
  431. ZCMD="$ZCMD FALSE REMOVE \" \" \"Remove user choice to enable system choice\""
  432. vecho "$ZCMD0 $ZCMD"
  433. SEL=$(eval $ZCMD0 $ZCMD)
  434. if [ -z "$SEL" ]; then
  435.     SEL=$PREVIOUS
  436. fi
  437. ZMES="No user configuration enabled for $LNG."
  438. if [ -n "$SEL" ]; then
  439.     if [ "$SEL" != "REMOVE" ]; then
  440.         if [ -r "$DOTXINPUT_PATH/$SEL" ] ; then
  441.             ln -fs $DOTXINPUT_PATH/$SEL ${DOTXINPUT_PATH}/$LNG
  442.             ZMES="User configuration $(menuitem_im $SEL) enabled for $LNG."
  443.         else
  444.             ln -fs $XINPUT_PATH/$SEL ${DOTXINPUT_PATH}/$LNG
  445.             ZMES="User configuration $(menuitem_im $SEL) enabled for $LNG."
  446.         fi
  447.     else
  448.         if [ -h "$DOTXINPUT_PATH/$LNG" ] ; then
  449.             rm ${DOTXINPUT_PATH}/$LNG
  450.             vecho "${DOTXINPUT_PATH}/$LNG removed"
  451.             ZMES="User configuration removed for $LNG."
  452.         fi
  453.     fi
  454. fi
  455. zenity --info --text "Please read /usr/share/doc/im-switch/README.Debian.gz . \n\n$ZMES\n\nRestart the X session to activate the selected Imput Method."
  456. }
  457.  
  458. help() {
  459. echo "Input Method Switcher: im-switch Version=$VER"
  460. echo ""
  461. echo "\"${0##*/}\" configures the input method to be automatically switched based "
  462. echo "on the locale (ll_CC) using Debian \"update-alternatives\" mechanism."
  463. echo "When \"${0##*/}\" is invoked from root user, it sets system wide alternatives."
  464. echo ""
  465. echo "Usage: ${0##*/} [-v][-z ll_CC] -s inputmethodname"
  466. echo "           to set a specific input method for the language"
  467. echo "       ${0##*/} [-v][-z ll_CC] -c"
  468. echo "           to set an input method for the language by menu"
  469. echo "       ${0##*/} [-v][-z ll_CC] -a"
  470. echo "           to revert to the default input method for the language"
  471. echo "       ${0##*/} [-v][-z ll_CC] -l"
  472. echo "           to list current settings and available input methods for"
  473. echo "           the language, and also all the available languages"
  474. echo "       ${0##*/} -h"
  475. echo "           to show this help"
  476. echo ""
  477. echo "The \"ll_CC\" argument of -z takes the form \"<language>_<teritory>\" and "
  478. echo "is used to override the current locale (ISO 639 / ISO 3188) : eg \"-z ja_JP\""
  479. echo ""
  480. echo "The use of -v option produces verbose outputs."
  481. echo ""
  482. }
  483.  
  484. ORGAT="$@"
  485.  
  486. while getopts "vfz:als:ch" OPTION; do
  487.     case $OPTION in
  488.         v) VERBOSE=1;;
  489.         z) vlang; LNG="$OPTARG"; LNG=${LNG%@*}; LNG=${LNG%.*};;
  490.         a) vlang; auto; exit 0;;
  491.         l) vlang; list; exit 0;;
  492.         s) vlang; setalt "$OPTARG"; exit 0;;
  493.         c) vlang; cfgalt; exit 0;;
  494.         h) vlang; help; exit 0;;
  495.     ?) errcmd; exit 1;;
  496.     esac
  497. done
  498.  
  499. # If no option --> Menu use under X :-)
  500. vlang
  501. cfgalt
  502. exit 0
  503.  
  504.