summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsdconfig/share/device.subr
diff options
context:
space:
mode:
authordteske <dteske@FreeBSD.org>2013-10-09 08:12:26 +0000
committerdteske <dteske@FreeBSD.org>2013-10-09 08:12:26 +0000
commitee2fafc6a903bcdb2569fc1d6c3ffce0f14c3ebd (patch)
tree4b1792e416c982abbc7d554b2fb8ab80ba5afb91 /usr.sbin/bsdconfig/share/device.subr
parent255d648aec920f8660ba18ef659a9a08f5ee0198 (diff)
downloadFreeBSD-src-ee2fafc6a903bcdb2569fc1d6c3ffce0f14c3ebd.zip
FreeBSD-src-ee2fafc6a903bcdb2569fc1d6c3ffce0f14c3ebd.tar.gz
Introduce centralized [X]dialog(1) exit codes to `dialog.subr' and make-use
throughout the bsdconfig(8) code. While we're here, add an explicit argument to lvalue-seeking invocations of "return" that previously had no argument. Also, consolidate a single instance of double-newline and remove some comments that are no longer required (given increased readability with new exit codes). Approved by: re (glebius)
Diffstat (limited to 'usr.sbin/bsdconfig/share/device.subr')
-rw-r--r--usr.sbin/bsdconfig/share/device.subr12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/bsdconfig/share/device.subr b/usr.sbin/bsdconfig/share/device.subr
index bbd3a10..b920809 100644
--- a/usr.sbin/bsdconfig/share/device.subr
+++ b/usr.sbin/bsdconfig/share/device.subr
@@ -552,7 +552,7 @@ f_device_find()
f_device_init()
{
local name="$1" init_func
- device_$name get init init_func || return
+ device_$name get init init_func || return $?
${init_func:-:} $name
}
@@ -564,7 +564,7 @@ f_device_init()
f_device_get()
{
local name="$1" file="$2" probe="$3" get_func
- device_$name get get get_func || return
+ device_$name get get get_func || return $?
${get_func:-:} $name "$file" ${3+"$probe"}
}
@@ -575,7 +575,7 @@ f_device_get()
f_device_shutdown()
{
local name="$1" shutdown_func
- device_$name get shutdown shutdown_func || return
+ device_$name get shutdown shutdown_func || return $?
${shutdown_func:-:} $name
}
@@ -597,7 +597,7 @@ f_device_menu()
[ "$devtype" = "$type" ] || continue
devs="$devs $dev"
done
- [ "$devs" ] || return $FAILURE
+ [ "$devs" ] || return $DIALOG_CANCEL
local desc menu_list=
for dev in $devs; do
@@ -637,7 +637,7 @@ f_device_menu()
)
local retval=$?
- [ $retval -ne 2 ] && break
+ [ $retval -ne $DIALOG_HELP ] && break
# Otherwise, the Help button was pressed
f_show_help "$helpfile"
# ...then loop back to menu
@@ -646,7 +646,7 @@ f_device_menu()
[ "$errexit" ] && set -e
- if [ $retval -eq 0 ]; then
+ if [ $retval -eq $DIALOG_OK ]; then
# Clean up the output of [X]dialog(1) and return it
f_dialog_data_sanitize mtag
echo "$mtag" >&2
OpenPOWER on IntegriCloud