From c579fa1349c8efaed599ca02d18f2db227c6f367 Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Sun, 24 Aug 2008 15:08:58 -0400 Subject: [PATCH] sde-config: Changed scripts/Config to use libsde.in and $ECHO_E --- lib/sde-config/functions.in | 18 +++++++++--------- scripts/Config | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/sde-config/functions.in b/lib/sde-config/functions.in index 8e3018e..2848266 100644 --- a/lib/sde-config/functions.in +++ b/lib/sde-config/functions.in @@ -288,7 +288,7 @@ choice() { set_data "$1" "${defval:-$3}" if [ "$menumode" -eq 1 -a $menu_current = $menu_this ] ; then - { echo -en "$item\tchoice_action '$1' '$data'" ; shift ; shift + { $ECHO_E -n "$item\tchoice_action '$1' '$data'" ; shift ; shift for x ; do echo -n " '$x'" ; done ; echo ; } >> $cfgtmpdir/config.data fi @@ -334,7 +334,7 @@ text() { set_data "$2" "$3" if [ "$menumode" -eq 1 -a $menu_current = $menu_this ] ; then - echo -e "$2\ttext_action '$1' '$2'" \ + $ECHO_E "$2\ttext_action '$1' '$2'" \ "'${data//$q/$q\\$q$q}'" >> $cfgtmpdir/config.data fi @@ -367,7 +367,7 @@ bool() { set_data "$2" "$3" if [ "$menumode" -eq 1 -a $menu_current = $menu_this ] ; then - echo -e "$2\tbool_action '$1' '$2' '$data'" >> $cfgtmpdir/config.data + $ECHO_E "$2\tbool_action '$1' '$2' '$data'" >> $cfgtmpdir/config.data fi if [ "$menumode" -gt 0 -a $menu_current = $menu_this ] ; then @@ -406,7 +406,7 @@ editfile() { printf "$1:${editfilenr} '$spacer%-${tabspace}s %s'\n" \ `printf "%03d:" $line_nr` "$line" >> $cfgtmpdir/config.dialog - echo -e "$1:${editfilenr}\teditfile_action $2" \ + $ECHO_E "$1:${editfilenr}\teditfile_action $2" \ "$line_nr '$3'" >> $cfgtmpdir/config.data fi @@ -418,7 +418,7 @@ editfile() { printf "$1:${editfilenr} '$spacer%-${tabspace}s %s'\n" \ `printf "%03d:" $line_nr` "" >> $cfgtmpdir/config.dialog - echo -e "$1:${editfilenr}\teditfile_action $2" \ + $ECHO_E "$1:${editfilenr}\teditfile_action $2" \ "$line_nr '$3'" >> $cfgtmpdir/config.data fi @@ -454,7 +454,7 @@ startprog() { [ $menu_current = $menu_this ] ; then printf "$1 '$spacer%-${tabspace}s %s'\n" \ "-->" "$2" >> $cfgtmpdir/config.dialog - echo -e "$1\t$3" >> $cfgtmpdir/config.data + $ECHO_E "$1\t$3" >> $cfgtmpdir/config.data fi bprof startprog stop } @@ -495,12 +495,12 @@ menu_begin() { [ $menu_current = $menu_this ] ; then printf "$1 '$spacer%-${tabspace}s %s'\n" \ "===>" "$2" >> $cfgtmpdir/config.dialog - echo -e "$1\tmenu_current=$menu_counter" >> $cfgtmpdir/config.data + $ECHO_E "$1\tmenu_current=$menu_counter" >> $cfgtmpdir/config.data fi if [ $SDECFG_EXPERT -eq 1 -o $expert -eq 0 ] && [ $menu_current = $menu_counter ] ; then echo "$1 '===> $2'" >> $cfgtmpdir/config.dialog - echo -e "$1\tmenu_current=$menu_this" >> $cfgtmpdir/config.data + $ECHO_E "$1\tmenu_current=$menu_this" >> $cfgtmpdir/config.data fi if [ $menu_current = $menu_counter ] ; then @@ -525,7 +525,7 @@ menu_end() { set_help() { bprof set_help start - (echo -ne "$1 '$1:\n\n$2'" | sed 's,$,\\n,' | + ($ECHO_E -n "$1 '$1:\n\n$2'" | sed 's,$,\\n,' | tr -d '\n' | sed 's,\\n$,,'; echo ) >> $cfgtmpdir/config.help bprof set_help stop } diff --git a/scripts/Config b/scripts/Config index 8059d04..caf7a66 100755 --- a/scripts/Config +++ b/scripts/Config @@ -24,7 +24,7 @@ if [ -z "${lines:=$LINES}" -o -z "${columns:=$COLUMNS}" ] ; then [ -z "$columns" -o "$columns" -le 0 ] 2> /dev/null && columns=80 fi -eval "$( egrep '^sdever=' lib/libsde.in )" +. "lib/libsde.in" config=default do_config_cycle=0 @@ -169,7 +169,7 @@ bprof main start rm -f $cfgtmpdir/config.{dialog,data,help} touch $cfgtmpdir/config.{dialog,data,help} -echo -e "#\n# OpenSDE ($sdever) Config File\n#" > $cfgtmpdir/config/config +$ECHO_E "#\n# OpenSDE ($sdever) Config File\n#" > $cfgtmpdir/config/config spacer= ; expert=0 ; tabspace="5" ; tabspace_list= commentnr=0 ; editfilenr=0 @@ -218,14 +218,14 @@ bprof main start case "$returncode" in 0|6) command="`grep "^$item " $cfgtmpdir/config.data | cut -f2-`" - { echo -e "\n# Remember menu position:\ncurrent='$item'" - echo -e "\n# Remember sub-menu:\nmenu_current='$menu_current'" - echo -e "\n# Execute this config command:\n$command" + { $ECHO_E "\n# Remember menu position:\ncurrent='$item'" + $ECHO_E "\n# Remember sub-menu:\nmenu_current='$menu_current'" + $ECHO_E "\n# Execute this config command:\n$command" } >> $cfgtmpdir/config/config ;; menu-back) - { echo -e "\n# New menu position:\ncurrent='$menu_backpos'" - echo -e "\n# New sub-menu:\nmenu_current='$menu_back'" + { $ECHO_E "\n# New menu position:\ncurrent='$menu_backpos'" + $ECHO_E "\n# New sub-menu:\nmenu_current='$menu_back'" } >> $cfgtmpdir/config/config ;; 1|255) @@ -257,8 +257,8 @@ case "$returncode" in 2) tempitem=$item item=$(echo $item | cut -f1 -d' ') # dialog(1) bug? - { echo -e "\n# Remember menu position:\ncurrent='$item'" - echo -e "\n# Remember sub-menu:\nmenu_current='$menu_current'" + { $ECHO_E "\n# Remember menu position:\ncurrent='$item'" + $ECHO_E "\n# Remember sub-menu:\nmenu_current='$menu_current'" } >> $cfgtmpdir/config/config get_help $item > $cfgtmpdir/config.dialog