<commit_before># -*-Shell-script-*-
# Common eXist script functions and settings
# $Id:eXist-settings.sh 7231 2008-01-14 22:33:35Z wolfgang_m $

get_exist_home() {
	case "$1" in
		/*)
			p="$1"
		;;
		*)
			p="$PWD/$1"
		;;
	esac
		(cd $(/usr/bin/dirname "$p") ; /bin/pwd)
}

check_exist_home() {
    if [ -z "${EXIST_HOME}" ]; then
	EXIST_HOME_1=$(get_exist_home "$1");
	EXIST_HOME="$EXIST_HOME_1/..";
    fi

    if [ ! -f "${EXIST_HOME}/start.jar" ]; then
	echo "Unable to find start.jar. Please set EXIST_HOME to point to your installation directory." > /dev/stderr;
	exit 1;
    fi
    JAVA_ENDORSED_DIRS="$EXIST_HOME"/lib/endorsed
}

set_locale_lang() {
    if [ -n "${LANG}" ]; then
	OLD_LANG="${LANG}";
    fi
# set LANG to UTF-8
    if [ $(locale -a | grep -i "UTF-8" | head -n 1) ] || \
       [ $(locale -a | grep -i "utf8" | head -n 1) ]; then
	if [ $(echo "${LANG}" |grep "\.") ]; then
	    LANG=$(echo "${LANG}" | cut -f1 -d'.')
	    LANG="${LANG}".UTF-8
	else
	    LANG="${LANG}".UTF-8
	fi
    else
    # UTF-8 char map is unfortunately not available but we set it anyway...
	LANG=en_US.UTF-8
    fi
    export LANG
}

restore_locale_lang() {
    if [ -n "${OLD_LANG}" ]; then
	LANG="${OLD_LANG}";
	export LANG;
    fi
}

set_library_path() {
    if [ -n "$LD_LIBRARY_PATH" ]; then
	OLD_LIBRARY_PATH="${LD_LIBRARY_PATH}";
    fi
# add lib/core to LD_LIBRARY_PATH for readline support
    LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${EXIST_HOME}/lib/core";
    export LD_LIBRARY_PATH;
}

restore_library_path() {
    if [ -n "${OLD_LIBRARY_PATH}" ]; then
	LD_LIBRARY_PATH="${OLD_LIBRARY_PATH}";
	export LD_LIBRARY_PATH;
    fi
}

set_client_java_options() {
    if [ -z "${CLIENT_JAVA_OPTIONS}" ]; then
	CLIENT_JAVA_OPTIONS="-Xms128m -Xmx4096m -Dfile.encoding=UTF-8";
    fi
    JAVA_OPTIONS="${CLIENT_JAVA_OPTIONS} -Djava.endorsed.dirs=${JAVA_ENDORSED_DIRS}";
}

set_java_options() {
    if [ -z "${JAVA_OPTIONS}" ]; then
	JAVA_OPTIONS="-Xms128m -Xmx4096m -Dfile.encoding=UTF-8";
    fi
    JAVA_OPTIONS="${JAVA_OPTIONS} -Djava.endorsed.dirs=${JAVA_ENDORSED_DIRS}";
}
set_exist_options() {
    OPTIONS="-Dexist.home=$EXIST_HOME"
}

set_jetty_home() {
if [ -n "$JETTY_HOME" ]; then
	OPTIONS="-Djetty.home=$JETTY_HOME $OPTIONS"
fi
}<commit_msg>[revert] revert bad commit as part of commit 17380<commit_after># -*-Shell-script-*-
# Common eXist script functions and settings
# $Id:eXist-settings.sh 7231 2008-01-14 22:33:35Z wolfgang_m $

get_exist_home() {
	case "$1" in
		/*)
			p="$1"
		;;
		*)
			p="$PWD/$1"
		;;
	esac
		(cd $(/usr/bin/dirname "$p") ; /bin/pwd)
}

check_exist_home() {
    if [ -z "${EXIST_HOME}" ]; then
	EXIST_HOME_1=$(get_exist_home "$1");
	EXIST_HOME="$EXIST_HOME_1/..";
    fi

    if [ ! -f "${EXIST_HOME}/start.jar" ]; then
	echo "Unable to find start.jar. Please set EXIST_HOME to point to your installation directory." > /dev/stderr;
	exit 1;
    fi
    JAVA_ENDORSED_DIRS="$EXIST_HOME"/lib/endorsed
}

set_locale_lang() {
    if [ -n "${LANG}" ]; then
	OLD_LANG="${LANG}";
    fi
# set LANG to UTF-8
    if [ $(locale -a | grep -i "UTF-8" | head -n 1) ] || \
       [ $(locale -a | grep -i "utf8" | head -n 1) ]; then
	if [ $(echo "${LANG}" |grep "\.") ]; then
	    LANG=$(echo "${LANG}" | cut -f1 -d'.')
	    LANG="${LANG}".UTF-8
	else
	    LANG="${LANG}".UTF-8
	fi
    else
    # UTF-8 char map is unfortunately not available but we set it anyway...
	LANG=en_US.UTF-8
    fi
    export LANG
}

restore_locale_lang() {
    if [ -n "${OLD_LANG}" ]; then
	LANG="${OLD_LANG}";
	export LANG;
    fi
}

set_library_path() {
    if [ -n "$LD_LIBRARY_PATH" ]; then
	OLD_LIBRARY_PATH="${LD_LIBRARY_PATH}";
    fi
# add lib/core to LD_LIBRARY_PATH for readline support
    LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${EXIST_HOME}/lib/core";
    export LD_LIBRARY_PATH;
}

restore_library_path() {
    if [ -n "${OLD_LIBRARY_PATH}" ]; then
	LD_LIBRARY_PATH="${OLD_LIBRARY_PATH}";
	export LD_LIBRARY_PATH;
    fi
}

set_client_java_options() {
    if [ -z "${CLIENT_JAVA_OPTIONS}" ]; then
	CLIENT_JAVA_OPTIONS="-Xms128m -Xmx512m -Dfile.encoding=UTF-8";
    fi
    JAVA_OPTIONS="${CLIENT_JAVA_OPTIONS} -Djava.endorsed.dirs=${JAVA_ENDORSED_DIRS}";
}

set_java_options() {
    if [ -z "${JAVA_OPTIONS}" ]; then
	JAVA_OPTIONS="-Xms128m -Xmx512m -Dfile.encoding=UTF-8";
    fi
    JAVA_OPTIONS="${JAVA_OPTIONS} -Djava.endorsed.dirs=${JAVA_ENDORSED_DIRS}";
}
set_exist_options() {
    OPTIONS="-Dexist.home=$EXIST_HOME"
}

set_jetty_home() {
if [ -n "$JETTY_HOME" ]; then
	OPTIONS="-Djetty.home=$JETTY_HOME $OPTIONS"
fi
}
{'fraction_non_alphanumeric': 0.1790518191841235, 'fraction_numerical': 0.023153252480705624, 'mean_word_length': 3.442703232125367, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3376931', 'n_tokens_mistral': 2004, 'n_tokens_neox': 1860, 'n_words': 374}