From 73ddf4aa7f96909a9e72f33a06db499cb9564c4a Mon Sep 17 00:00:00 2001
From: Michele Calgaro <michele.calgaro@yahoo.it>
Date: Thu, 1 Jan 2026 20:22:11 +0900
Subject: Move scripts folder to src/scripts

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
---
 Makefile.am                            |   2 +-
 configure.in                           |  10 +-
 scripts/Makefile.am                    |   5 -
 scripts/browser/Makefile.am            |   6 --
 scripts/browser/kvi_run_netscape       |  24 -----
 scripts/config/Makefile.am             |   6 --
 scripts/config/kvirc-config.in         | 189 ---------------------------------
 scripts/helpsearch/Makefile.am         |   6 --
 scripts/helpsearch/kvi_search_help     | 123 ---------------------
 src/Makefile.am                        |   2 +-
 src/scripts/Makefile.am                |   5 +
 src/scripts/browser/Makefile.am        |   6 ++
 src/scripts/browser/kvi_run_netscape   |  24 +++++
 src/scripts/config/Makefile.am         |   6 ++
 src/scripts/config/kvirc-config.in     | 189 +++++++++++++++++++++++++++++++++
 src/scripts/helpsearch/Makefile.am     |   6 ++
 src/scripts/helpsearch/kvi_search_help | 123 +++++++++++++++++++++
 17 files changed, 366 insertions(+), 366 deletions(-)
 delete mode 100644 scripts/Makefile.am
 delete mode 100644 scripts/browser/Makefile.am
 delete mode 100755 scripts/browser/kvi_run_netscape
 delete mode 100644 scripts/config/Makefile.am
 delete mode 100644 scripts/config/kvirc-config.in
 delete mode 100644 scripts/helpsearch/Makefile.am
 delete mode 100755 scripts/helpsearch/kvi_search_help
 create mode 100644 src/scripts/Makefile.am
 create mode 100644 src/scripts/browser/Makefile.am
 create mode 100755 src/scripts/browser/kvi_run_netscape
 create mode 100644 src/scripts/config/Makefile.am
 create mode 100644 src/scripts/config/kvirc-config.in
 create mode 100644 src/scripts/helpsearch/Makefile.am
 create mode 100755 src/scripts/helpsearch/kvi_search_help

diff --git a/Makefile.am b/Makefile.am
index c717165..01ef4bb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,7 +4,7 @@
 
 EXTRA_DIST    = autogen.sh README FAQ
 
-SUBDIRS          = admin data doc icons pics translations scripts src
+SUBDIRS          = admin data doc icons pics src translations
 
 AUTOMAKE_OPTIONS = foreign 
 
diff --git a/configure.in b/configure.in
index bdc13c3..cc201ed 100644
--- a/configure.in
+++ b/configure.in
@@ -168,11 +168,6 @@ AC_OUTPUT( \
 	translations/messages/kvirc-sharedfileswindow/Makefile \
 	translations/messages/kvirc-theme/Makefile \
 	translations/messages/kvirc-torrent/Makefile \
-	scripts/Makefile \
-	scripts/browser/Makefile \
-	scripts/config/Makefile \
-	scripts/config/kvirc-config \
-	scripts/helpsearch/Makefile \
 	src/Makefile \
 	src/kvilib/Makefile \
 	src/kvilib/build/Makefile \
@@ -264,5 +259,10 @@ AC_OUTPUT( \
 	src/modules/url/Makefile \
 	src/modules/url/caps/Makefile \
 	src/modules/window/Makefile \
+	src/scripts/Makefile \
+	src/scripts/browser/Makefile \
+	src/scripts/config/Makefile \
+	src/scripts/config/kvirc-config \
+	src/scripts/helpsearch/Makefile \
 	src/tdeconf_update/Makefile \
 )
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
deleted file mode 100644
index 15f3de1..0000000
--- a/scripts/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-###############################################################################
-# KVirc IRC client Makefile - 16.12.98 Szymon Stefanek <stefanek@tin.it>
-###############################################################################
-
-SUBDIRS          = browser config helpsearch
diff --git a/scripts/browser/Makefile.am b/scripts/browser/Makefile.am
deleted file mode 100644
index 6e5f216..0000000
--- a/scripts/browser/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-###############################################################################
-# KVirc Makefile 08.12.98 Szymon Stefanek
-###############################################################################
-bin_SCRIPTS = kvi_run_netscape
-
-EXTRA_DIST= $(bin_SCRIPTS)
diff --git a/scripts/browser/kvi_run_netscape b/scripts/browser/kvi_run_netscape
deleted file mode 100755
index 4ee301a..0000000
--- a/scripts/browser/kvi_run_netscape
+++ /dev/null
@@ -1,24 +0,0 @@
-#! /bin/sh
-
-set -e
-
-BROWSER=
-
-if [ -z "$1" ]; then
-	echo "Missing URL"
-else
-	for BROWSER in firefox seamonkey mozilla netscape ""; do
-		if [ -z "$BROWSER" ]; then 
-			echo "Could not find either Netscape or Mozilla"
-			exit 0
-		fi
-		if which "$BROWSER" > /dev/null; then
-			break;
-		fi
-	done
-		
-	if ! "$BROWSER" -remote "openURL($1)" 2> /dev/null; then
-		echo "$BROWSER is not currently running. Starting a new instance..."
-		exec "$BROWSER" "$1"
-	fi
-fi
diff --git a/scripts/config/Makefile.am b/scripts/config/Makefile.am
deleted file mode 100644
index 94c39e0..0000000
--- a/scripts/config/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-###############################################################################
-# KVirc Makefile 08.12.98 Szymon Stefanek
-###############################################################################
-bin_SCRIPTS = kvirc-config
-
-EXTRA_DIST= kvirc-config.in
diff --git a/scripts/config/kvirc-config.in b/scripts/config/kvirc-config.in
deleted file mode 100644
index 2427a56..0000000
--- a/scripts/config/kvirc-config.in
+++ /dev/null
@@ -1,189 +0,0 @@
-#!/bin/sh
-
-#
-#   A script for retrieving the latest KVIrc IRC Client build configuration
-#   Mainly used for building plugins out of the source tree
-#   The idea is "stolen" from the gtk-config and xmms-config scripts :)
-#
-#   09-04-2000 Szymon Stefanek (Initial release)
-#   31-01-2002 Szymon Stefanek (Revised for KVIrc 3.0.0)
-#   27-07-2002 Szymon Stefanek (Revised again for KVIrc 3.0.0)
-#
-#   This program is FREE software. You can redistribute it and/or
-#   modify it under the terms of the GNU General Public License
-#   as published by the Free Software Foundation; either version 2
-#   of the License, or (at your opinion) any later version.
-#
-#   This program is distributed in the HOPE that it will be USEFUL,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-#   See the GNU General Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License
-#   along with this program. If not, write to the Free Software Foundation,
-#   Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-
-set -e
-
-srcdir="@srcdir@"
-top_srcdir="@top_srcdir@"
-prefix="@prefix@"
-exec_prefix="@exec_prefix@"
-
-bindir="@bindir@"
-sbindir="@sbindir@"
-libexecdir="@libexecdir@"
-datadir="@datadir@"
-sysconfdir="@sysconfdir@"
-sharedstatedir="@sharedstatedir@"
-localstatedir="@localstatedir@"
-libdir="@libdir@"
-infodir="@infodir@"
-mandir="@mandir@"
-includedir="@includedir@"
-oldincludedir="/usr/include"
-headersdir="@headersdir@"
-configdir="@configdir@"
-configmodulesdir="@configmodulesdir@"
-defscriptdir="@defscriptdir@"
-globalkvircdir="@globalkvircdir@"
-helpdir="@helpdir@"
-iconapps32datadir="@iconapps32datadir@"
-iconapps48datadir="@iconapps48datadir@"
-iconmime32datadir="@iconmime32datadir@"
-iconmime48datadir="@iconmime48datadir@"
-install_sh="@install_sh@"
-kdeservicesdir="@kdeservicesdir@"
-licensedir="@licensedir@"
-localedir="@localedir@"
-mimelnkdir="@mimelnkdir@"
-picsdir="@globalkvircdir@/pics"
-pluglibdir="@pluglibdir@"
-topdir="@topdir@"
-xdg_apps="@xdg_apps@"
-
-
-build_alias="@build_alias@"
-build_triplet="@build@"
-host_alias="@host_alias@"
-host_triplet="@host@"
-target_alias="@target_alias@"
-target_triplet="@target@"
-
-SS_CPPFLAGS="@SS_CPPFLAGS@"
-SS_INCDIRS="@SS_INCDIRS@"
-SS_LDFLAGS="@SS_LDFLAGS@"
-SS_LIBDIRS="@SS_LIBDIRS@"
-SS_LIBLINK="@SS_LIBLINK@"
-SS_MSGFMT="@SS_MSGFMT@"
-SS_QT_MOC="@SS_QT_MOC@"
-SS_RPATH="@SS_RPATH@"
-SS_TOPSRCDIR="@SS_TOPSRCDIR@"
-VERSION="@VERSION@"
-
-print_syntax()
-{
-	echo "kvirc-config (KVIrc @VERSION@)"
-	echo "	A script for retrieving the latest KVIrc build configuration"
-	echo ""
-	echo "Syntax : kvirc-config [OPTIONS]"
-	echo "  options:"
-	echo "    --version         : KVIrc version"
-	echo "    --prefix          : Intallation prefix"
-	echo "    --include_dir     : KVIrc include directory (where headers are stored)"
-	echo "    --exec_prefix     : Binaries installation prefix"
-	echo "    --rpath_flags     : Rpath flags used in the KVIrc compilation"
-	echo "    --cpp_flags       : CPP flags used in the KVIrc compilation"
-	echo "    --include_dirs    : Include directories used in the KVIrc compilation"
-	echo "    --ld_flags        : Linker flags used in the KVirc compilation"
-	echo "    --lib_dirs        : Library directories used in the KVIrc compilation"
-	echo "    --libraries       : External libraries that KVIrc has been linked to"
-	echo "    --qt_moc_path     : TQt meta object compiler path"
-	echo "    --modules_dir     : KVIrc modules dir"
-	echo "    --plugin_dir      : Compat alias for modules_dir"
-	echo "    --bin_dir         : KVIrc binaries installation directory"
-	echo "    --lib_dir         : KVIrc libraries installation directory"
-	echo "    --help_dir        : KVIrc help files installation directory"
-	echo "    --locale_dir      : KVIrc translation files directory"
-	echo "    --pics_dir        : KVIrc shared pictures directory"
-    exit 0
-}
-
-if test $# -eq 0; then
-    print_syntax 1 1>&2
-fi
-
-SS_STUFF_TO_ECHO=""
-
-while test $# -gt 0; do
-    case "$1" in
-		-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
-		*) optarg= ;;
-    esac
-
-    case $1 in
-	--prefix)
-	    SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $prefix"
-	    ;;
-	--exec_prefix)
-	    SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $exec_prefix"
-	    ;;
-	--include_dir)
-		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $headersdir"
-		;;
-	--version)
-		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $VERSION"
-		;;
-	--rpath_flags)
-		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_RPATH"
-		;;
-	--qt_moc_path)
-		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_QT_MOC"
-		;;
-	--cpp_flags)
-		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_CPPFLAGS"
-		;;
-	--include_dirs)
-		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_INCDIRS"
-		;;
-	--ld_flags)
-		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_LDFLAGS"
-		;;
-	--lib_dirs)
-		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_LIBDIRS"
-		;;
-	--libraries)
-		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_LIBLINK"
-		;;
-	--plugin_dir)
-		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $pluglibdir"
-		;;
-	--modules_dir)
-		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $pluglibdir"
-		;;
-	--bin_dir)
-		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $bindir"
-		;;
-	--lib_dir)
-		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $libdir"
-		;;
-	--help_dir)
-		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $helpdir"
-		;;
-	--locale_dir)
-		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $localedir"
-		;;
-	--pics_dir)
-		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $picsdir"
-		;;
-	*)
-	    print_syntax 1 1>&2
-	    ;;
-    esac
-  shift
-done
-
-if test -n "$SS_STUFF_TO_ECHO"; then
-	echo $SS_STUFF_TO_ECHO
-fi
diff --git a/scripts/helpsearch/Makefile.am b/scripts/helpsearch/Makefile.am
deleted file mode 100644
index 45f812a..0000000
--- a/scripts/helpsearch/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-###############################################################################
-# KVirc Makefile 08.12.98 Szymon Stefanek
-###############################################################################
-bin_SCRIPTS = kvi_search_help
-
-EXTRA_DIST= $(bin_SCRIPTS)
diff --git a/scripts/helpsearch/kvi_search_help b/scripts/helpsearch/kvi_search_help
deleted file mode 100755
index bf962f1..0000000
--- a/scripts/helpsearch/kvi_search_help
+++ /dev/null
@@ -1,123 +0,0 @@
-#!/bin/sh
-
-# Arguments:
-# $1 = directory to search in
-# $2 = filename to produce
-# $3- = search string
-
-if test -z "$1"; then
-	echo "Search error : missing files to search"
-	exit -1
-fi
-
-if test -z "$2"; then
-	echo "Search error : missing target filename"
-	exit -1
-fi
-
-if test -z "$3"; then
-	echo "Search error : missing search string"
-	exit -1
-fi
-
-# Build the search criteria string...not so funky, but works
-
-SEARCH_CRITERIA="$3"
-SEARCH_WORDS="$3"
-
-if test -n "$4"; then
-	SEARCH_WORDS="$SEARCH_WORDS $4"
-	SEARCH_CRITERIA="$SEARCH_CRITERIA AND $4"
-fi
-if test -n "$5"; then
-	SEARCH_WORDS="$SEARCH_WORDS $5"
-	SEARCH_CRITERIA="$SEARCH_CRITERIA AND $5"
-fi
-if test -n "$6"; then
-	SEARCH_WORDS="$SEARCH_WORDS $6"
-	SEARCH_CRITERIA="$SEARCH_CRITERIA AND $6"
-fi
-if test -n "$7"; then
-	SEARCH_WORDS="$SEARCH_WORDS $7"
-	SEARCH_CRITERIA="$SEARCH_CRITERIA AND $7"
-fi
-if test -n "$8"; then
-	SEARCH_WORDS="$SEARCH_WORDS $8"
-	SEARCH_CRITERIA="$SEARCH_CRITERIA AND $8"
-fi
-if test -n "$9"; then
-	SEARCH_WORDS="$SEARCH_WORDS $9"
-	SEARCH_CRITERIA="$SEARCH_CRITERIA AND $9"
-fi
-
-
-DOCUMENT="<html>
-<head><title>Search results</title></head>
-<body bgcolor=\"#FFFFFF\" text=\"#000000\">
-KVirc documentation<br>
-<hr>
-<table bgcolor=\"#A0A0A0\" width=\"100%\">
-<tr>
-	<td><h1>Search results for \"$SEARCH_CRITERIA\"</h1></td>
-</tr>
-"
-
-FILES_TO_SEARCH=`find $1 -name "*.html"`
-
-if test -z "$FILES_TO_SEARCH"; then
-	DOCUMENT="$DOCUMENT <tr bgcolor=\"#F0F0F0\"></td><b>Internal error: no files to search</b></td></tr></table><hr><a href=\"index.html\">Main index</a></html>"
-	echo "$DOCUMENT" > $2
-	exit 0
-fi
-
-# Now grep the files
-SEARCH_RESULT=""
-for a_word in $SEARCH_WORDS; do	
-	if test -z "$SEARCH_RESULT"; then
-		SEARCH_RESULT=`grep -i -l $a_word $FILES_TO_SEARCH`
-	else
-		SEARCH_RESULT=`grep -i -l $a_word $SEARCH_RESULT`
-	fi
-	if test -z "$SEARCH_RESULT"; then
-
-		DOCUMENT="$DOCUMENT <tr bgcolor=\"#F0F0F0\"><td><b>No matches found</b></td></tr></table><hr><a href=\"index.html\">Main index</a></html>"
-		echo "$DOCUMENT" > $2
-		exit 0
-	fi
-done
-
-DOCS_COUNT="0"
-
-for a_file in $SEARCH_RESULT; do
-
-	RESULT_DESCRIPTION="<b>["
-	for a_word in $SEARCH_WORDS; do
-		WORD_MATCHES=`grep -i -h -c $a_word "$a_file"`
-		RESULT_DESCRIPTION="$RESULT_DESCRIPTION $a_word:$WORD_MATCHES  "
-	done
-	RESULT_DESCRIPTION="$RESULT_DESCRIPTION ]</b>"
-	
-	DOC_TITLE=`grep -i -h "<title>" "$a_file" | sed -e 's/title/b/g'`
-	if test -z "$DOC_TITLE"; then
-		DOC_TITLE="<b>Untitled</b>"
-	fi	
-	DOC_PREMATCH=`grep -i -h -A 30 "searchbody" "$a_file" | tac | tail -n 30 | tac`
-	DOC_MATCH=`echo "$DOC_PREMATCH" | sed -e 's/<[a-zA-Z0-9 _	\=\"\#\%\&\/\.]*>/ /g'`
-	DOC_MATCH=`echo "$DOC_MATCH" | sed -e 's/</\&lt/g'`
-	DOC_MATCH=`echo "$DOC_MATCH" | sed -e 's/>/\&gt/g'`
-	DOC_MATCH=`echo "$DOC_MATCH" | grep -h "[a-zA-Z0-9{}]"`
-	DOC_MATCH=`echo "$DOC_MATCH" | sed -e 's/^[	 ]*//'`
-	DOC_MATCH=`echo "$DOC_MATCH" | tac | tail -n 10 | tac`
-	if test -z "$DOC_MATCH"; then
-		DOC_MATCH="No document body found"
-	fi
-
-	DOCS_COUNT=`expr $DOCS_COUNT + 1`
-
-	DOCUMENT="$DOCUMENT <tr bgcolor=\"#F0F0F0\"><td><a href=\"$a_file\"><b>$DOCS_COUNT</b>. $DOC_TITLE</a><br><br><I>...$DOC_MATCH...</I><br><br><b>$RESULT_DESCRIPTION</b></td></tr>"
-
-done
-
-DOCUMENT="$DOCUMENT</table><hr><br>Found $DOCS_COUNT matches</html>"
-
-echo "$DOCUMENT" > $2
diff --git a/src/Makefile.am b/src/Makefile.am
index c1ba059..22c92d3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,7 +2,7 @@
 # KVirc IRC client Makefile - 16.12.98 Szymon Stefanek <stefanek@tin.it>
 ###############################################################################
 
-SUBDIRS          = kvilib kvirc modules tdeconf_update
+SUBDIRS = kvilib kvirc modules scripts tdeconf_update
 
 headers_HEADERS=kvi_configstatus.h
 
diff --git a/src/scripts/Makefile.am b/src/scripts/Makefile.am
new file mode 100644
index 0000000..15f3de1
--- /dev/null
+++ b/src/scripts/Makefile.am
@@ -0,0 +1,5 @@
+###############################################################################
+# KVirc IRC client Makefile - 16.12.98 Szymon Stefanek <stefanek@tin.it>
+###############################################################################
+
+SUBDIRS          = browser config helpsearch
diff --git a/src/scripts/browser/Makefile.am b/src/scripts/browser/Makefile.am
new file mode 100644
index 0000000..6e5f216
--- /dev/null
+++ b/src/scripts/browser/Makefile.am
@@ -0,0 +1,6 @@
+###############################################################################
+# KVirc Makefile 08.12.98 Szymon Stefanek
+###############################################################################
+bin_SCRIPTS = kvi_run_netscape
+
+EXTRA_DIST= $(bin_SCRIPTS)
diff --git a/src/scripts/browser/kvi_run_netscape b/src/scripts/browser/kvi_run_netscape
new file mode 100755
index 0000000..4ee301a
--- /dev/null
+++ b/src/scripts/browser/kvi_run_netscape
@@ -0,0 +1,24 @@
+#! /bin/sh
+
+set -e
+
+BROWSER=
+
+if [ -z "$1" ]; then
+	echo "Missing URL"
+else
+	for BROWSER in firefox seamonkey mozilla netscape ""; do
+		if [ -z "$BROWSER" ]; then 
+			echo "Could not find either Netscape or Mozilla"
+			exit 0
+		fi
+		if which "$BROWSER" > /dev/null; then
+			break;
+		fi
+	done
+		
+	if ! "$BROWSER" -remote "openURL($1)" 2> /dev/null; then
+		echo "$BROWSER is not currently running. Starting a new instance..."
+		exec "$BROWSER" "$1"
+	fi
+fi
diff --git a/src/scripts/config/Makefile.am b/src/scripts/config/Makefile.am
new file mode 100644
index 0000000..94c39e0
--- /dev/null
+++ b/src/scripts/config/Makefile.am
@@ -0,0 +1,6 @@
+###############################################################################
+# KVirc Makefile 08.12.98 Szymon Stefanek
+###############################################################################
+bin_SCRIPTS = kvirc-config
+
+EXTRA_DIST= kvirc-config.in
diff --git a/src/scripts/config/kvirc-config.in b/src/scripts/config/kvirc-config.in
new file mode 100644
index 0000000..2427a56
--- /dev/null
+++ b/src/scripts/config/kvirc-config.in
@@ -0,0 +1,189 @@
+#!/bin/sh
+
+#
+#   A script for retrieving the latest KVIrc IRC Client build configuration
+#   Mainly used for building plugins out of the source tree
+#   The idea is "stolen" from the gtk-config and xmms-config scripts :)
+#
+#   09-04-2000 Szymon Stefanek (Initial release)
+#   31-01-2002 Szymon Stefanek (Revised for KVIrc 3.0.0)
+#   27-07-2002 Szymon Stefanek (Revised again for KVIrc 3.0.0)
+#
+#   This program is FREE software. You can redistribute it and/or
+#   modify it under the terms of the GNU General Public License
+#   as published by the Free Software Foundation; either version 2
+#   of the License, or (at your opinion) any later version.
+#
+#   This program is distributed in the HOPE that it will be USEFUL,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#   See the GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program. If not, write to the Free Software Foundation,
+#   Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+set -e
+
+srcdir="@srcdir@"
+top_srcdir="@top_srcdir@"
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+
+bindir="@bindir@"
+sbindir="@sbindir@"
+libexecdir="@libexecdir@"
+datadir="@datadir@"
+sysconfdir="@sysconfdir@"
+sharedstatedir="@sharedstatedir@"
+localstatedir="@localstatedir@"
+libdir="@libdir@"
+infodir="@infodir@"
+mandir="@mandir@"
+includedir="@includedir@"
+oldincludedir="/usr/include"
+headersdir="@headersdir@"
+configdir="@configdir@"
+configmodulesdir="@configmodulesdir@"
+defscriptdir="@defscriptdir@"
+globalkvircdir="@globalkvircdir@"
+helpdir="@helpdir@"
+iconapps32datadir="@iconapps32datadir@"
+iconapps48datadir="@iconapps48datadir@"
+iconmime32datadir="@iconmime32datadir@"
+iconmime48datadir="@iconmime48datadir@"
+install_sh="@install_sh@"
+kdeservicesdir="@kdeservicesdir@"
+licensedir="@licensedir@"
+localedir="@localedir@"
+mimelnkdir="@mimelnkdir@"
+picsdir="@globalkvircdir@/pics"
+pluglibdir="@pluglibdir@"
+topdir="@topdir@"
+xdg_apps="@xdg_apps@"
+
+
+build_alias="@build_alias@"
+build_triplet="@build@"
+host_alias="@host_alias@"
+host_triplet="@host@"
+target_alias="@target_alias@"
+target_triplet="@target@"
+
+SS_CPPFLAGS="@SS_CPPFLAGS@"
+SS_INCDIRS="@SS_INCDIRS@"
+SS_LDFLAGS="@SS_LDFLAGS@"
+SS_LIBDIRS="@SS_LIBDIRS@"
+SS_LIBLINK="@SS_LIBLINK@"
+SS_MSGFMT="@SS_MSGFMT@"
+SS_QT_MOC="@SS_QT_MOC@"
+SS_RPATH="@SS_RPATH@"
+SS_TOPSRCDIR="@SS_TOPSRCDIR@"
+VERSION="@VERSION@"
+
+print_syntax()
+{
+	echo "kvirc-config (KVIrc @VERSION@)"
+	echo "	A script for retrieving the latest KVIrc build configuration"
+	echo ""
+	echo "Syntax : kvirc-config [OPTIONS]"
+	echo "  options:"
+	echo "    --version         : KVIrc version"
+	echo "    --prefix          : Intallation prefix"
+	echo "    --include_dir     : KVIrc include directory (where headers are stored)"
+	echo "    --exec_prefix     : Binaries installation prefix"
+	echo "    --rpath_flags     : Rpath flags used in the KVIrc compilation"
+	echo "    --cpp_flags       : CPP flags used in the KVIrc compilation"
+	echo "    --include_dirs    : Include directories used in the KVIrc compilation"
+	echo "    --ld_flags        : Linker flags used in the KVirc compilation"
+	echo "    --lib_dirs        : Library directories used in the KVIrc compilation"
+	echo "    --libraries       : External libraries that KVIrc has been linked to"
+	echo "    --qt_moc_path     : TQt meta object compiler path"
+	echo "    --modules_dir     : KVIrc modules dir"
+	echo "    --plugin_dir      : Compat alias for modules_dir"
+	echo "    --bin_dir         : KVIrc binaries installation directory"
+	echo "    --lib_dir         : KVIrc libraries installation directory"
+	echo "    --help_dir        : KVIrc help files installation directory"
+	echo "    --locale_dir      : KVIrc translation files directory"
+	echo "    --pics_dir        : KVIrc shared pictures directory"
+    exit 0
+}
+
+if test $# -eq 0; then
+    print_syntax 1 1>&2
+fi
+
+SS_STUFF_TO_ECHO=""
+
+while test $# -gt 0; do
+    case "$1" in
+		-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+		*) optarg= ;;
+    esac
+
+    case $1 in
+	--prefix)
+	    SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $prefix"
+	    ;;
+	--exec_prefix)
+	    SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $exec_prefix"
+	    ;;
+	--include_dir)
+		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $headersdir"
+		;;
+	--version)
+		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $VERSION"
+		;;
+	--rpath_flags)
+		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_RPATH"
+		;;
+	--qt_moc_path)
+		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_QT_MOC"
+		;;
+	--cpp_flags)
+		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_CPPFLAGS"
+		;;
+	--include_dirs)
+		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_INCDIRS"
+		;;
+	--ld_flags)
+		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_LDFLAGS"
+		;;
+	--lib_dirs)
+		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_LIBDIRS"
+		;;
+	--libraries)
+		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_LIBLINK"
+		;;
+	--plugin_dir)
+		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $pluglibdir"
+		;;
+	--modules_dir)
+		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $pluglibdir"
+		;;
+	--bin_dir)
+		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $bindir"
+		;;
+	--lib_dir)
+		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $libdir"
+		;;
+	--help_dir)
+		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $helpdir"
+		;;
+	--locale_dir)
+		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $localedir"
+		;;
+	--pics_dir)
+		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $picsdir"
+		;;
+	*)
+	    print_syntax 1 1>&2
+	    ;;
+    esac
+  shift
+done
+
+if test -n "$SS_STUFF_TO_ECHO"; then
+	echo $SS_STUFF_TO_ECHO
+fi
diff --git a/src/scripts/helpsearch/Makefile.am b/src/scripts/helpsearch/Makefile.am
new file mode 100644
index 0000000..45f812a
--- /dev/null
+++ b/src/scripts/helpsearch/Makefile.am
@@ -0,0 +1,6 @@
+###############################################################################
+# KVirc Makefile 08.12.98 Szymon Stefanek
+###############################################################################
+bin_SCRIPTS = kvi_search_help
+
+EXTRA_DIST= $(bin_SCRIPTS)
diff --git a/src/scripts/helpsearch/kvi_search_help b/src/scripts/helpsearch/kvi_search_help
new file mode 100755
index 0000000..bf962f1
--- /dev/null
+++ b/src/scripts/helpsearch/kvi_search_help
@@ -0,0 +1,123 @@
+#!/bin/sh
+
+# Arguments:
+# $1 = directory to search in
+# $2 = filename to produce
+# $3- = search string
+
+if test -z "$1"; then
+	echo "Search error : missing files to search"
+	exit -1
+fi
+
+if test -z "$2"; then
+	echo "Search error : missing target filename"
+	exit -1
+fi
+
+if test -z "$3"; then
+	echo "Search error : missing search string"
+	exit -1
+fi
+
+# Build the search criteria string...not so funky, but works
+
+SEARCH_CRITERIA="$3"
+SEARCH_WORDS="$3"
+
+if test -n "$4"; then
+	SEARCH_WORDS="$SEARCH_WORDS $4"
+	SEARCH_CRITERIA="$SEARCH_CRITERIA AND $4"
+fi
+if test -n "$5"; then
+	SEARCH_WORDS="$SEARCH_WORDS $5"
+	SEARCH_CRITERIA="$SEARCH_CRITERIA AND $5"
+fi
+if test -n "$6"; then
+	SEARCH_WORDS="$SEARCH_WORDS $6"
+	SEARCH_CRITERIA="$SEARCH_CRITERIA AND $6"
+fi
+if test -n "$7"; then
+	SEARCH_WORDS="$SEARCH_WORDS $7"
+	SEARCH_CRITERIA="$SEARCH_CRITERIA AND $7"
+fi
+if test -n "$8"; then
+	SEARCH_WORDS="$SEARCH_WORDS $8"
+	SEARCH_CRITERIA="$SEARCH_CRITERIA AND $8"
+fi
+if test -n "$9"; then
+	SEARCH_WORDS="$SEARCH_WORDS $9"
+	SEARCH_CRITERIA="$SEARCH_CRITERIA AND $9"
+fi
+
+
+DOCUMENT="<html>
+<head><title>Search results</title></head>
+<body bgcolor=\"#FFFFFF\" text=\"#000000\">
+KVirc documentation<br>
+<hr>
+<table bgcolor=\"#A0A0A0\" width=\"100%\">
+<tr>
+	<td><h1>Search results for \"$SEARCH_CRITERIA\"</h1></td>
+</tr>
+"
+
+FILES_TO_SEARCH=`find $1 -name "*.html"`
+
+if test -z "$FILES_TO_SEARCH"; then
+	DOCUMENT="$DOCUMENT <tr bgcolor=\"#F0F0F0\"></td><b>Internal error: no files to search</b></td></tr></table><hr><a href=\"index.html\">Main index</a></html>"
+	echo "$DOCUMENT" > $2
+	exit 0
+fi
+
+# Now grep the files
+SEARCH_RESULT=""
+for a_word in $SEARCH_WORDS; do	
+	if test -z "$SEARCH_RESULT"; then
+		SEARCH_RESULT=`grep -i -l $a_word $FILES_TO_SEARCH`
+	else
+		SEARCH_RESULT=`grep -i -l $a_word $SEARCH_RESULT`
+	fi
+	if test -z "$SEARCH_RESULT"; then
+
+		DOCUMENT="$DOCUMENT <tr bgcolor=\"#F0F0F0\"><td><b>No matches found</b></td></tr></table><hr><a href=\"index.html\">Main index</a></html>"
+		echo "$DOCUMENT" > $2
+		exit 0
+	fi
+done
+
+DOCS_COUNT="0"
+
+for a_file in $SEARCH_RESULT; do
+
+	RESULT_DESCRIPTION="<b>["
+	for a_word in $SEARCH_WORDS; do
+		WORD_MATCHES=`grep -i -h -c $a_word "$a_file"`
+		RESULT_DESCRIPTION="$RESULT_DESCRIPTION $a_word:$WORD_MATCHES  "
+	done
+	RESULT_DESCRIPTION="$RESULT_DESCRIPTION ]</b>"
+	
+	DOC_TITLE=`grep -i -h "<title>" "$a_file" | sed -e 's/title/b/g'`
+	if test -z "$DOC_TITLE"; then
+		DOC_TITLE="<b>Untitled</b>"
+	fi	
+	DOC_PREMATCH=`grep -i -h -A 30 "searchbody" "$a_file" | tac | tail -n 30 | tac`
+	DOC_MATCH=`echo "$DOC_PREMATCH" | sed -e 's/<[a-zA-Z0-9 _	\=\"\#\%\&\/\.]*>/ /g'`
+	DOC_MATCH=`echo "$DOC_MATCH" | sed -e 's/</\&lt/g'`
+	DOC_MATCH=`echo "$DOC_MATCH" | sed -e 's/>/\&gt/g'`
+	DOC_MATCH=`echo "$DOC_MATCH" | grep -h "[a-zA-Z0-9{}]"`
+	DOC_MATCH=`echo "$DOC_MATCH" | sed -e 's/^[	 ]*//'`
+	DOC_MATCH=`echo "$DOC_MATCH" | tac | tail -n 10 | tac`
+	if test -z "$DOC_MATCH"; then
+		DOC_MATCH="No document body found"
+	fi
+
+	DOCS_COUNT=`expr $DOCS_COUNT + 1`
+
+	DOCUMENT="$DOCUMENT <tr bgcolor=\"#F0F0F0\"><td><a href=\"$a_file\"><b>$DOCS_COUNT</b>. $DOC_TITLE</a><br><br><I>...$DOC_MATCH...</I><br><br><b>$RESULT_DESCRIPTION</b></td></tr>"
+
+done
+
+DOCUMENT="$DOCUMENT</table><hr><br>Found $DOCS_COUNT matches</html>"
+
+echo "$DOCUMENT" > $2
-- 
cgit v1.2.3

