Date: Fri, 21 Dec 2012 19:26:18 +0000 (UTC) From: Devin Teske <dteske@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244550 - in head/usr.sbin/bsdconfig: . examples share startup/share usermgmt usermgmt/share Message-ID: <201212211926.qBLJQIQp021758@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dteske Date: Fri Dec 21 19:26:17 2012 New Revision: 244550 URL: http://svnweb.freebsd.org/changeset/base/244550 Log: Improve the debugging abilities and clean up debug messages. In most cases, all one has to do is set the environment variable DEBUGGING to get the debug messages to appear on the console. Modified: head/usr.sbin/bsdconfig/bsdconfig head/usr.sbin/bsdconfig/examples/bsdconfigrc head/usr.sbin/bsdconfig/share/common.subr head/usr.sbin/bsdconfig/share/dialog.subr head/usr.sbin/bsdconfig/startup/share/rcconf.subr head/usr.sbin/bsdconfig/startup/share/rcedit.subr head/usr.sbin/bsdconfig/usermgmt/groupdel head/usr.sbin/bsdconfig/usermgmt/groupedit head/usr.sbin/bsdconfig/usermgmt/groupinput head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr head/usr.sbin/bsdconfig/usermgmt/userdel head/usr.sbin/bsdconfig/usermgmt/useredit head/usr.sbin/bsdconfig/usermgmt/userinput head/usr.sbin/bsdconfig/usermgmt/usermgmt Modified: head/usr.sbin/bsdconfig/bsdconfig ============================================================================== --- head/usr.sbin/bsdconfig/bsdconfig Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/bsdconfig Fri Dec 21 19:26:17 2012 (r244550) @@ -70,7 +70,7 @@ usage() # local longest_cmd longest_cmd=$( echo "$cmd_list" | f_longest_line_length ) - f_dprintf "longest_cmd=[$longest_cmd]" + f_dprintf "longest_cmd=[%s]" "$longest_cmd" # # Determine the maximum width of terminal/console @@ -79,7 +79,7 @@ usage() max_size=$( stty size 2> /dev/null ) : ${max_size:="24 80"} max_width="${max_size#*[$IFS]}" - f_dprintf "max_width=[$max_width]" + f_dprintf "max_width=[%s]" "$max_width" # # Using the longest command-length as the width of a single column, @@ -92,7 +92,7 @@ usage() ncols=$(( $ncols + 1 )) x=$(( $x + 3 + $longest_cmd )) done - f_dprintf "ncols=[$ncols] x=[$x]" + f_dprintf "ncols=[%u] x=[%u]" $ncols $x # # Re-format the command-list into multiple columns @@ -117,7 +117,8 @@ usage() { n++ cur_col = (( n - 1 ) % ncols ) + 1 - printf "f_dprintf \"row_item[%u]=[%s]\"\n", cur_col, $0 + printf "f_dprintf \"row_item[%u]=[%%s]\" \"%s\"\n", + cur_col, $0 row_item[cur_col] = $0 if ( cur_col == ncols ) print_row() } @@ -238,7 +239,8 @@ f_dialog_title "$msg_main_menu" export UNAME_S="$(uname -s)" # Operating System (i.e. FreeBSD) export UNAME_P="$(uname -p)" # Processor Architecture (i.e. i386) export UNAME_R="$(uname -r)" # Release Level (i.e. X.Y-RELEASE) -f_dprintf "UNAME_S=[$UNAME_S] UNAME_P=[$UNAME_P] UNAME_R=[$UNAME_R]" +f_dprintf "UNAME_S=[%s] UNAME_P=[%s] UNAME_R=[%s]" \ + "$UNAME_S" "$UNAME_P" "$UNAME_R" cd $BSDCFG_LIBE || f_die 1 "$msg_directory_not_found" "$BSDCFG_LIBE" @@ -276,7 +278,7 @@ while :; do dialog_menu_main retval=$? mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" if [ $retval -eq 2 ]; then # The Help button was pressed @@ -298,7 +300,7 @@ while :; do *) # Dynamically loaded menuitem cmd=$( eval echo \"\$menu_program$mtag\" ) - f_dprintf "cmd=[$cmd]" + f_dprintf "cmd=[%s]" "$cmd" $cmd ${USE_XDIALOG:+-X} ;; Modified: head/usr.sbin/bsdconfig/examples/bsdconfigrc ============================================================================== --- head/usr.sbin/bsdconfig/examples/bsdconfigrc Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/examples/bsdconfigrc Fri Dec 21 19:26:17 2012 (r244550) @@ -31,5 +31,6 @@ # debugging aid for development # f_dprintf() { -# echo "$(date):$pgm: $1" >> $HOME/out +# local format="$1"; shift +# printf "$(date):$pgm:$format\n" "$@" >> $HOME/out # } Modified: head/usr.sbin/bsdconfig/share/common.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/common.subr Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/share/common.subr Fri Dec 21 19:26:17 2012 (r244550) @@ -27,6 +27,15 @@ if [ ! "$_COMMON_SUBR" ]; then _COMMON_S # # $FreeBSD$ # +############################################################ CONFIGURATION + +# +# Default file descriptors to link to stdout/stderr for passthru allowing +# redirection within a sub-shell to bypass directly to the terminal. +# +: ${TERMINAL_STDOUT_PASSTHRU:=3}} +: ${TERMINAL_STDERR_PASSTHRU:=4}} + ############################################################ GLOBALS # @@ -56,6 +65,14 @@ f_dprintf() { : this page intentionally left blank } +[ "$DEBUGGING" ] && f_dprintf() +{ + local fmt="$1" + shift + printf "$fmt${fmt:+\n}" "$@" \ + >&${TERMINAL_STDOUT_PASSTHRU:-1} +} && + export DEBUGGING # f_err $fmt [ $opts ... ] # @@ -63,7 +80,7 @@ f_dprintf() # f_err() { - printf "$@" >&2 + printf "$@" >&${TERMINAL_STDERR_PASSTHRU:-2} } # f_quietly $command [ $arguments ... ] @@ -181,6 +198,7 @@ f_show_help() f_include() { local file="$1" + f_dprintf "f_include: file=[%s]" "$file" . "$file" || exit $? } @@ -202,7 +220,7 @@ f_include_lang() local file="$1" local lang="${LANG:-$LC_ALL}" - f_dprintf "lang=[$lang]" + f_dprintf "f_include_lang: file=[%s] lang=[%s]" "$file" "$lang" if [ -f "$file.$lang" ]; then . "$file.$lang" || exit $? else @@ -247,7 +265,7 @@ f_usage() local file="$1" local lang="${LANG:-$LC_ALL}" - f_dprintf "lang=[$lang]" + f_dprintf "f_usage: file=[%s] lang=[%s]" "$file" "$lang" shift 1 # file @@ -300,7 +318,7 @@ f_index_file() local keyword="$1" local lang="${LANG:-$LC_ALL}" - f_dprintf "lang=[$lang]" + f_dprintf "f_index_file: keyword=[%s] lang=[%s]" "$keyword" "$lang" if [ "$lang" ]; then awk -v keyword="$keyword" "$f_index_file_awk" \ @@ -362,7 +380,8 @@ f_index_menusel_keyword() local indexfile="$1" pgm="$2" local lang="${LANG:-$LC_ALL}" - f_dprintf "lang=[$lang]" + f_dprintf "f_index_menusel_keyword: index=[%s] pgm=[%s] lang=[%s]" \ + "$indexfile" "$pgm" "$lang" if [ -f "$indexfile.$lang" ]; then awk -v pgm="$pgm" \ @@ -424,7 +443,8 @@ f_index_menusel_command() local indexfile="$1" keyword="$2" command local lang="${LANG:-$LC_ALL}" - f_dprintf "lang=[$lang]" + f_dprintf "f_index_menusel_command: index=[%s] key=[%s] lang=[%s]" \ + "$indexfile" "$keyword" "$lang" if [ -f "$indexfile.$lang" ]; then command=$( awk -v key="$keyword" \ @@ -463,4 +483,10 @@ trap 'f_die' SIGTERM SIGPIPE SIGXCPU SIG SIGFPE SIGTRAP SIGABRT SIGSEGV trap '' SIGALRM SIGPROF SIGUSR1 SIGUSR2 SIGHUP SIGVTALRM +# +# Clone terminal stdout/stderr so we can redirect to it from within sub-shells +# +eval exec $TERMINAL_STDOUT_PASSTHRU\>\&1 +eval exec $TERMINAL_STDERR_PASSTHRU\>\&2 + fi # ! $_COMMON_SUBR Modified: head/usr.sbin/bsdconfig/share/dialog.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/dialog.subr Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/share/dialog.subr Fri Dec 21 19:26:17 2012 (r244550) @@ -42,7 +42,7 @@ f_include_lang $BSDCFG_LIBE/include/mess # execution of dialog from within a sub-shell (so-long as its standard output # is explicitly redirected to this file descriptor). # -: ${DIALOG_TERMINAL_PASSTHRU_FD:=3} +: ${DIALOG_TERMINAL_PASSTHRU_FD:=${TERMINAL_STDOUT_PASSTHRU:-3}} ############################################################ GLOBALS Modified: head/usr.sbin/bsdconfig/startup/share/rcconf.subr ============================================================================== --- head/usr.sbin/bsdconfig/startup/share/rcconf.subr Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/startup/share/rcconf.subr Fri Dec 21 19:26:17 2012 (r244550) @@ -446,7 +446,7 @@ f_dialog_input_rcvar() break done - f_dprintf "f_dialog_input_rcvar: rcvar->[$rcvar]" + f_dprintf "f_dialog_input_rcvar: rcvar->[%s]" "$rcvar" return $SUCCESS } Modified: head/usr.sbin/bsdconfig/startup/share/rcedit.subr ============================================================================== --- head/usr.sbin/bsdconfig/startup/share/rcedit.subr Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/startup/share/rcedit.subr Fri Dec 21 19:26:17 2012 (r244550) @@ -75,7 +75,7 @@ f_dialog_rcedit() local cur_val="$( f_sysrc_get "$var" )" [ "$_input" = "$cur_val" ] && return $SUCCESS - f_dprintf "$var: [$cur_val]->[$_input]" + f_dprintf "%s: [%s]->[%s]" "$var" "$cur_val" "$_input" err=$( f_sysrc_set "$var" "$_input" 2>&1 ) || f_show_msg "$err" Modified: head/usr.sbin/bsdconfig/usermgmt/groupdel ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/groupdel Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/usermgmt/groupdel Fri Dec 21 19:26:17 2012 (r244550) @@ -71,7 +71,7 @@ while :; do f_dialog_menu_group_list retval=$? mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" [ $retval -eq 0 ] || f_die Modified: head/usr.sbin/bsdconfig/usermgmt/groupedit ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/groupedit Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/usermgmt/groupedit Fri Dec 21 19:26:17 2012 (r244550) @@ -71,7 +71,7 @@ while :; do f_dialog_menu_group_list retval=$? mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%s mtag=[%s]" $retval "$mtag" [ $retval -eq 0 ] || f_die Modified: head/usr.sbin/bsdconfig/usermgmt/groupinput ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/groupinput Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/usermgmt/groupinput Fri Dec 21 19:26:17 2012 (r244550) @@ -77,7 +77,7 @@ save_changes() elif [ "$group_password" ]; then cmd="echo \"\$group_password\" | $cmd -h 0" fi - f_dprintf "cmd=$cmd" + f_dprintf "cmd=%s" "$cmd" err=$( eval $cmd 2>&1 ) retval=$? if [ $retval -ne $SUCCESS ]; then @@ -96,7 +96,7 @@ save_changes() elif [ "$group_password" ]; then cmd="echo \"\$group_password\" | $cmd -h 0" fi - f_dprintf "cmd=$cmd" + f_dprintf "cmd=%s" "$cmd" err=$( eval $cmd 2>&1 ) retval=$? if [ $retval -ne $SUCCESS ]; then @@ -136,14 +136,14 @@ dialog_title_update() while [ $# -gt 0 ]; do key="${1%%=*}" value="${1#*=}" - f_dprintf "key=[$key] value=[$value]" + f_dprintf "key=[%s] value=[%s]" "$key" "$value" case "$key" in mode) mode="$value";; group) group="$value";; esac shift done -f_dprintf "mode=[$mode] group=[$group]" +f_dprintf "mode=[%s] group=[%s]" "$mode" "$group" # # Initialize @@ -242,7 +242,7 @@ while :; do retval=$? setvar DIALOG_MENU_$$ "$dialog_menu" mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" # Exit if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || f_die @@ -261,7 +261,7 @@ while :; do f_dialog_menu_group_list retval=$? mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" # Loop if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || continue Modified: head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr Fri Dec 21 19:26:17 2012 (r244550) @@ -154,7 +154,7 @@ f_dialog_input_group_name() done save_flag=1 - f_dprintf "group_name: [$cur_group_name]->[$group_name]" + f_dprintf "group_name: [%s]->[%s]" "$cur_group_name" "$group_name" return $SUCCESS } @@ -247,7 +247,8 @@ f_dialog_input_group_password() done save_flag=1 - f_dprintf "group_password: [$cur_group_password]->[$group_password]" + f_dprintf "group_password: [%s]->[%s]" \ + "$cur_group_password" "$group_password" return $SUCCESS } @@ -270,7 +271,7 @@ f_dialog_input_group_gid() group_gid="$_input" save_flag=1 - f_dprintf "group_gid: [$cur_group_gid]->[$group_gid]" + f_dprintf "group_gid: [%s]->[%s]" "$cur_group_gid" "$group_gid" return $SUCCESS } @@ -319,7 +320,7 @@ f_dialog_input_group_members() retval=$? setvar DIALOG_MENU_$$ "$dialog_menu" menu_choice=$( f_dialog_menutag ) - f_dprintf "retval=$retval menu_choice=[$menu_choice]" + f_dprintf "retval=%u menu_choice=[%s]" $retval "$menu_choice" # Return if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || return $retval @@ -385,7 +386,8 @@ f_dialog_input_group_members() group_members="$_input" save_flag=1 - f_dprintf "group_members: [$cur_group_members]->[$group_members]" + f_dprintf "group_members: [%s]->[%s]" \ + "$cur_group_members" "$group_members" return $SUCCESS } Modified: head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr Fri Dec 21 19:26:17 2012 (r244550) @@ -198,8 +198,8 @@ f_dialog_input_member_groups() done save_flag=1 - local debug="pw_member_groups:" - f_dprintf "$debug [$cur_pw_member_groups]->[$pw_member_groups]" + f_dprintf "pw_member_groups: [%s]->[%s]" \ + "$cur_pw_member_groups" "$pw_member_groups" return $SUCCESS } @@ -259,7 +259,7 @@ f_dialog_input_name() done save_flag=1 - f_dprintf "pw_name: [$cur_pw_name]->[$pw_name]" + f_dprintf "pw_name: [%s]->[%s]" "$cur_pw_name" "$pw_name" return $SUCCESS } @@ -352,7 +352,7 @@ f_dialog_input_password() done save_flag=1 - f_dprintf "pw_password: [$cur_pw_password]->[$pw_password]" + f_dprintf "pw_password: [%s]->[%s]" "$cur_pw_password" "$pw_password" return $SUCCESS } @@ -376,7 +376,7 @@ f_dialog_input_gecos() pw_gecos="$_input" save_flag=1 - f_dprintf "pw_gecos: [$cur_pw_gecos]->[$pw_gecos]" + f_dprintf "pw_gecos: [%s]->[%s]" "$cur_pw_gecos" "$pw_gecos" return $SUCCESS } @@ -399,7 +399,7 @@ f_dialog_input_uid() pw_uid="$_input" save_flag=1 - f_dprintf "pw_uid: [$cur_pw_uid]->[$pw_uid]" + f_dprintf "pw_uid: [%s]->[%s]" "$cur_pw_uid" "$pw_uid" return $SUCCESS } @@ -422,7 +422,7 @@ f_dialog_input_gid() pw_gid="$_input" save_flag=1 - f_dprintf "pw_gid: [$cur_pw_gid]->[$pw_gid]" + f_dprintf "pw_gid: [%s]->[%s]" "$cur_pw_gid" "$pw_gid" return $SUCCESS } @@ -445,7 +445,7 @@ f_dialog_input_class() pw_class="$_input" save_flag=1 - f_dprintf "pw_class: [$cur_pw_class]->[$pw_class]" + f_dprintf "pw_class: [%s]->[%s]" "$cur_pw_class" "$pw_class" return $SUCCESS } @@ -496,7 +496,7 @@ f_dialog_input_change() retval=$? setvar DIALOG_MENU_$$ "$dialog_menu" date_type=$( f_dialog_menutag ) - f_dprintf "retval=$retval date_type=[$date_type]" + f_dprintf "retval=%u date_type=[%s]" $retval "$date_type" # Return if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || return $retval @@ -532,7 +532,7 @@ f_dialog_input_change() retval=$? setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" ret_date=$( f_dialog_inputstr ) - f_dprintf "retval=$retval ret_date=[$ret_date]" + f_dprintf "retval=%u ret_date=[%s]" $retval "$ret_date" # Return to menu if either ESC or Cancel/No [ $retval -eq $SUCCESS ] || continue @@ -559,7 +559,7 @@ f_dialog_input_change() retval=$? setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" ret_time=$( f_dialog_inputstr ) - f_dprintf "retval=$retval ret_time=[$ret_time]" + f_dprintf "retval=%u ret_time=[%s]" $retval "$ret_time" # Return to menu if either ESC or Cancel/No [ $retval -eq $SUCCESS ] || continue @@ -568,7 +568,7 @@ f_dialog_input_change() -j -f "%d/%m/%Y %T" \ -- "$ret_date $ret_time" \ +%s 2> /dev/null ) - f_dprintf "_input=[$_input]" + f_dprintf "_input=[%s]" "$_input" break ;; 3) # Enter number of days into the future @@ -592,13 +592,13 @@ f_dialog_input_change() continue fi - f_dprintf "ret_days=[$ret_days]" + f_dprintf "ret_days=[%s]" "$ret_days" case "$ret_days" in [-+]*) _input=$( date -v${ret_days}d +%s );; 0) _input=$( date +%s );; *) _input=$( date -v+${ret_days}d +%s );; esac - f_dprintf "_input=[$_input]" + f_dprintf "_input=[%s]" "$_input" break ;; 4) # Enter value manually @@ -619,7 +619,7 @@ f_dialog_input_change() continue fi - f_dprintf "_input=[$_input]" + f_dprintf "_input=[%s]" "$_input" break ;; esac @@ -629,8 +629,8 @@ f_dialog_input_change() pw_password_expire="$_input" save_flag=1 - local debug=pw_password_expire - f_dprintf "$debug: [$cur_pw_password_expire]->[$pw_password_expire]" + f_dprintf "pw_password_expire: [%s]->[%s]" \ + "$cur_pw_password_expire" "$pw_password_expire" return $SUCCESS } @@ -681,7 +681,7 @@ f_dialog_input_expire() retval=$? setvar DIALOG_MENU_$$ "$dialog_menu" date_type=$( f_dialog_menutag ) - f_dprintf "retval=$retval date_type=[$date_type]" + f_dprintf "retval=%u date_type=[%s]" $retval "$date_type" # Return if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || return $retval @@ -717,7 +717,7 @@ f_dialog_input_expire() retval=$? setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" ret_date=$( f_dialog_inputstr ) - f_dprintf "retval=$retval ret_date=[$ret_date]" + f_dprintf "retval=%u ret_date=[%s]" $retval "$ret_date" # Return to menu if either ESC or Cancel/No [ $retval -eq $SUCCESS ] || continue @@ -743,7 +743,7 @@ f_dialog_input_expire() retval=$? setvar DIALOG_INPUTBOX_$$ "$dialog_inputbox" ret_time=$( f_dialog_inputstr ) - f_dprintf "retval=$retval ret_time=[$ret_time]" + f_dprintf "retval=%u ret_time=[%s]" $retval "$ret_time" # Return to menu if either ESC or Cancel/No [ $retval -eq $SUCCESS ] || continue @@ -752,7 +752,7 @@ f_dialog_input_expire() -j -f "%d/%m/%Y %T" \ -- "$ret_date $ret_time" \ +%s 2> /dev/null ) - f_dprintf "_input=[$_input]" + f_dprintf "_input=[%s]" "$_input" break ;; 3) # Enter number of days into the future @@ -776,13 +776,13 @@ f_dialog_input_expire() continue fi - f_dprintf "ret_days=[$ret_days]" + f_dprintf "ret_days=[%s]" "$ret_days" case "$ret_days" in [-+]*) _input=$( date -v${ret_days}d +%s );; 0) _input=$( date +%s );; *) _input=$( date -v+${ret_days}d +%s );; esac - f_dprintf "_input=[$_input]" + f_dprintf "_input=[%s]" "$_input" break ;; 4) # Enter value manually @@ -803,7 +803,7 @@ f_dialog_input_expire() continue fi - f_dprintf "_input=[$_input]" + f_dprintf "_input=[%s]" "$_input" break ;; esac @@ -813,8 +813,8 @@ f_dialog_input_expire() pw_account_expire="$_input" save_flag=1 - local debug=pw_account_expire - f_dprintf "$debug: [$cur_pw_account_expire]->[$pw_account_expire]" + f_dprintf "pw_account_expire: [%s]->[%s]" \ + "$cur_pw_account_expire" "$pw_account_expire" return $SUCCESS } @@ -837,7 +837,7 @@ f_dialog_input_home_dir() pw_home_dir="$_input" save_flag=1 - f_dprintf "pw_home_dir: [$cur_pw_home_dir]->[$pw_home_dir]" + f_dprintf "pw_home_dir: [%s]->[%s]" "$cur_pw_home_dir" "$pw_home_dir" return $SUCCESS } @@ -863,7 +863,8 @@ f_dialog_input_home_create() fi save_flag=1 - f_dprintf "pw_home_create: [$cur_pw_home_create]->[$pw_home_create]" + f_dprintf "pw_home_create: [%s]->[%s]" \ + "$cur_pw_home_create" "$pw_home_create" [ $retval -ne 255 ] # return failure if user pressed ESC } @@ -905,7 +906,8 @@ f_dialog_input_group_delete() fi save_flag=1 - f_dprintf "pw_group_delete: [$cur_pw_group_delete]->[$pw_group_delete]" + f_dprintf "pw_group_delete: [%s]->[%s]" \ + "$cur_pw_group_delete" "$pw_group_delete" [ $retval -ne 255 ] # return failure if user pressed ESC } @@ -931,7 +933,8 @@ f_dialog_input_home_delete() fi save_flag=1 - f_dprintf "pw_home_delete: [$cur_pw_home_delete]->[$pw_home_delete]" + f_dprintf "pw_home_delete: [%s]->[%s]" \ + "$cur_pw_home_delete" "$pw_home_delete" [ $retval -ne 255 ] # return failure if user pressed ESC } @@ -958,8 +961,8 @@ f_dialog_input_dotfiles_create() fi save_flag=1 - local debug="pw_dotfiles_create:" - f_dprintf "$debug: [$cur_pw_dotfiles_create]->[$pw_dotfiles_create]" + f_dprintf "pw_dotfiles_create: [%s]->[%s]" \ + "$cur_pw_dotfiles_create" "$pw_dotfiles_create" [ $retval -ne 255 ] # return failure if user pressed ESC } @@ -1017,7 +1020,7 @@ f_dialog_input_shell() pw_shell="$_input" save_flag=1 - f_dprintf "pw_shell: [$cur_pw_shell]->[$pw_shell]" + f_dprintf "pw_shell: [%s]->[%s]" "$cur_pw_shell" "$pw_shell" return $SUCCESS } Modified: head/usr.sbin/bsdconfig/usermgmt/userdel ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/userdel Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/usermgmt/userdel Fri Dec 21 19:26:17 2012 (r244550) @@ -71,7 +71,7 @@ while :; do f_dialog_menu_user_list retval=$? mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" [ $retval -eq 0 ] || f_die Modified: head/usr.sbin/bsdconfig/usermgmt/useredit ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/useredit Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/usermgmt/useredit Fri Dec 21 19:26:17 2012 (r244550) @@ -71,7 +71,7 @@ while :; do f_dialog_menu_user_list retval=$? mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" [ $retval -eq 0 ] || f_die Modified: head/usr.sbin/bsdconfig/usermgmt/userinput ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/userinput Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/usermgmt/userinput Fri Dec 21 19:26:17 2012 (r244550) @@ -114,7 +114,7 @@ save_changes() elif [ "$pw_password" ]; then cmd="echo \"\$pw_password\" | $cmd -h 0" fi - f_dprintf "cmd=$cmd" + f_dprintf "cmd=%s" "$cmd" err=$( eval $cmd 2>&1 ) retval=$? if [ $retval -ne $SUCCESS ]; then @@ -160,7 +160,7 @@ save_changes() elif [ "$pw_password" ]; then cmd="echo \"\$pw_password\" | $cmd -h 0" fi - f_dprintf "cmd=$cmd" + f_dprintf "cmd=%s" "$cmd" err=$( eval $cmd 2>&1 ) retval=$? if [ $retval -ne $SUCCESS ]; then @@ -217,14 +217,14 @@ dialog_title_update() while [ $# -gt 0 ]; do key="${1%%=*}" value="${1#*=}" - f_dprintf "key=[$key] value=[$value]" + f_dprintf "key=[%s] value=[%s]" "$key" "$value" case "$key" in mode) mode="$value";; user) user="$value";; esac shift done -f_dprintf "mode=[$mode] user=[$user]" +f_dprintf "mode=[%s] user=[%s]" "$mode" "$user" # # Initialize @@ -406,7 +406,7 @@ while :; do retval=$? setvar DIALOG_MENU_$$ "$dialog_menu" mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" # Exit if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || f_die @@ -425,7 +425,7 @@ while :; do f_dialog_menu_user_list retval=$? mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" # Loop if user has either pressed ESC or chosen Cancel/No [ $retval -eq $SUCCESS ] || continue Modified: head/usr.sbin/bsdconfig/usermgmt/usermgmt ============================================================================== --- head/usr.sbin/bsdconfig/usermgmt/usermgmt Fri Dec 21 19:13:48 2012 (r244549) +++ head/usr.sbin/bsdconfig/usermgmt/usermgmt Fri Dec 21 19:26:17 2012 (r244550) @@ -126,7 +126,7 @@ while :; do dialog_menu_main retval=$? mtag=$( f_dialog_menutag ) - f_dprintf "retval=$retval mtag=[$mtag]" + f_dprintf "retval=%u mtag=[%s]" $retval "$mtag" if [ $retval -eq 2 ]; then # The Help button was pressed
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212211926.qBLJQIQp021758>