#!/bin/sh
# $Copyright$
# Copyright (C) Fujitsu Technology Solutions 2009
# All rights reserved
#
# $Copyright$
# Copyright (C) Fujitsu Siemens Computers GmbH 2003, 2004, 2005, 2006
# All rights reserved
#
# $Id: lcdisp.sh,v 1.18 2005-12-19 15:31:21+01 richter Exp richter $
#
# NAME
#	lcdisp - LCD Panel Configuration Program
#
# SYNOPSIS
#	lcdisp.sh [-h|-s|-u]
#	lcdisp.sh [-p {u|l} [-c] string]
#
# DESCRIPTION
# 	This script configures the System Information and User Information strings
#	of the LCD Panel. System Information consists of a subset of
#   13 preset system inforamtion strings. User Information consists of up
#	to 8 pairs of up to 20 char strings.
#
#   Pop-up mode of operation allows to write strings directly into
#	the upper or lower row onf the panel.
#
# OPTIONS
#	If called without options, the script displays the currently configured
#	Systems and User Information. Otherwise, option
#	h   displays this help information
#	s	configures System Information
#	u	configures User Information
#	p	write string in pop-up mode
#
# SEE ALSO
#	eecdcp(8)
#	ServerControl Command Interface (SCCI) Specification, 1.15, Dec. 2002
#
# EXIT STATUS
#	0 OK
#	1 Runtime Error
#	2 Argument Error
#
# DESIGN CONSIDERATIONS
# 	Assumptions w.r.t LCD System Information
#	o the set of value ID to choose the System Information from is fixed
#     to 0200 tru 020f, except 0206, 0209, 020e (13 values).
#   o from these the IDs 020a thru 020c represent IP addresses
#
# 	Assumptions w.r.t LCD User Information
#	o there are up to 16 strings, each 0 to 20 (printable) characters
#
# CHANGE HISTORY
#	Oct 2003, -rit
#		Initial implementation.

# ----------------------------------------------------------------------
# Initialization
# ----------------------------------------------------------------------
verbose=0

UL="_______________________________________________________________________"

EECDCP=eecdcp # myEecdcp

type tput >/dev/null 2>&1 && {
	hilite="$(tput smso)"				# set stand-out mode
	normal="$(tput rmso)"				# reset stand-out mode
}
VALUEIDPAT="0-578A-DFa-df"
promptu="${hilite}lcdisp [<nr> \"<string>\"|ok|cancel|clear|quit]>${normal} "
promptv="${hilite}lcdisp [[$VALUEIDPAT] ...|all|none|quit]>${normal} "


# Internationalized Messages

USAGE="#### Usage:
    $0 [-h|-s|-u]
    $0 [-p u|l [-c] <string>]
    Call without options shows LCD Panel System and User Information.
    Option (mutually exclusive):
    h   displays this help information
    c   center text in option -p
    p   writes <string> in pop-up mode, left-adjusted per default;
        u|l indicates 'u'pper or 'l'ower row.
    s   configures System Snformation
    u   configures User Information\n"

SYS_GUIDANCE="Configure your choice as space-separated characters from [$VALUEIDPAT],
or enter All or None or Quit to configure all or no string or terminate:\n"
USR_GUIDANCE="Configure your choices by entering per line the string number, white space,
and the double-quoted string up to 20 characters. Type OK or Cancel or Clear
or Quit to save or discard choices or clear all strings or terminate:\n"

READING_SYSINFO_MSG="#### Reading LCD System Information...\r"
LCD_SYSTEM_HEADER="____${hilite}LCD Panel System Information Strings${normal}_______________________________\n"
AVAILABLE_STRINGS="Available strings      Current value"
CONFIGURED_STRINGS="Configured strings     Current value\n"
CURRENT_STRINGS="Currently configured strings: "

READING_USRINFO_MSG="#### Reading LCD User Information...\r"
LCD_USER_HEADER="____${hilite}LCD Panel User Information Strings${normal}_________________________________\n"
CONFIGURED_USRSTRINGS="Configured User Information strings (N/A = not configured)\n"

SAVING_MSG="#### Saving new or changed LCD User Information.\n"
CLEARING_MSG="#### Clearing configured LCD User Information.\n"
DISCARDING_MSG="#### Discarding accumulated input.\n"

TERMINATING_MSG="#### Terminating LCD Panel configuration.\n"
INPUTCOMPLETE_MSG="#### Saving configured LCD System Information.\n"
CALLING_EECDCP_MSG="#### Calling: $EECDCP %s\n"

INVALIDNUMBER_ERRMSG="#### ERROR: The input %s is not a number from 1...16!\n"
INVALIDVALUEID_ERRMSG="#### ERROR: The input %s is not from {All|None|Quit|[%s]}!\n"
INVALIDQUOTES_ERRMSG="#### ERROR: This input string is not enclosed in double quotes!\n"
INVALIDLENGTH_ERRMSG="#### ERROR: This input length is not from 0...20 (without quotes)!\n"
INVALIDCHARS_ERRMSG="#### ERROR: This input contains non-printable ASCII characters!\n"
CONFIGURE_ERRMSG="#### ERROR: Cannot configure LCD User string [%s \"%s\"], status %s!\n"
CONFIGURE2_ERRMSG="#### ERROR: Cannot configure LCD User string number, status %s!\n"

# Constants (should be all CAPS)

CM_ReadCSV=E001			# CM_ReadConfigurationSpace
CM_WriteCSV=E002		# CM_WriteConfigurationSpace
CM_WriteDisplay=1002    # CM_WriteSystemDisplay
CSV_UserStrings=1100	# CSV_ConfUserDisplayStrings
CSV_NrUserStrings=1101	# CSV_ConfNrUserDisplayStrings
CSV_SysInfoVals=1110	# CSV_ConfDisplaySysInfoValues

allValueIDs="00 02 01 02 02 02 03 02 04 02 05 02 07 02 08 02 0a 02 0b 02 0c 02 0d 02 0f 02"

description[0]="System Location     "	# Description of the location of the system
description[1]="System Name         "	# The name of the system
description[2]="BIOS Version        "	# Version string of the system BIOS
description[3]="System Description  "	# Short description of the system
description[4]="System Administrator"	# Name of the System Administrator
description[5]="System Model        "	# A short description for the system
description[7]="System Serial Number"	# The serial number of the system
description[8]="System Vendor       "	# Name of the system vedor
description[10]="IP Address          "	# First IP address of the system
description[11]="IP Address 2        "	# Second IP address of the system
description[12]="IP Address 3        "	# Third IP address of the system
description[13]="IP Address 4        "	# Fourth IP address of the system
description[15]="Operating System    "	# Name of the running operating system

myCSV_UserStrings[0]=${myCSV_UserStrings[0]:="String 1"}
myCSV_UserStrings[2]=${myCSV_UserStrings[2]:="12345678901234567890"}
myCSV_UserStrings[3]=${myCSV_UserStrings[3]:=""}
myCSV_UserStrings[4]=${myCSV_UserStrings[4]:="String number 5"}

myCSV_NrUserStrings=${myCSV_NrUserStrings:=05}

action=show
adjust=l
status=0

# ----------------------------------------------------------------------
# Functions
# ----------------------------------------------------------------------

# showMsg - display a FORMATTED message to stdout or stderr
#
# $1	"ALWAYS" or "VERBOSE": node in which to display this message
# $2	1: to stdout, 2: to stderr
# $3ff	format [arguments] (see printf)

function showMsg {
	case $1 in
	VERBOSE)	[ $verbose -eq 0 ] && return ;;
	ALWAYS)	: ;;
	*)			return ;;
	esac

	where=$2
	shift 2
	[ $where -eq 1 ] && printf "$@"
	[ $where -eq 2 ] && printf >&2 "$@"
}

# eecdcpCmd - call eecdcp(8) with given arguments
#
# $1ff	additional arguments for eecdcp(8)

function eecdcpCmd {
	showMsg VERBOSE 2 "$CALLING_EECDCP_MSG" "$*"
	$EECDCP "$@" 2>/dev/null
}

# makeDottedIPaddr - transform $1 into familiar dotted IP address
#
# $1	a string of four IFS-separated hexdigit pairs

function makeDottedIPaddr {
	[ -z "$1" ] && {
		printf ""
		return
	}
	set $1
	let a=16#$1 b=16#$2 c=16#$3 d=16#$4
	printf "$a.$b.$c.$d"
}


# showConfSystemInfo - display LCD Panel System Information strings to stdout

function showConfSystemInfo {

	# Avoid that non-configured values make set display all variables

	confValues=$(eecdcpCmd -c oc=$CM_ReadCSV oe=$CSV_SysInfoVals)
	set ""
	[ -z "$confValues" ] || set $confValues

	printf "${LCD_SYSTEM_HEADER}\n"
	printf "$CONFIGURED_STRINGS"

	while true; do
		[ -z "$1" ] && break
		[ $1 = "06" -o $1 = "09" -o $1 = "0e" ] && {
			shift 2
			continue
		}
		num=${1#0}
		let idx=16#$1	# hexadecimal array idx does not appear to work

		value=$(eecdcpCmd -c oc=$CM_ReadCSV oe=02$1)

		if [ "$?" -eq 0 ]; then
			[ $idx -ge 10 -a $idx -le 13 ] && {
				value=$(makeDottedIPaddr "$value")
			}
			printf "$num ${description[$idx]} ${value//\"}\n"
		else
			printf "$num ${description[$idx]} N/A\n"
		fi

		shift 2
	done
	printf "$UL\n"
}


# showConfUserInfo - display LCD Panel User Information Strings to stdout

function showConfUserInfo {

	printf "$READING_USRINFO_MSG"
	values=$(eecdcpCmd -u)
	printf "$LCD_USER_HEADER\n"
	printf "$CONFIGURED_USRSTRINGS"
	printf "${values//\"}\n"
	printf "$UL\n"
}

# ----------------------------------------------------------------------
# Offline Test Functions - EXPERIMENTAL
# ----------------------------------------------------------------------

# myEecdcp - the eecdcp command for selftest

function myEecdcp {
	myCSV_SysInfo[ 0]="0200 \"Computer Room\""
	myCSV_SysInfo[ 1]="0201 \"MHPC01VC\""
	myCSV_SysInfo[ 2]="0202 \"4.06  Rev. 1.06A.1409           \""
	myCSV_SysInfo[ 3]="0203 \"LVP Test Server\""
	myCSV_SysInfo[ 4]="0204 \"Mr. Operator\""
	myCSV_SysInfo[ 5]="0205 \"PRIMERGY TX300\""
	myCSV_SysInfo[ 7]="0207 \"YBDU123456\""
	myCSV_SysInfo[ 8]="0208 \"Fujitsu Siemens\""
	myCSV_SysInfo[10]="020A \"172.25.124.123\""
	myCSV_SysInfo[11]="020B \"N/A\""
	myCSV_SysInfo[12]="020C \"N/A\""
	myCSV_SysInfo[13]="020D \"N/A\""
	myCSV_SysInfo[15]="020F \"SuSE Linux 8.1\""

	myCSV_SysInfoVals=${myCSV_SysInfoVals:=""}

	myPanelRows[0]=""
	myPanelRows[1]=""
	spaces="          "

	case $1 in
		-c)
			# Set string to LCD panel
			# Simulate LCD panel's 2 x 20 characters with adjustment, truncation and padding

			[ "$2" = "oc=1002" ] && {
				case $3 in
					oi=0)
						let n=${#5}-2 'm=(20-n)/2'

						myPanelRows[0]=${5:1:$n}
						myPanelRows[0]=${myPanelRows[0]:0:20}
						[ $4 -eq 1 ] && {
							myPanelRows[0]=${spaces:0:$m}${myPanelRows[0]}
						}
						;;
					oi=1)
						let n=${#5}-2 'm=(20-n)/2'

						myPanelRows[1]=${5:1:$n}
						myPanelRows[1]=${myPanelRows[1]:0:20}
						[ $4 -eq 1 ] && {
							myPanelRows[1]=${spaces:0:$m}${myPanelRows[1]}
						}
						;;
				esac

				printf "[%-20s]\n" "${myPanelRows[0]}"
				printf "[%-20s]\n" "${myPanelRows[1]}"
				return 0
			}

			# Get/Set CSV_[Nr]UserStrings

			[ "$2" = "oc=E001" -a "$3" = "oe=1101" ] && {
				printf "%02x 00\n" $myCSV_NrUserStrings
				return 0
			}
			[ "$2" = "oc=E002" -a "$3" = "oe=1101" ] && {
				myCSV_NrUserStrings=$4
				printf "$myCSV_NrUserStrings\n"
				return 0
			}

			[ "$2" = "oc=E002" -a "$3" = "oe=1100" ] && {
				let idx=16#${4#oi=}
				shift 4
				myCSV_UserStrings[$idx]="$*"
				printf "${myCSV_UserStrings[$idx]}\n"
				return 0
			}

			# Get/Set CSV_SysInfoVals array

			[ "$2" = "oc=E001" -a "$3" = "oe=1110" ] && {
				printf "$myCSV_SysInfoVals"
				return 0
			}
			[ "$2" = "oc=E002" -a "$3" = "oe=1110" ] && {
				shift 3
				myCSV_SysInfoVals="$*"
				printf "$myCSV_SysInfoVals\n"
				return 0
			}

			case $3 in
				oe=0200) printf "${myCSV_SysInfo[ 0]#* }" ;;
				oe=0201) printf "${myCSV_SysInfo[ 1]#* }" ;;
				oe=0202) printf "${myCSV_SysInfo[ 2]#* }" ;;
				oe=0203) printf "${myCSV_SysInfo[ 3]#* }" ;;
				oe=0204) printf "${myCSV_SysInfo[ 4]#* }" ;;
				oe=0205) printf "${myCSV_SysInfo[ 5]#* }" ;;
				oe=0207) printf "${myCSV_SysInfo[ 7]#* }" ;;
				oe=0208) printf "${myCSV_SysInfo[ 8]#* }" ;;
				oe=020A) printf "ac 19 7c 7d" ;;
				oe=020B) printf "" ;;
				oe=020C) return 1 ;;
				oe=020D) return 1 ;;
				oe=020F) printf "${myCSV_SysInfo[15]#* }" ;;
			esac
			return 0
			;;

		-s)
			printf "${myCSV_SysInfo[ 0]}\n"
			printf "${myCSV_SysInfo[ 1]}\n"
			printf "${myCSV_SysInfo[ 2]}\n"
			printf "${myCSV_SysInfo[ 3]}\n"
			printf "${myCSV_SysInfo[ 4]}\n"
			printf "${myCSV_SysInfo[ 5]}\n"
			printf "${myCSV_SysInfo[ 7]}\n"
			printf "${myCSV_SysInfo[ 8]}\n"
			printf "${myCSV_SysInfo[10]}\n"
			printf "${myCSV_SysInfo[11]}\n"
			printf "${myCSV_SysInfo[12]}\n"
			printf "${myCSV_SysInfo[13]}\n"
			printf "${myCSV_SysInfo[15]}\n"

			printf "$myCSV_SysInfoVals\n"
			return 0
			;;

		-u)
			for n in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
				[ $n -ge $myCSV_NrUserStrings ] && break
				printf " %d \"%-20s\"   " $((n + 1)) "${myCSV_UserStrings[$n]:="N/A"}"
				[ $((n % 2)) -eq 1 ] && printf "\n"
			done
			return 0
			;;

		*)
			printf "#### ERROR: Invalid option $1 passed to myEecdcp! Exit.\n"
			exit 1
			;;
	esac
}

# ----------------------------------------------------------------------
# Main
# ----------------------------------------------------------------------

# trap '' 1 2 15

while getopts hcp:su optChar; do
	case "$optChar" in
	c)	adjust=c ;;
	p)	action=popup ; rowarg=$OPTARG ;;
	s)	action=system ;;
	u)	action=user ;;
	h|[?])
		showMsg ALWAYS 2 "$USAGE"
		[ "$1" = "-h" ] && exit 0
		exit 2
		;;
	esac
done
shift `expr $OPTIND - 1`

case $action in
popup)
	[ $rowarg = "u" -o $rowarg = "l" ] && [ $# -gt 0 ] || {
		showMsg ALWAYS 2 "$USAGE"
		exit 2
	}

	row=0
	[ $rowarg = "l" ] && row=1
	adjustment=0
	[ $adjust = "c" ] && adjustment=1

	string=\"$1\"		# eecdcp accepts string if enclosed in quotes
	eecdcpCmd -c oc=$CM_WriteDisplay oi=$row $adjustment $string
	;;

show)
	showConfSystemInfo
	printf "\n"
	showConfUserInfo
	;;

system)
	showMsg VERBOSE 1 "$READING_SYSINFO_MSG"

	# Read system information strings via EECDCP and display available
	# as well as currently configured strings to the user to choose
	#
	# Example output from EECDCP -s:
	#	"0200" ""
	#	"0201" "MHPC01VC"
	#	"0202" "4.06  Rev. 1.06A.1409           "
	#	"0203" "LCP Test Server"
	#	"0204" "Mr. Operator"
	#	"0205" "PRIMERGY TX300"
	#	"0207" "YBDU123456"
	#	"0208" "Fujitsu Siemens"
	#	"020A" "172.25.124.123"
	#	"020B" "
	#	"020C" N/A
	#	"020D" N/A
	#	"020F" "SuSE Linux 8.1"
	#	"0201 0203 0205 0204 020D 020C 020B 020A 0200 0208 0202 020F"

	# NOTE:
	# o	The "eval set ..." strips the quotes around the strings returned by
	#   EECDCP. These serve to hide potential white spaces within the strings.
	# o We asume that there are at least 26 output arguments

	eval set $(eecdcpCmd -s)

	printf "${LCD_SYSTEM_HEADER}\n"

	printf "$AVAILABLE_STRINGS
0 ${description[ 0]} $2
1 ${description[ 1]} $4
2 ${description[ 2]} $6
3 ${description[ 3]} $8
4 ${description[ 4]} ${10}
5 ${description[ 5]} ${12}
7 ${description[ 7]} ${14}
8 ${description[ 8]} ${16}
a ${description[10]} ${18}
b ${description[11]} ${20}
c ${description[12]} ${22}
d ${description[13]} ${24}
f ${description[15]} ${26}\n\n"

	printf "$CURRENT_STRINGS"
	shift 26
	if [ ! -z "$1" ]; then
		confValueIDs=$*
		set $confValueIDs

		for val in $*; do
			printf "${val##020} "
		done
	else
		printf "none"
	fi

	printf "\n$UL\n"

	# User's answer MUST be string of space-separated chars from VALUEIDPAT

	data=""
	printf "$SYS_GUIDANCE"

	while true; do
		printf "$promptv"

		read answer
		[ -z "$answer" ] && break

		set $answer
		invalid=""
		for c in $*; do
			case $c in
				[Qq]|[Qq][Uu][Ii][Tt])	showMsg VERBOSE 2 "$TERMINATING_MSG" ; exit 0 ;;
				[Aa][Ll][Ll])		data=$allValueIDs ;;
				[Nn][Oo][Nn][Ee])	data=none ;;
				[$VALUEIDPAT])		data="$data 0$c 02" ;;
				*)          		invalid="$invalid $c" ;;
			esac
		done
		[ -z "$invalid" ] && break

		showMsg ALWAYS 1 "$INVALIDVALUEID_ERRMSG" "$invalid" $VALUEIDPAT
		answer=""
		data=""
	done

	# Change the LCD Panel System Information values with eecdcp

	showMsg VERBOSE 2 "$INPUTCOMPLETE_MSG"
	if [ "$data" = "none" ]; then
		eecdcpCmd -c oc=$CM_WriteCSV oe=$CSV_SysInfoVals
	elif [ -n "$data" ]; then
		eecdcpCmd -c oc=$CM_WriteCSV oe=$CSV_SysInfoVals $data > /dev/null
	fi
	status=$?
	[ $status -eq 0 ] && showConfSystemInfo
	;;

user)
	# Read and display user information strings via eecdcp

	showConfUserInfo

	stringNum=""
	printf "$USR_GUIDANCE"

	# User's input MUST be either a case-insensitive OK, Cancel, Clear, Quit
	# to act on accumulated input or a decimal number plus a dblquoted string.
	# Zero input is skipped, invalid input reported.

	while true; do
		printf "$promptu"

		read stringNum stringVal
		[ ${#stringNum} -eq 0 ] && continue

		case $stringNum in
			[Oo][Kk])					# Store accumulated changes
				showMsg VERBOSE 2 "$SAVING_MSG"
				break ;;

			[Cc][Ll][Ee][Aa][Rr])		# Clear all stored strings immediately
				showMsg VERBOSE 2 "$CLEARING_MSG"

				# Zero each of the User strings individually. Otherwise old
				# values show up again when the string number is raised.

				for n in 0 1 2 3 4 5 6 7 8 9 a b c d e f ; do
					eecdcpCmd -c oc=$CM_WriteCSV oe=$CSV_UserStrings oi=0$n ""
					status=$?
					[ $status -ne 0 ] && {
						showMsg ALWAYS 2 "CONFIGURE_ERRMSG" $n "" $status
						continue
					}
				done
				eecdcpCmd -c oc=$CM_WriteCSV oe=$CSV_NrUserStrings 00 00
				status=$?
				[ $status -ne 0 ] && {
					showMsg ALWAYS 2 "$CONFIGURE2_ERRMSG" $status
				}

				continue ;;

			[Cc][Aa][Nn][Cc][Ee][Ll])	# Discard all accumulated string changes
				showMsg VERBOSE 2 "$DISCARDING_MSG"
				unset userStrings
				continue ;;

			[Qq]|[Qq][Uu][Ii][Tt])		# Terminate this session without change
				showMsg VERBOSE 2 "$TERMINATING_MSG"
				exit 0 ;;

			[0-9] | [0-9][0-9])			# Accumulate input string num and value
				[ "$stringNum" -lt 1 -o "$stringNum" -gt 16 ] && {
					showMsg ALWAYS 1 "$INVALIDNUMBER_ERRMSG" $stringNum
					continue
				}

				# The input string value MUST be
				# - of length 2 to 22 byte (counted with the quotes)
				# - wrapped in double quotes
				# - consist only of printable (0x20 thru 0x7E) ASCII charcters
				#   SHOULD NOT include chars from class ["'`\]
				# Store valid input until comitted or discarded, each consisting
				# of the string number, ONE SPACE and the (dblquoted!) string.

				[ ${#stringVal} -lt 2 -o ${#stringVal} -gt 22 ] && {
					showMsg ALWAYS 1 "$INVALIDLENGTH_ERRMSG"
					continue
				}
				[ ${stringVal:0:1} != \" -o ${stringVal:${#stringVal}-1:1} != \" ] && {
					showMsg ALWAYS 1 "$INVALIDQUOTES_ERRMSG"
					continue
				}
				[ "$(echo $stringVal | tr -dc '[:print:]')" != "$stringVal" ] && {
					showMsg ALWAYS 1 "$INVALIDCHARS_ERRMSG"
					continue
				}

				userStrings[$stringNum]="$stringNum $stringVal"
				;;

			*)
				showMsg ALWAYS 1 "$INVALIDNUMBER_ERRMSG" $stringNum
				continue
				;;
		esac
	done

	# Change the LCD Panel User Information in userStrings[16] with eecdcp.
	# The CSV_UserStrings array in eecd has max. 16 entries numbered 0...f (hex)
	# of strings with 0...20 printable chars.

	maxIdx=0
	for idx in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ; do

		[ ${#userStrings[$idx]} -eq 0 ] && continue

		# Split the stored string at the 1st SPACE into the decimal string
		# number 1...16 and the string value and track the highest string number.

		stringNum=${userStrings[$idx]%% *}	# longest suffix " *"
		stringVal=${userStrings[$idx]#* }	# shortest prefix "* "

		[ $maxIdx \< $stringNum ] && maxIdx=$stringNum

		eecdcpCmd -c oc=$CM_WriteCSV oe=$CSV_UserStrings oi=$(printf "%02x" $((--stringNum))) $stringVal > /dev/null
		status=$?
		[ $status -ne 0 ] && {
			showMsg ALWAYS 2 "CONFIGURE_ERRMSG" $stringNum $stringVal $status
			continue
		}
	done

	# The (hex) number of entries 0000...1000 is maintained in CSV_NrUserStrings.
	#
	# Set the number of LCD User strings to the highest USED index + 1.
	# Note that eecdcp handles this number as TWO hexpairs in LSB order.

	n=$(eecdcpCmd -c oc=$CM_ReadCSV oe=$CSV_NrUserStrings)
	[ ${#n} -eq 0 ] && n=0

	let n=16#${n%% *}

	[ $n -lt $maxIdx ] && {
		eecdcpCmd -c oc=$CM_WriteCSV oe=$CSV_NrUserStrings $(printf "%02x 00" $((maxIdx))) > /dev/null
		status=$?
		[ $status -ne 0 ] && {
			showMsg ALWAYS 2 "$CONFIGURE2_ERRMSG" $status
		}
	}

	showConfUserInfo
	;;
esac

# ----------------------------------------------------------------------
# Done
# ----------------------------------------------------------------------

exit $status

# EOF
