version.4th revision 222417
1222417Sjulian\ Copyright (c) 2006-2011 Devin Teske <devinteske@hotmail.com>
2222417Sjulian\ All rights reserved.
3222417Sjulian\ 
4222417Sjulian\ Redistribution and use in source and binary forms, with or without
5222417Sjulian\ modification, are permitted provided that the following conditions
6222417Sjulian\ are met:
7222417Sjulian\ 1. Redistributions of source code must retain the above copyright
8222417Sjulian\    notice, this list of conditions and the following disclaimer.
9222417Sjulian\ 2. Redistributions in binary form must reproduce the above copyright
10222417Sjulian\    notice, this list of conditions and the following disclaimer in the
11222417Sjulian\    documentation and/or other materials provided with the distribution.
12222417Sjulian\ 
13222417Sjulian\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14222417Sjulian\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15222417Sjulian\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16222417Sjulian\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17222417Sjulian\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18222417Sjulian\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19222417Sjulian\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20222417Sjulian\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21222417Sjulian\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22222417Sjulian\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23222417Sjulian\ SUCH DAMAGE.
24222417Sjulian\ 
25222417Sjulian\ $FreeBSD: head/sys/boot/forth/version.4th 222417 2011-05-28 08:50:38Z julian $
26222417Sjulian
27222417Sjulianmarker task-version.4th
28222417Sjulian
29222417Sjulianvariable versionX
30222417Sjulianvariable versionY
31222417Sjulian
32222417Sjulian\ Initialize text placement to defaults
33222417Sjulian80 versionX !	\ NOTE: this is the ending column (text is right-justified)
34222417Sjulian24 versionY !
35222417Sjulian
36222417Sjulian: print_version ( -- )
37222417Sjulian
38222417Sjulian	\ Get the text placement position (if set)
39222417Sjulian	s" loader_version_x" getenv dup -1 <> if
40222417Sjulian		?number drop versionX ! -1
41222417Sjulian	then drop
42222417Sjulian	s" loader_version_y" getenv dup -1 <> if
43222417Sjulian		?number drop versionY ! -1
44222417Sjulian	then drop
45222417Sjulian
46222417Sjulian	\ Exit if a version was not set
47222417Sjulian	s" loader_version" getenv dup -1 = if
48222417Sjulian		drop exit
49222417Sjulian	then
50222417Sjulian
51222417Sjulian	\ Right justify the text
52222417Sjulian	dup versionX @ swap - versionY @ at-xy
53222417Sjulian
54222417Sjulian	\ Print the version (optionally in cyan)
55222417Sjulian	loader_color? if
56222417Sjulian		." [36m" type ." [37m"
57222417Sjulian	else
58222417Sjulian		type
59222417Sjulian	then
60222417Sjulian;
61