Changeset View
Changeset View
Standalone View
Standalone View
stand/forth/color.4th
Show All 22 Lines | |||||
\ 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. It returns TRUE if `loader_color' is set to any other value. | \ 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). | \ If `loader_color' is unset, TRUE is returned. | ||||
\ | \ | ||||
: loader_color? ( -- t ) | : loader_color? ( -- t ) | ||||
s" loader_color" getenv dup -1 <> if | s" loader_color" getenv dup -1 <> if | ||||
\ `loader_color' is set. | \ `loader_color' is set. | ||||
\ Check if it is explicitly disabled. | \ 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 | |||||
drop | |||||
\ It is enabled. | \ It is enabled. | ||||
TRUE | TRUE | ||||
else | |||||
\ `loader_color' is unset. | |||||
\ Default to using color unless serial boot is active. | |||||
drop | |||||
boot_serial? 0= | |||||
then | |||||
; | ; |