Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-release > by-pkgid > 13f5dcef5358e9d5a2a5a1ae6baf28fc > files > 178

gtkdialog-0.8.3-1.mga5.x86_64.rpm

#!/bin/sh

## Includes.
. funcrcfileGet
. funcrcfileWrite

## Read the rcfile.

funcrcfileRead() {
	if [ -z "$BASH" ]; then local FUNCNAME=funcrcfileRead; fi
	if [ $DEBUG_TRANSITS -ne 0 ]; then echo "$FUNCNAME: IN"; fi

	## Local variables.
	local sectionfound=0
	local char ifs name value version

	## Upgrade an old rcfile before reading it.
	version=`funcrcfileGet version`
	if [ $version \< $VERSION ]; then
		funcrcfileWrite $version
	fi

	ifs=$IFS
	IFS='='
	while read -r name value; do
		if [ -n "$name" ]; then
			if [ $sectionfound -eq 0 ]; then
				## Section start?
				if [ "$name" = "[options]" ]; then
					sectionfound=1
				fi
			else
				if [ -n "$BASH" ]; then
					char="${name:0:1}"
				else
					char="`echo $name | cut -c 1`"
				fi
				## Section end?
				if [ "$char" = '[' ]; then
					break
				elif [ "$char" != '#' -a -n "$value" ]; then
					## Store values.
					if [ "$name" = autonext_interval ]; then
						AUTONEXT_INTERVAL="$value"
					elif [ "$name" = debug_content ]; then
						DEBUG_CONTENT="$value"
					elif [ "$name" = debug_transits ]; then
						DEBUG_TRANSITS="$value"
					elif [ "$name" = cover_size ]; then
						COVER_SIZE="$value"
					elif [ "$name" = cover_thumb_size ]; then
						COVER_THUMB_SIZE="$value"
					elif [ "$name" = window_width ]; then
						WINDOW_WIDTH="$value"
					elif [ "$name" = cover_search_pattern ]; then
						COVER_SEARCH_PATTERN="$value"
					elif [ "$name" = dialog_readme_show ]; then
						DIALOG_README_SHOW="$value"
					fi
				fi
			fi
		fi
	done < $LOCAL_DATA_DIR/${TARGET}rc
	IFS=$ifs

	if [ $DEBUG_TRANSITS -ne 0 ]; then echo "$FUNCNAME: OUT"; fi
}