Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 730432 | Differences between
and this patch

Collapse All | Expand All

(-)a/functions.sh (-29 / +27 lines)
Lines 84-89 esyslog() Link Here
84
	return 0
84
	return 0
85
}
85
}
86
86
87
eprintf()
88
{
89
	local fmt=$1
90
	local color=$2
91
	shift 2
92
	if ! yesno "${RC_ENDCOL}" && [ "${LAST_E_CMD}" = "ebegin" ]; then
93
		printf "\n"
94
	fi
95
	printf "${fmt}" "${color}*${NORMAL} ${RC_INDENTATION}$*"
96
}
97
87
#
98
#
88
#    show an informative message (without a newline)
99
#    show an informative message (without a newline)
89
#
100
#
Lines 92-101 einfon() Link Here
92
	if yesno "${EINFO_QUIET}"; then
103
	if yesno "${EINFO_QUIET}"; then
93
		return 0
104
		return 0
94
	fi
105
	fi
95
	if ! yesno "${RC_ENDCOL}" && [ "${LAST_E_CMD}" = "ebegin" ]; then
106
	eprintf "%s" "${GOOD}" "$@"
96
		printf "\n"
97
	fi
98
	printf " ${GOOD}*${NORMAL} ${RC_INDENTATION}$*"
99
	LAST_E_CMD="einfon"
107
	LAST_E_CMD="einfon"
100
	return 0
108
	return 0
101
}
109
}
Lines 105-111 einfon() Link Here
105
#
113
#
106
einfo()
114
einfo()
107
{
115
{
108
	einfon "$*\n"
116
	if yesno "${EINFO_QUIET}"; then
117
		return 0
118
	fi
119
	eprintf "%s\n" "${GOOD}" "$@"
109
	LAST_E_CMD="einfo"
120
	LAST_E_CMD="einfo"
110
	return 0
121
	return 0
111
}
122
}
Lines 117-129 ewarnn() Link Here
117
{
128
{
118
	if yesno "${EINFO_QUIET}"; then
129
	if yesno "${EINFO_QUIET}"; then
119
		return 0
130
		return 0
120
	else
121
		if ! yesno "${RC_ENDCOL}" && [ "${LAST_E_CMD}" = "ebegin" ]; then
122
			printf "\n" >&2
123
		fi
124
		printf " ${WARN}*${NORMAL} ${RC_INDENTATION}$*" >&2
125
	fi
131
	fi
126
132
133
	eprintf "%s" "${WARN}" "$@" >&2
134
127
	local name="${0##*/}"
135
	local name="${0##*/}"
128
	# Log warnings to system log
136
	# Log warnings to system log
129
	esyslog "daemon.warning" "${name}" "$*"
137
	esyslog "daemon.warning" "${name}" "$*"
Lines 139-151 ewarn() Link Here
139
{
147
{
140
	if yesno "${EINFO_QUIET}"; then
148
	if yesno "${EINFO_QUIET}"; then
141
		return 0
149
		return 0
142
	else
143
		if ! yesno "${RC_ENDCOL}" && [ "${LAST_E_CMD}" = "ebegin" ]; then
144
			printf "\n" >&2
145
		fi
146
		printf " ${WARN}*${NORMAL} ${RC_INDENTATION}$*\n" >&2
147
	fi
150
	fi
148
151
152
	eprintf "%s\n" "${WARN}" "$@" >&2
153
149
	local name="${0##*/}"
154
	local name="${0##*/}"
150
	# Log warnings to system log
155
	# Log warnings to system log
151
	esyslog "daemon.warning" "${name}" "$*"
156
	esyslog "daemon.warning" "${name}" "$*"
Lines 161-173 eerrorn() Link Here
161
{
166
{
162
	if yesno "${EERROR_QUIET}"; then
167
	if yesno "${EERROR_QUIET}"; then
163
		return 1
168
		return 1
164
	else
165
		if ! yesno "${RC_ENDCOL}" && [ "${LAST_E_CMD}" = "ebegin" ]; then
166
			printf "\n" >&2
167
		fi
168
		printf " ${BAD}*${NORMAL} ${RC_INDENTATION}$*" >&2
169
	fi
169
	fi
170
170
171
	eprintf "%s" "${BAD}" "$@" >&2
172
171
	local name="${0##*/}"
173
	local name="${0##*/}"
172
	# Log errors to system log
174
	# Log errors to system log
173
	esyslog "daemon.err" "rc-scripts" "$*"
175
	esyslog "daemon.err" "rc-scripts" "$*"
Lines 183-195 eerror() Link Here
183
{
185
{
184
	if yesno "${EERROR_QUIET}"; then
186
	if yesno "${EERROR_QUIET}"; then
185
		return 1
187
		return 1
186
	else
187
		if ! yesno "${RC_ENDCOL}" && [ "${LAST_E_CMD}" = "ebegin" ]; then
188
			printf "\n" >&2
189
		fi
190
		printf " ${BAD}*${NORMAL} ${RC_INDENTATION}$*\n" >&2
191
	fi
188
	fi
192
189
190
	eprintf "%s\n" "${BAD}" "$@" >&2
191
193
	local name="${0##*/}"
192
	local name="${0##*/}"
194
	# Log errors to system log
193
	# Log errors to system log
195
	esyslog "daemon.err" "rc-scripts" "$*"
194
	esyslog "daemon.err" "rc-scripts" "$*"
Lines 247-253 _eend() Link Here
247
	fi
246
	fi
248
247
249
	if yesno "${RC_ENDCOL}"; then
248
	if yesno "${RC_ENDCOL}"; then
250
		printf "${ENDCOL}  ${msg}\n"
249
		printf "${ENDCOL}  %s\n" "${msg}"
251
	else
250
	else
252
		[ "${LAST_E_CMD}" = ebegin ] || LAST_E_LEN=0
251
		[ "${LAST_E_CMD}" = ebegin ] || LAST_E_LEN=0
253
		printf "%$(( COLS - LAST_E_LEN - 6 ))s%b\n" '' "${msg}"
252
		printf "%$(( COLS - LAST_E_LEN - 6 ))s%b\n" '' "${msg}"
Lines 345-351 get_libdir() Link Here
345
	elif command -v portageq > /dev/null 2>&1; then
344
	elif command -v portageq > /dev/null 2>&1; then
346
		CONF_LIBDIR="$(portageq envvar CONF_LIBDIR)"
345
		CONF_LIBDIR="$(portageq envvar CONF_LIBDIR)"
347
	fi
346
	fi
348
	printf "${CONF_LIBDIR:=lib}\n"
347
	printf "%s\n" "${CONF_LIBDIR:=lib}"
349
}
348
}
350
349
351
#
350
#
Lines 440-446 done Link Here
440
# Setup COLS and ENDCOL so eend can line up the [ ok ]
439
# Setup COLS and ENDCOL so eend can line up the [ ok ]
441
COLS="${COLUMNS:-0}"            # bash's internal COLUMNS variable
440
COLS="${COLUMNS:-0}"            # bash's internal COLUMNS variable
442
[ "$COLS" -eq 0 ] && \
441
[ "$COLS" -eq 0 ] && \
443
        COLS="$(set -- $(stty size 2>/dev/null) ; printf "$2\n")"
442
        COLS="$(set -- $(stty size 2>/dev/null) ; printf "%s\n" "$2")"
444
[ -z "$COLS" ] && COLS=80
443
[ -z "$COLS" ] && COLS=80
445
[ "$COLS" -gt 0 ] || COLS=80	# width of [ ok ] == 7
444
[ "$COLS" -gt 0 ] || COLS=80	# width of [ ok ] == 7
446
445
447
- 

Return to bug 730432