Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlessJah <BlessJah@users.noreply.github.com>2018-01-17 19:12:36 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2018-01-17 19:12:36 +0300
commitd7d42d91036c580dd0fd367443f5c118f04cd345 (patch)
tree860f4ad988568b4129df1778492f586ec23b1123 /include/consts
parent16376193512b5edfa7a8b3f321de0f99c090a369 (diff)
remove non printable characters from code (#470)
Non printable ESC character is required to obtain terminal escape sequence i.e. for changing output color. Such sequences (especially ESC character) were replaced by command substitution producing exactly same result (variable value), but using only "safe" characters. Use of printf and especialy '\033' or '\0ddd' sequences is described here: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html#tag_20_94_13 Use of $(command) or command substitution is described here: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_03 Verbatim TAB characters were replaced with \t escape sequence as described to avoid problems with editors silently replacing them or developer accidentialy messing up the regex.
Diffstat (limited to 'include/consts')
-rw-r--r--include/consts38
1 files changed, 19 insertions, 19 deletions
diff --git a/include/consts b/include/consts
index e85c00b6..f49df395 100644
--- a/include/consts
+++ b/include/consts
@@ -329,33 +329,33 @@ unset LANG
#
# Normal color names
- CYAN=""
- BLUE=""
- BROWN=""
- DARKGRAY=""
- GRAY=""
- GREEN=""
- LIGHTBLUE=""
- MAGENTA=""
- PURPLE=""
- RED=""
- YELLOW=""
- WHITE=""
+ CYAN="$(printf '\033[0;36m')"
+ BLUE="$(printf '\033[0;34m')"
+ BROWN="$(printf '\033[0;33m')"
+ DARKGRAY="$(printf '\033[0;30m')"
+ GRAY="$(printf '\033[0;37m')"
+ GREEN="$(printf '\033[1;32m')"
+ LIGHTBLUE="$(printf '\033[0;94m')"
+ MAGENTA="$(printf '\033[1;35m')"
+ PURPLE="$(printf '\033[0;35m')"
+ RED="$(printf '\033[1;31m')"
+ YELLOW="$(printf '\033[1;33m')"
+ WHITE="$(printf '\033[1;37m')"
# Markup
BOLD="${WHITE}"
# With background
- BG_BLUE=""
+ BG_BLUE="$(printf '\033[0;44m')"
# Semantic names
HEADER="${WHITE}"
- NORMAL=""
- WARNING="" # Bad (red)
- SECTION="" # Section (yellow)
- NOTICE="" # Notice (yellow)
- OK="" # Ok (green)
- BAD="" # Bad (red)
+ NORMAL="$(printf '\033[0m')"
+ WARNING="${RED}"
+ SECTION="${YELLOW}"
+ NOTICE="${YELLOW}"
+ OK="${GREEN}"
+ BAD="${RED}"
#
#################################################################################