summaryrefslogtreecommitdiff
path: root/test-lib.sh
diff options
context:
space:
mode:
authorAndrej Shadura <andrewsh@debian.org>2018-05-08 15:59:29 +0200
committerAndrej Shadura <andrewsh@debian.org>2018-05-08 15:59:29 +0200
commit5b8466f7fae0e071c0f4eda13051c93313910028 (patch)
tree7061957f770e5e245ba00666dad912a2d44e7fdc /test-lib.sh
Import Upstream version 1.3.7
Diffstat (limited to 'test-lib.sh')
-rwxr-xr-xtest-lib.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/test-lib.sh b/test-lib.sh
new file mode 100755
index 0000000..c3e359a
--- /dev/null
+++ b/test-lib.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# the next line restarts using tclsh \
+exec tclsh "$0" "$@" || echo "0"; exit 1
+
+# --------------------------------------------------------
+# Copyright (C) Martin Ošmera <P16F87504SP@seznam.cz>
+# Licence: GPL
+# Version: 1.0
+# Homepage: http://sourceforge.net/projects/mcu8051ide
+# --------------------------------------------------------
+#
+# Test for presence of a Tcl library
+# Usage:
+# ./test-lib LIBRARY [VERSION]
+#
+# --------------------------------------------------------
+
+if {$argv == {--help}} {
+ puts "Test for presence of Tcl library"
+ puts "Usage:"
+ puts "\t./test-lib LIBRARY [VERSION]"
+}
+
+if {$argc == 2} {
+ if [catch {package require [lindex $argv 0] [lindex $argv 1]}] {
+ puts {0}
+ exit 1
+ }
+} elseif {$argc == 1} {
+ if [catch {package require [lindex $argv 0]}] {
+ puts {0}
+ exit 1
+ }
+} else {
+ puts {0}
+ exit 1
+}
+
+puts {1}
+exit 0
+