Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: banner.fth | |
4 | \ | |
5 | \ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
6 | \ | |
7 | \ - Do no alter or remove copyright notices | |
8 | \ | |
9 | \ - Redistribution and use of this software in source and binary forms, with | |
10 | \ or without modification, are permitted provided that the following | |
11 | \ conditions are met: | |
12 | \ | |
13 | \ - Redistribution of source code must retain the above copyright notice, | |
14 | \ this list of conditions and the following disclaimer. | |
15 | \ | |
16 | \ - Redistribution in binary form must reproduce the above copyright notice, | |
17 | \ this list of conditions and the following disclaimer in the | |
18 | \ documentation and/or other materials provided with the distribution. | |
19 | \ | |
20 | \ Neither the name of Sun Microsystems, Inc. or the names of contributors | |
21 | \ may be used to endorse or promote products derived from this software | |
22 | \ without specific prior written permission. | |
23 | \ | |
24 | \ This software is provided "AS IS," without a warranty of any kind. | |
25 | \ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, | |
26 | \ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A | |
27 | \ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN | |
28 | \ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR | |
29 | \ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR | |
30 | \ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN | |
31 | \ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR | |
32 | \ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE | |
33 | \ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, | |
34 | \ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF | |
35 | \ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. | |
36 | \ | |
37 | \ You acknowledge that this software is not designed, licensed or | |
38 | \ intended for use in the design, construction, operation or maintenance of | |
39 | \ any nuclear facility. | |
40 | \ | |
41 | \ ========== Copyright Header End ============================================ | |
42 | id: @(#)banner.fth 3.17 04/05/26 | |
43 | purpose: Displays banner describing system configuration | |
44 | copyright: Copyright 1990-2004 Sun Microsystems, Inc. All Rights Reserved | |
45 | copyright: Use is subject to license terms. | |
46 | ||
47 | headerless | |
48 | ||
49 | d# 128 constant max-logo-width | |
50 | ||
51 | variable logo? | |
52 | : ?spaces ( -- ) | |
53 | logo? @ if max-logo-width stdout-char-width / 2+ spaces then | |
54 | ; | |
55 | ||
56 | variable banner-start | |
57 | : .logo ( -- ) | |
58 | logo? @ if | |
59 | banner-start @ | |
60 | #line @ - stdout-line# + | |
61 | oem-logo? if oem-logo drop else sun-logo then ( line# adr ) | |
62 | logo-width logo-height stdout-draw-logo | |
63 | then | |
64 | ; | |
65 | ||
66 | : test-logo ( -- ) | |
67 | \ Decide in advance whether or not to display a logo so that the | |
68 | \ text information may be located correctly. | |
69 | ||
70 | false logo? ! | |
71 | ||
72 | stdout @ 0= if exit then | |
73 | ||
74 | " device_type" stdout @ ihandle>phandle get-package-property 0= if | |
75 | ( adr len ) get-encoded-string " display" $= logo? ! | |
76 | then | |
77 | ; | |
78 | ||
79 | \ If wrap mode is enabled, and there arent enough lines to display the | |
80 | \ banner (the banner occupies 6 lines) without wrapping, reposition | |
81 | \ banner to line 0 | |
82 | : test-wrap ( -- ) | |
83 | logo? @ if | |
84 | stdout @ package( | |
85 | #scroll-lines 0= if | |
86 | screen-#rows stdout-line# - 6 < if | |
87 | toggle-cursor | |
88 | 0 set-line | |
89 | then | |
90 | then | |
91 | )package | |
92 | then | |
93 | ; | |
94 | ||
95 | headers | |
96 | ||
97 | true value auto-banner? | |
98 | : suppress-banner ( -- ) false to auto-banner? ; | |
99 | ||
100 | : banner ( -- ) | |
101 | cr | |
102 | ||
103 | auto-banner? if " banner-" do-drop-in then | |
104 | ||
105 | test-logo | |
106 | ||
107 | test-wrap | |
108 | ||
109 | #line @ banner-start ! | |
110 | oem-banner? if | |
111 | cr ?spaces oem-banner type cr cr | |
112 | else | |
113 | ?spaces cpu-model type ." , " .keyboard-type cr | |
114 | ?spaces .copyrights | |
115 | ?spaces .rom ." , " .memory ." , " .serial cr | |
116 | [ifndef] RELEASE | |
117 | ?spaces sub-release ". cr | |
118 | [then] | |
119 | ?spaces .ether ." , " .hostid ." ." cr | |
120 | then | |
121 | ||
122 | cr cr | |
123 | ||
124 | idprom-valid? 0= if ." The IDPROM contents are invalid" cr then | |
125 | ||
126 | .logo cr | |
127 | ||
128 | auto-banner? if " banner+" do-drop-in then | |
129 | ||
130 | \ If "banner" is executed inside nvramrc, we may assume that the | |
131 | \ "probe-all install-console banner" sequence has been taken care of, | |
132 | \ so it isn't necessary to execute it again after nvramrc is finished. | |
133 | ||
134 | suppress-banner | |
135 | ; | |
136 | ||
137 | : ?banner ( -- ) min+mode? if banner else suppress-banner then ; |