Changeset View
Changeset View
Standalone View
Standalone View
head/stand/forth/color.4th
Show All 21 Lines | |||||
\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | \ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
\ SUCH DAMAGE. | \ SUCH DAMAGE. | ||||
\ | \ | ||||
\ $FreeBSD$ | \ $FreeBSD$ | ||||
marker task-color.4th | marker task-color.4th | ||||
\ This function returns FALSE if the `loader_color' environment variable is set | \ This function returns FALSE if the `loader_color' environment variable is set | ||||
\ to NO, no, or 0. Otherwise, TRUE is returned (unless booting serial). | \ to NO, no, or 0. It returns TRUE if `loader_color' is set to any other value. | ||||
\ If `loader_color' is unset, TRUE is returned (unless booting serial). | |||||
\ | \ | ||||
: loader_color? ( -- N ) | : loader_color? ( -- t ) | ||||
s" loader_color" getenv dup -1 <> if | s" loader_color" getenv dup -1 <> if | ||||
\ `loader_color' is set. | |||||
\ Check if it is explicitly disabled. | |||||
2dup s" NO" compare-insensitive 0= if | 2dup s" NO" compare-insensitive 0= if | ||||
2drop | 2drop | ||||
FALSE exit | FALSE exit | ||||
then | then | ||||
2dup s" 0" compare 0= if | 2dup s" 0" compare 0= if | ||||
2drop | 2drop | ||||
FALSE exit | FALSE exit | ||||
then | then | ||||
drop | drop | ||||
then | \ It is enabled. | ||||
TRUE | |||||
else | |||||
\ `loader_color' is unset. | |||||
\ Default to using color unless serial boot is active. | |||||
drop | drop | ||||
boot_serial? 0= | |||||
boot_serial? if FALSE else TRUE then | then | ||||
; | ; |