summaryrefslogtreecommitdiff
path: root/test-lib.sh
blob: c3e359aaf705683f8012e786b560395f9a302c2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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