#!/bin/sh
 
 # g_select
 # ========
 
 # This file is part of Gerolf Markup Shredder,
 # written by G. D. Brettschneider (1999-2006).
 
 GMSdateG_select=20060927
 
 # Prologue: ==================================================================
 
 # Not running:
 
 if [ "$GMS_SHELL" = "" ]; then
   echo "This is Gerolf Markup Shredder (g_select)."
   exit
 fi 
 
 # Debug: ---------------------------------------------------------------------

 if [ "$GMS_DEBUG" = "X" -o "$GMS_DEBUG" = "Y" ]; then
   source "$GMS_SHELL/l_banner" -debug g_select $1 $2 $3 $4
 elif  [ "$GMS_DEBUG" = "Z" ]; then
   echo " g_select ($1) ($2) ($3) ($4) ($5) ($6) ($7) ($8) ($9)" >> "$Z"
 fi
 
 # Chapters: ==================================================================
 
 # Not defined:
 
 if [ "$1" = "" ]; then
   source "$GMS_SHELL/l_banner" -no_action g_select
 
 # Resize: --------------------------------------------------------------------
   
 elif [ $1 = -resize ]; then
   export REPLY_OFFSET=3
   export REPLY_SIZE=17
   export REPLY_ITEMS=8
   
 # Update: --------------------------------------------------------------------
 
 elif [ $1 = -update ]; then
 # Cold:
   if [ "$3" = "" ]; then GMS_COLD=$GMS_HOT; else GMS_COLD=$3; fi
 # Hot:
   if [ "$2" = "" ]; then
     source "$GMS_SHELL/l_banner" -no_hot g_select
   else
     GMS_HOT="Q"
     case "$2" in
       "Q" | "q" | "1" ) GMS_HOT="Q";;
       "A" | "a" | "2" ) GMS_HOT="A";;
       "C" | "c" | "3" ) GMS_HOT="C";;
       "P" | "p" | "4" ) GMS_HOT="P";;
       "D" | "d" | "5" ) GMS_HOT="D";;
       "X" | "x" | "0" ) GMS_HOT="D";;
       "Y" | "y" | "o" ) GMS_HOT="D";;
       "E" | "e" | "6" ) GMS_HOT="E";;
       "I" | "i" ) GMS_HOT="E";;
       "U" | "u" | "7" ) GMS_HOT="U";;
       "L" | "l" | "8" ) GMS_HOT="L";;
     esac
   fi
 # Handle old, update new:
   if [ "$GMS_HOT" = "$GMS_COLD" ]; then
     source "$GMS_SHELL/g_select" -handle $GMS_HOT
   else
   # Banner:
     case "$GMS_HOT" in
       "Q" ) source "$GMS_SHELL/l_banner" -lower -first;;
       "A" ) source "$GMS_SHELL/l_banner" -lower -animate;;
       "U" | "L" ) source "$GMS_SHELL/l_banner" -lower -codepage;;
       "C" | "P" | "D" | "E" ) source "$GMS_SHELL/l_banner" -lower -select;;
     esac 
   # Debugging:
     if [ "$GMS_COLD" = "D" -a "$4" != "" ]; then
       case "$4" in
         "X" | "x" ) export GMS_DEBUG="X";;
         "Y" | "y" ) export GMS_DEBUG="Y";;
         "Z" | "z" ) export GMS_DEBUG="Z"
           source "$GMS_SHELL/g_select" -dbg_remove \
	     called_by g_select -update;;
         "O" | "o" | "0" ) export GMS_DEBUG="0"
           source "$GMS_SHELL/g_select" -dbg_remove \
	     called_by g_select -update;;
       esac 
       source "$GMS_SHELL/g_launch" -build called_by g_select -update
     fi 
   # Encoding:
     if [ "$GMS_COLD" = "E" -a "$4" != "" ]; then
       export GMS_CODEPAGE=$4 
     # Normalize writing:
       if [ "$4" = "ARABIC" ]; then export GMS_CODEPAGE=CP1256; fi
       if [ "$4" = "Arabic" ]; then export GMS_CODEPAGE=CP1256; fi
       if [ "$4" = "arabic" ]; then export GMS_CODEPAGE=CP1256; fi
       if [ "$4" = "ARABICBH" ]; then export GMS_CODEPAGE=CP1256; fi
       if [ "$4" = "ArabicBH" ]; then export GMS_CODEPAGE=CP1256; fi
       if [ "$4" = "arabicbh" ]; then export GMS_CODEPAGE=CP1256; fi
       if [ "$4" = "ARABICMT" ]; then export GMS_CODEPAGE=CP1256; fi
       if [ "$4" = "ArabicMT" ]; then export GMS_CODEPAGE=CP1256; fi
       if [ "$4" = "arabicmt" ]; then export GMS_CODEPAGE=CP1256; fi
       if [ "$4" = "ASCII" ]; then export GMS_CODEPAGE=US-ASCII; fi
       if [ "$4" = "Ascii" ]; then export GMS_CODEPAGE=US-ASCII; fi
       if [ "$4" = "ascii" ]; then export GMS_CODEPAGE=US-ASCII; fi
       if [ "$4" = "BALTIC" ]; then export GMS_CODEPAGE=CP1257; fi
       if [ "$4" = "Baltic" ]; then export GMS_CODEPAGE=CP1257; fi
       if [ "$4" = "baltic" ]; then export GMS_CODEPAGE=CP1257; fi
       if [ "$4" = "CANADA" ]; then export GMS_CODEPAGE=CP863; fi
       if [ "$4" = "Canada" ]; then export GMS_CODEPAGE=CP863; fi
       if [ "$4" = "canada" ]; then export GMS_CODEPAGE=CP863; fi
       if [ "$4" = "CENTRAL" ]; then export GMS_CODEPAGE=CP1250; fi
       if [ "$4" = "Central" ]; then export GMS_CODEPAGE=CP1250; fi
       if [ "$4" = "central" ]; then export GMS_CODEPAGE=CP1250; fi
       if [ "$4" = "Cp437" ]; then export GMS_CODEPAGE=CP437; fi
       if [ "$4" = "cp437" ]; then export GMS_CODEPAGE=CP437; fi
       if [ "$4" = "Cp850" ]; then export GMS_CODEPAGE=CP850; fi
       if [ "$4" = "cp850" ]; then export GMS_CODEPAGE=CP850; fi
       if [ "$4" = "Cp860" ]; then export GMS_CODEPAGE=CP860; fi
       if [ "$4" = "cp860" ]; then export GMS_CODEPAGE=CP860; fi
       if [ "$4" = "Cp863" ]; then export GMS_CODEPAGE=CP863; fi
       if [ "$4" = "cp863" ]; then export GMS_CODEPAGE=CP863; fi
       if [ "$4" = "Cp865" ]; then export GMS_CODEPAGE=CP865; fi
       if [ "$4" = "cp865" ]; then export GMS_CODEPAGE=CP865; fi
       if [ "$4" = "Cp874" ]; then export GMS_CODEPAGE=CP874; fi
       if [ "$4" = "cp874" ]; then export GMS_CODEPAGE=CP874; fi
       if [ "$4" = "Cp1250" ]; then export GMS_CODEPAGE=CP1250; fi
       if [ "$4" = "cp1250" ]; then export GMS_CODEPAGE=CP1250; fi
       if [ "$4" = "Cp1251" ]; then export GMS_CODEPAGE=CP1251; fi
       if [ "$4" = "cp1251" ]; then export GMS_CODEPAGE=CP1251; fi
       if [ "$4" = "Cp1252" ]; then export GMS_CODEPAGE=CP1252; fi
       if [ "$4" = "cp1252" ]; then export GMS_CODEPAGE=CP1252; fi
       if [ "$4" = "Cp1253" ]; then export GMS_CODEPAGE=CP1253; fi
       if [ "$4" = "cp1253" ]; then export GMS_CODEPAGE=CP1253; fi
       if [ "$4" = "Cp1254" ]; then export GMS_CODEPAGE=CP1254; fi
       if [ "$4" = "cp1254" ]; then export GMS_CODEPAGE=CP1254; fi
       if [ "$4" = "Cp1255" ]; then export GMS_CODEPAGE=CP1255; fi
       if [ "$4" = "cp1255" ]; then export GMS_CODEPAGE=CP1255; fi
       if [ "$4" = "Cp1256" ]; then export GMS_CODEPAGE=CP1256; fi
       if [ "$4" = "cp1256" ]; then export GMS_CODEPAGE=CP1256; fi
       if [ "$4" = "Cp1257" ]; then export GMS_CODEPAGE=CP1257; fi
       if [ "$4" = "cp1257" ]; then export GMS_CODEPAGE=CP1257; fi
       if [ "$4" = "Cp1258" ]; then export GMS_CODEPAGE=CP1258; fi
       if [ "$4" = "cp1258" ]; then export GMS_CODEPAGE=CP1258; fi
       if [ "$4" = "CYRILLIC" ]; then export GMS_CODEPAGE=CP1251; fi
       if [ "$4" = "Cyrillic" ]; then export GMS_CODEPAGE=CP1251; fi
       if [ "$4" = "cyrillic" ]; then export GMS_CODEPAGE=CP1251; fi
       if [ "$4" = "GREEK" ]; then export GMS_CODEPAGE=CP1253; fi
       if [ "$4" = "Greek" ]; then export GMS_CODEPAGE=CP1253; fi
       if [ "$4" = "greek" ]; then export GMS_CODEPAGE=CP1253; fi
       if [ "$4" = "HEBREW" ]; then export GMS_CODEPAGE=CP1255; fi
       if [ "$4" = "Hebrew" ]; then export GMS_CODEPAGE=CP1255; fi
       if [ "$4" = "hebrew" ]; then export GMS_CODEPAGE=CP1255; fi
       if [ "$4" = "INDIAN" ]; then export GMS_CODEPAGE=ISCII; fi
       if [ "$4" = "Indian" ]; then export GMS_CODEPAGE=ISCII; fi
       if [ "$4" = "indian" ]; then export GMS_CODEPAGE=ISCII; fi
       if [ "$4" = "Iscii" ]; then export GMS_CODEPAGE=ISCII; fi
       if [ "$4" = "iscii" ]; then export GMS_CODEPAGE=ISCII; fi
       if [ "$4" = "ISO-646" ]; then export GMS_CODEPAGE=ISO646; fi
       if [ "$4" = "ISO_646" ]; then export GMS_CODEPAGE=ISO646; fi
       if [ "$4" = "Iso-646" ]; then export GMS_CODEPAGE=ISO646; fi
       if [ "$4" = "Iso_646" ]; then export GMS_CODEPAGE=ISO646; fi
       if [ "$4" = "iso-646" ]; then export GMS_CODEPAGE=ISO646; fi
       if [ "$4" = "iso_646" ]; then export GMS_CODEPAGE=ISO646; fi
       if [ "$4" = "iso646" ]; then export GMS_CODEPAGE=ISO646; fi
       if [ "$4" = "ISO-8859-1" ]; then export GMS_CODEPAGE=I8859-1; fi
       if [ "$4" = "ISO_8859-1" ]; then export GMS_CODEPAGE=I8859-1; fi
       if [ "$4" = "Iso-8859-1" ]; then export GMS_CODEPAGE=I8859-1; fi
       if [ "$4" = "Iso_8859-1" ]; then export GMS_CODEPAGE=I8859-1; fi
       if [ "$4" = "iso-8859-1" ]; then export GMS_CODEPAGE=I8859-1; fi
       if [ "$4" = "iso_8859-1" ]; then export GMS_CODEPAGE=I8859-1; fi
       if [ "$4" = "ISO-8859-2" ]; then export GMS_CODEPAGE=I8859-2; fi
       if [ "$4" = "ISO_8859-2" ]; then export GMS_CODEPAGE=I8859-2; fi
       if [ "$4" = "Iso-8859-2" ]; then export GMS_CODEPAGE=I8859-2; fi
       if [ "$4" = "Iso_8859-2" ]; then export GMS_CODEPAGE=I8859-2; fi
       if [ "$4" = "iso-8859-2" ]; then export GMS_CODEPAGE=I8859-2; fi
       if [ "$4" = "iso_8859-2" ]; then export GMS_CODEPAGE=I8859-2; fi
       if [ "$4" = "ISO-8859-3" ]; then export GMS_CODEPAGE=I8859-3; fi
       if [ "$4" = "ISO_8859-3" ]; then export GMS_CODEPAGE=I8859-3; fi
       if [ "$4" = "Iso-8859-3" ]; then export GMS_CODEPAGE=I8859-3; fi
       if [ "$4" = "Iso_8859-3" ]; then export GMS_CODEPAGE=I8859-3; fi
       if [ "$4" = "iso-8859-3" ]; then export GMS_CODEPAGE=I8859-3; fi
       if [ "$4" = "iso_8859-3" ]; then export GMS_CODEPAGE=I8859-3; fi
       if [ "$4" = "ISO-8859-4" ]; then export GMS_CODEPAGE=I8859-4; fi
       if [ "$4" = "ISO_8859-4" ]; then export GMS_CODEPAGE=I8859-4; fi
       if [ "$4" = "Iso-8859-4" ]; then export GMS_CODEPAGE=I8859-4; fi
       if [ "$4" = "Iso_8859-4" ]; then export GMS_CODEPAGE=I8859-4; fi
       if [ "$4" = "iso-8859-4" ]; then export GMS_CODEPAGE=I8859-4; fi
       if [ "$4" = "iso_8859-4" ]; then export GMS_CODEPAGE=I8859-4; fi
       if [ "$4" = "ISO-8859-5" ]; then export GMS_CODEPAGE=I8859-5; fi
       if [ "$4" = "ISO_8859-5" ]; then export GMS_CODEPAGE=I8859-5; fi
       if [ "$4" = "Iso-8859-5" ]; then export GMS_CODEPAGE=I8859-5; fi
       if [ "$4" = "Iso_8859-5" ]; then export GMS_CODEPAGE=I8859-5; fi
       if [ "$4" = "iso-8859-5" ]; then export GMS_CODEPAGE=I8859-5; fi
       if [ "$4" = "iso_8859-5" ]; then export GMS_CODEPAGE=I8859-5; fi
       if [ "$4" = "ISO-8859-6" ]; then export GMS_CODEPAGE=I8859-6; fi
       if [ "$4" = "ISO_8859-6" ]; then export GMS_CODEPAGE=I8859-6; fi
       if [ "$4" = "Iso-8859-6" ]; then export GMS_CODEPAGE=I8859-6; fi
       if [ "$4" = "Iso_8859-6" ]; then export GMS_CODEPAGE=I8859-6; fi
       if [ "$4" = "iso-8859-6" ]; then export GMS_CODEPAGE=I8859-6; fi
       if [ "$4" = "iso_8859-6" ]; then export GMS_CODEPAGE=I8859-6; fi
       if [ "$4" = "ISO-8859-7" ]; then export GMS_CODEPAGE=I8859-7; fi
       if [ "$4" = "ISO_8859-7" ]; then export GMS_CODEPAGE=I8859-7; fi
       if [ "$4" = "Iso-8859-7" ]; then export GMS_CODEPAGE=I8859-7; fi
       if [ "$4" = "Iso_8859-7" ]; then export GMS_CODEPAGE=I8859-7; fi
       if [ "$4" = "iso-8859-7" ]; then export GMS_CODEPAGE=I8859-7; fi
       if [ "$4" = "iso_8859-7" ]; then export GMS_CODEPAGE=I8859-7; fi
       if [ "$4" = "ISO-8859-8" ]; then export GMS_CODEPAGE=I8859-8; fi
       if [ "$4" = "ISO_8859-8" ]; then export GMS_CODEPAGE=I8859-8; fi
       if [ "$4" = "Iso-8859-8" ]; then export GMS_CODEPAGE=I8859-8; fi
       if [ "$4" = "Iso_8859-8" ]; then export GMS_CODEPAGE=I8859-8; fi
       if [ "$4" = "iso-8859-8" ]; then export GMS_CODEPAGE=I8859-8; fi
       if [ "$4" = "iso_8859-8" ]; then export GMS_CODEPAGE=I8859-8; fi
       if [ "$4" = "ISO-8859-9" ]; then export GMS_CODEPAGE=I8859-9; fi
       if [ "$4" = "ISO_8859-9" ]; then export GMS_CODEPAGE=I8859-9; fi
       if [ "$4" = "Iso-8859-9" ]; then export GMS_CODEPAGE=I8859-9; fi
       if [ "$4" = "Iso_8859-9" ]; then export GMS_CODEPAGE=I8859-9; fi
       if [ "$4" = "iso-8859-9" ]; then export GMS_CODEPAGE=I8859-9; fi
       if [ "$4" = "iso_8859-9" ]; then export GMS_CODEPAGE=I8859-9; fi
       if [ "$4" = "ISO-8859-10" ]; then export GMS_CODEPAGE=I8859-10; fi
       if [ "$4" = "ISO_8859-10" ]; then export GMS_CODEPAGE=I8859-10; fi
       if [ "$4" = "Iso-8859-10" ]; then export GMS_CODEPAGE=I8859-10; fi
       if [ "$4" = "Iso_8859-10" ]; then export GMS_CODEPAGE=I8859-10; fi
       if [ "$4" = "iso-8859-10" ]; then export GMS_CODEPAGE=I8859-10; fi
       if [ "$4" = "iso_8859-10" ]; then export GMS_CODEPAGE=I8859-10; fi
       if [ "$4" = "ISO-8859-11" ]; then export GMS_CODEPAGE=I8859-11; fi
       if [ "$4" = "ISO_8859-11" ]; then export GMS_CODEPAGE=I8859-11; fi
       if [ "$4" = "Iso-8859-11" ]; then export GMS_CODEPAGE=I8859-11; fi
       if [ "$4" = "Iso_8859-11" ]; then export GMS_CODEPAGE=I8859-11; fi
       if [ "$4" = "iso-8859-11" ]; then export GMS_CODEPAGE=I8859-11; fi
       if [ "$4" = "iso_8859-11" ]; then export GMS_CODEPAGE=I8859-11; fi
       if [ "$4" = "ISO-8859-13" ]; then export GMS_CODEPAGE=I8859-13; fi
       if [ "$4" = "ISO_8859-13" ]; then export GMS_CODEPAGE=I8859-13; fi
       if [ "$4" = "Iso-8859-13" ]; then export GMS_CODEPAGE=I8859-13; fi
       if [ "$4" = "Iso_8859-13" ]; then export GMS_CODEPAGE=I8859-13; fi
       if [ "$4" = "iso-8859-13" ]; then export GMS_CODEPAGE=I8859-13; fi
       if [ "$4" = "iso_8859-13" ]; then export GMS_CODEPAGE=I8859-13; fi
       if [ "$4" = "ISO-8859-14" ]; then export GMS_CODEPAGE=I8859-14; fi
       if [ "$4" = "ISO_8859-14" ]; then export GMS_CODEPAGE=I8859-14; fi
       if [ "$4" = "Iso-8859-14" ]; then export GMS_CODEPAGE=I8859-14; fi
       if [ "$4" = "Iso_8859-14" ]; then export GMS_CODEPAGE=I8859-14; fi
       if [ "$4" = "iso-8859-14" ]; then export GMS_CODEPAGE=I8859-14; fi
       if [ "$4" = "iso_8859-14" ]; then export GMS_CODEPAGE=I8859-14; fi
       if [ "$4" = "ISO-8859-15" ]; then export GMS_CODEPAGE=I8859-15; fi
       if [ "$4" = "ISO_8859-15" ]; then export GMS_CODEPAGE=I8859-15; fi
       if [ "$4" = "Iso-8859-15" ]; then export GMS_CODEPAGE=I8859-15; fi
       if [ "$4" = "Iso_8859-15" ]; then export GMS_CODEPAGE=I8859-15; fi
       if [ "$4" = "iso-8859-15" ]; then export GMS_CODEPAGE=I8859-15; fi
       if [ "$4" = "iso_8859-15" ]; then export GMS_CODEPAGE=I8859-15; fi
       if [ "$4" = "LATIN" ]; then export GMS_CODEPAGE=CP1252; fi
       if [ "$4" = "Latin" ]; then export GMS_CODEPAGE=CP1252; fi
       if [ "$4" = "latin" ]; then export GMS_CODEPAGE=CP1252; fi
       if [ "$4" = "LATIN-1" ]; then export GMS_CODEPAGE=CP1252; fi
       if [ "$4" = "Latin-1" ]; then export GMS_CODEPAGE=CP1252; fi
       if [ "$4" = "latin-1" ]; then export GMS_CODEPAGE=CP1252; fi
       if [ "$4" = "LATIN-2" ]; then export GMS_CODEPAGE=CP1250; fi
       if [ "$4" = "Latin-2" ]; then export GMS_CODEPAGE=CP1250; fi
       if [ "$4" = "latin-2" ]; then export GMS_CODEPAGE=CP1250; fi
       if [ "$4" = "LATIN-5" ]; then export GMS_CODEPAGE=CP1254; fi
       if [ "$4" = "Latin-5" ]; then export GMS_CODEPAGE=CP1254; fi
       if [ "$4" = "latin-5" ]; then export GMS_CODEPAGE=CP1254; fi
       if [ "$4" = "MULTILINGUAL" ]; then export GMS_CODEPAGE=CP850; fi
       if [ "$4" = "Multilingual" ]; then export GMS_CODEPAGE=CP850; fi
       if [ "$4" = "multilingual" ]; then export GMS_CODEPAGE=CP850; fi
       if [ "$4" = "NORWAY" ]; then export GMS_CODEPAGE=CP865; fi
       if [ "$4" = "Norway" ]; then export GMS_CODEPAGE=CP865; fi
       if [ "$4" = "norway" ]; then export GMS_CODEPAGE=CP865; fi
       if [ "$4" = "PORTUGAL" ]; then export GMS_CODEPAGE=CP860; fi
       if [ "$4" = "Portugal" ]; then export GMS_CODEPAGE=CP860; fi
       if [ "$4" = "portugal" ]; then export GMS_CODEPAGE=CP860; fi
       if [ "$4" = "THAI" ]; then export GMS_CODEPAGE=CP874; fi
       if [ "$4" = "Thai" ]; then export GMS_CODEPAGE=CP874; fi
       if [ "$4" = "thai" ]; then export GMS_CODEPAGE=CP874; fi
       if [ "$4" = "TURKISH" ]; then export GMS_CODEPAGE=CP1254; fi
       if [ "$4" = "Turkish" ]; then export GMS_CODEPAGE=CP1254; fi
       if [ "$4" = "turkish" ]; then export GMS_CODEPAGE=CP1254; fi
       if [ "$4" = "USA" ]; then export GMS_CODEPAGE=CP437; fi
       if [ "$4" = "Usa" ]; then export GMS_CODEPAGE=CP437; fi
       if [ "$4" = "usa" ]; then export GMS_CODEPAGE=CP437; fi
       if [ "$4" = "US_ASCII" ]; then export GMS_CODEPAGE=US-ASCII; fi
       if [ "$4" = "Us_ascii" ]; then export GMS_CODEPAGE=US-ASCII; fi
       if [ "$4" = "us_ascii" ]; then export GMS_CODEPAGE=US-ASCII; fi
       if [ "$4" = "Us-ascii" ]; then export GMS_CODEPAGE=US-ASCII; fi
       if [ "$4" = "us-ascii" ]; then export GMS_CODEPAGE=US-ASCII; fi
       if [ "$4" = "VIETNAM" ]; then export GMS_CODEPAGE=VISCII; fi
       if [ "$4" = "Vietnam" ]; then export GMS_CODEPAGE=VISCII; fi
       if [ "$4" = "vietnam" ]; then export GMS_CODEPAGE=VISCII; fi
       if [ "$4" = "VIETNAMESE" ]; then export GMS_CODEPAGE=VISCII; fi
       if [ "$4" = "Vietnamese" ]; then export GMS_CODEPAGE=VISCII; fi
       if [ "$4" = "vietnamese" ]; then export GMS_CODEPAGE=VISCII; fi
       if [ "$4" = "Viscii" ]; then export GMS_CODEPAGE=VISCII; fi
       if [ "$4" = "viscii" ]; then export GMS_CODEPAGE=VISCII; fi
       if [ "$4" = "WESTERN" ]; then export GMS_CODEPAGE=CP1252; fi
       if [ "$4" = "Western" ]; then export GMS_CODEPAGE=CP1252; fi
       if [ "$4" = "western" ]; then export GMS_CODEPAGE=CP1252; fi
       if [ "$4" = "WINDOWS-1250" ]; then export GMS_CODEPAGE=CP1250; fi
       if [ "$4" = "Windows-1250" ]; then export GMS_CODEPAGE=CP1250; fi
       if [ "$4" = "windows-1250" ]; then export GMS_CODEPAGE=CP1250; fi
       if [ "$4" = "WINDOWS-1251" ]; then export GMS_CODEPAGE=CP1251; fi
       if [ "$4" = "Windows-1251" ]; then export GMS_CODEPAGE=CP1251; fi
       if [ "$4" = "windows-1251" ]; then export GMS_CODEPAGE=CP1251; fi
       if [ "$4" = "WINDOWS-1252" ]; then export GMS_CODEPAGE=CP1252; fi
       if [ "$4" = "Windows-1252" ]; then export GMS_CODEPAGE=CP1252; fi
       if [ "$4" = "windows-1252" ]; then export GMS_CODEPAGE=CP1252; fi
       if [ "$4" = "WINDOWS-1253" ]; then export GMS_CODEPAGE=CP1253; fi
       if [ "$4" = "Windows-1253" ]; then export GMS_CODEPAGE=CP1253; fi
       if [ "$4" = "windows-1253" ]; then export GMS_CODEPAGE=CP1253; fi
       if [ "$4" = "WINDOWS-1254" ]; then export GMS_CODEPAGE=CP1254; fi
       if [ "$4" = "Windows-1254" ]; then export GMS_CODEPAGE=CP1254; fi
       if [ "$4" = "WINDOWS-1254" ]; then export GMS_CODEPAGE=CP1254; fi
       if [ "$4" = "windows-1254" ]; then export GMS_CODEPAGE=CP1254; fi
       if [ "$4" = "WINDOWS-1255" ]; then export GMS_CODEPAGE=CP1255; fi
       if [ "$4" = "Windows-1255" ]; then export GMS_CODEPAGE=CP1255; fi
       if [ "$4" = "windows-1255" ]; then export GMS_CODEPAGE=CP1255; fi
       if [ "$4" = "WINDOWS-1256" ]; then export GMS_CODEPAGE=CP1256; fi
       if [ "$4" = "Windows-1256" ]; then export GMS_CODEPAGE=CP1256; fi
       if [ "$4" = "windows-1256" ]; then export GMS_CODEPAGE=CP1256; fi
       if [ "$4" = "WINDOWS-1257" ]; then export GMS_CODEPAGE=CP1257; fi
       if [ "$4" = "Windows-1257" ]; then export GMS_CODEPAGE=CP1257; fi
       if [ "$4" = "windows-1257" ]; then export GMS_CODEPAGE=CP1257; fi
       if [ "$4" = "WINDOWS-1258" ]; then export GMS_CODEPAGE=CP1258; fi
       if [ "$4" = "Windows-1258" ]; then export GMS_CODEPAGE=CP1258; fi
       if [ "$4" = "windows-1258" ]; then export GMS_CODEPAGE=CP1258; fi
       source "$GMS_SHELL/g_launch" -build called_by g_select -update
     fi
   # Select:
     if [ "$GMS_ANIMATE" = "on" ]; then
       source "$GMS_SHELL/l_select" -update $GMS_HOT $GMS_COLD "off"
     else
       source "$GMS_SHELL/l_select" -update $GMS_HOT $GMS_COLD " on"
     fi
   fi; export GMS_RECEIVE=1 
   
 # Build: ---------------------------------------------------------------------
 
 elif [ $1 = -build ]; then
   source "$GMS_SHELL/l_banner" -lower -select called_by g_select -build
   source "$GMS_SHELL/g_select" -resize called_by g_select -build
   source "$GMS_SHELL/l_box" -t11_build  called_by g_select -build
   if [ "$GMS_ANIMATE" = "on" ]; then
     source "$GMS_SHELL/l_select" -build "off" called_by g_select -build
   else source "$GMS_SHELL/l_select" -build " on" called_by g_select -build; fi
   source "$GMS_SHELL/l_select" -update Q Q called_by g_select -build
   export REPLY_MODULE=g_select
   export REPLY_ACTION=-update
   export GMS_RECEIVE=1
   export GMS_HOT="Q"
   
 # Remove: --------------------------------------------------------------------
 
 elif [ $1 = -remove ]; then
   source "$GMS_SHELL/g_select" -resize called_by g_select -remove
   source "$GMS_SHELL/l_box" -t11_remove called_by g_select -remove
   source "$GMS_SHELL/g_menu" -resize called_by g_select -remove
   source "$GMS_SHELL/l_box" -idle called_by g_select -remove
   source "$GMS_SHELL/g_menu" -update S Q called_by g_select -remove
   export REPLY_MODULE=g_menu
   export REPLY_ACTION=-update
   
# Remove debug banners: ------------------------------------------------------

 elif [ $1 = -dbg_remove ]; then 
    source "$GMS_SHELL/l_desk" -resize called_by g_select -dbg_remove
    "$GMS_REPLY" -stripe 2 $REPLY_PATTERN $REPLY_LETTER
    "$GMS_REPLY" -stripe 23 $REPLY_PATTERN $REPLY_LETTER
    source "$GMS_SHELL/g_select" -resize called_by g_select -dbg_remove
  
 # Handle: --------------------------------------------------------------------
   
 elif [ $1 = -handle ]; then
 
 # Quit:   
   if [ $2 = Q ]; then
   source "$GMS_SHELL/l_banner" -lower -folder called_by g_select -handle
   source "$GMS_SHELL/g_select" -remove called_by g_select -handle
   
 # Animation:   
   elif [ $2 = A ]; then
     if [ $GMS_ANIMATE = on ]; then
       export GMS_ANIMATE="off"
     else export GMS_ANIMATE="on"; fi
     source "$GMS_SHELL/g_launch" -build called_by g_select -handle
     source "$GMS_SHELL/g_select" -update A Q called_by g_select -handle
     export REPLY_MODULE=g_select
     export REPLY_ACTION=-update
   
 # Color:   
   elif [ $2 = C ]; then
     source "$GMS_SHELL/l_select" -update - C called_by g_select -handle
     source "$GMS_SHELL/l_select" -update - P called_by g_select -handle
     source "$GMS_SHELL/g_select" -resize called_by g_select -handle
     source "$GMS_SHELL/l_box" -t11_remove called_by g_select -handle
     source "$GMS_SHELL/g_rain" -build called_by g_select -handle
     source "$GMS_SHELL/g_color" -build called_by g_select -handle
   
 # Programs:   
   elif [ $2 = P ]; then
     source "$GMS_SHELL/l_select" -update - D called_by g_select -handle
     source "$GMS_SHELL/l_select" -update - P called_by g_select -handle
     source "$GMS_SHELL/g_prog" -build called_by g_select -handle
   
 # Debugging:   
   elif [ $2 = D ]; then
     source "$GMS_SHELL/l_banner" -lower -debug called_by g_select -handle
     source "$GMS_SHELL/l_select" -update - D called_by g_select -handle
     setterm -cursor on
       "$GMS_REPLY" -question 11 "$GMS_DEBUG" DD 5 called_by g_select -handle
     setterm -cursor off 
   
 # Encoding:   
   elif [ $2 = E ]; then
     source "$GMS_SHELL/l_banner" -lower -encode called_by g_select -handle
     source "$GMS_SHELL/l_select" -update - E called_by g_select -handle
     setterm -cursor on
       "$GMS_REPLY" -question 13 "$GMS_CODEPAGE" EE 6 \
         called_by g_select -handle
     setterm -cursor off 
   
 # Codepage (upper half):   
   elif [ $2 = U ]; then
     source "$GMS_SHELL/g_code" -cp_up_build called_by g_select -handle
   
 # Codepage (lower half):   
   elif [ $2 = L ]; then
     source "$GMS_SHELL/g_code" -cp_lo_build called_by g_select -handle
   
 # Not found: 
   else
     source "$GMS_SHELL/l_banner" -no_hotkey g_select $2   
   fi 
 
 # Not found: -----------------------------------------------------------------
 
 else
   source "$GMS_SHELL/l_banner" -no_action g_select $1   
 fi
