]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - progs/capconvert
ncurses 6.3 - patch 20220716
[ncurses.git] / progs / capconvert
index ea76f312497cc09b1064f09fa235bcc6fbaba939..4b5b321a58ce7f9120d13e5cbe3809876390c9b9 100755 (executable)
@@ -27,7 +27,7 @@
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
-# $Id: capconvert,v 1.11 2022/02/05 20:39:49 tom Exp $
+# $Id: capconvert,v 1.12 2022/07/16 21:00:27 tom Exp $
 #
 # capconvert -- automated conversion from termcap to terminfo
 #
 #
 # capconvert -- automated conversion from termcap to terminfo
 #
@@ -47,7 +47,7 @@ then
        echo "TERMINFO is already defined in your environment.  This means"
        echo "you already have a local terminfo tree, so you do not need any"
        echo "conversion."
        echo "TERMINFO is already defined in your environment.  This means"
        echo "you already have a local terminfo tree, so you do not need any"
        echo "conversion."
-       if test ! -d $TERMINFO ; then
+       if test ! -d "$TERMINFO" ; then
                echo "Caution: TERMINFO does not point to a directory!"
        fi
        exit;
                echo "Caution: TERMINFO does not point to a directory!"
        fi
        exit;
@@ -62,7 +62,7 @@ for p in $TERMINFO \
        /usr/local/lib/terminfo \
        /usr/local/share/terminfo
 do
        /usr/local/lib/terminfo \
        /usr/local/share/terminfo
 do
-       if test -d $p ; then
+       if test -d "$p" ; then
                terminfo=yes
                break
        fi
                terminfo=yes
                break
        fi
@@ -111,13 +111,13 @@ TIC=
 IFS="${IFS=    }"; save_ifs="$IFS"; IFS="${IFS}:"
 for x in $PATH .
 do
 IFS="${IFS=    }"; save_ifs="$IFS"; IFS="${IFS}:"
 for x in $PATH .
 do
-       if test $OPT $x/tic
+       if test "$OPT" "$x"/tic
        then
                TIC=$x/tic
                break
        fi
 done
        then
                TIC=$x/tic
                break
        fi
 done
-IFS="$ac_save_ifs"
+IFS="$save_ifs"
 
 if test -n "$TIC"
 then
 
 if test -n "$TIC"
 then
@@ -140,7 +140,7 @@ echo "";
 #
 
 # Make the user a terminfo directory
 #
 
 # Make the user a terminfo directory
-if test -d $HOME/.terminfo
+if test -d "$HOME"/.terminfo
 then
        echo "It appears you already have a private terminfo directory"
        echo "at $HOME/.terminfo; this seems odd, because TERMINFO"
 then
        echo "It appears you already have a private terminfo directory"
        echo "at $HOME/.terminfo; this seems odd, because TERMINFO"
@@ -150,7 +150,7 @@ then
        exit;
 else
        echo "I am creating your private terminfo directory at $HOME/.terminfo"
        exit;
 else
        echo "I am creating your private terminfo directory at $HOME/.terminfo"
-       mkdir $HOME/.terminfo
+       mkdir "$HOME"/.terminfo
        # Ensure that that's where tic's compilation results.
        # This isn't strictly necessary with a 1.9.7 or later tic.
        TERMINFO="$HOME/.terminfo"; export TERMINFO
        # Ensure that that's where tic's compilation results.
        # This isn't strictly necessary with a 1.9.7 or later tic.
        TERMINFO="$HOME/.terminfo"; export TERMINFO
@@ -165,8 +165,8 @@ then
 else
        # Ooops...looks like we're running from somewhere other than the
        # progs directory of an ncurses source tree.
 else
        # Ooops...looks like we're running from somewhere other than the
        # progs directory of an ncurses source tree.
-       master=`find $HOME -name "*terminfo.src" -print`
-       mcount=`echo $master | wc -l`
+       master=`find "$HOME" -name "*terminfo.src" -print`
+       mcount=`find "$HOME" -name "*terminfo.src" | wc -l`
        case $mcount in
        0)
                echo "I can not find a terminfo source file anywhere under your home directory."
        case $mcount in
        0)
                echo "I can not find a terminfo source file anywhere under your home directory."
@@ -184,12 +184,12 @@ else
        ;;
        2)
                echo "I see more than one possible terminfo source.  Here they are:"
        ;;
        2)
                echo "I see more than one possible terminfo source.  Here they are:"
-               echo $master | sed "/^/s//      /";
+               echo "$master" | sed "/^/s//    /";
                while :
                do
                        echo "Please tell me which one to use:"
                        read master;
                while :
                do
                        echo "Please tell me which one to use:"
                        read master;
-                       if test -f $master
+                       if test -f "$master"
                        then
                                break
                        else
                        then
                                break
                        else
@@ -206,13 +206,13 @@ echo "OK, now I will make your private terminfo tree.  This may take a bit..."
 #
 # Kluge alert: we compile terminfo.src in two pieces because a lot of machines
 # with < 16MB RAM choke on tic's core-hog habits.
 #
 # Kluge alert: we compile terminfo.src in two pieces because a lot of machines
 # with < 16MB RAM choke on tic's core-hog habits.
-trap "rm -f tsplit$$.*; exit 1" 1 2 3 15
-trap "rm -f tsplit$$.*" 0
-sed -n $master \
+trap 'rm -f tsplit$$.*; exit 1' 1 2 3 15
+trap 'rm -f tsplit$$.*' 0
+sed -n "$master" \
        -e '1,/SPLIT HERE/w 'tsplit$$.01 \
        -e '/SPLIT HERE/,$w 'tsplit$$.02 \
        2>/dev/null
        -e '1,/SPLIT HERE/w 'tsplit$$.01 \
        -e '/SPLIT HERE/,$w 'tsplit$$.02 \
        2>/dev/null
-for x in tsplit$$.*; do eval $TIC $x; done
+for x in tsplit$$.*; do eval $TIC "$x"; done
 rm tsplit$$.*
 trap EXIT INT QUIT TERM HUP
 #
 rm tsplit$$.*
 trap EXIT INT QUIT TERM HUP
 #
@@ -232,22 +232,22 @@ fi
 # we don't actually know what TERM will be nor even if it always has
 # the same value for this user) we do the following three steps...
 
 # we don't actually know what TERM will be nor even if it always has
 # the same value for this user) we do the following three steps...
 
-if test -f $HOME/.termcap
+if test -f "$HOME"/.termcap
 then
 then
-       echo 'I see you have a $HOME/.termcap file.  I will compile that.'
-       eval $TIC $HOME/.termcap
+       echo "I see you have a \$HOME/.termcap file.  I will compile that."
+       eval $TIC "$HOME"/.termcap
        echo "Done."
        echo "Note that editing $HOME/.termcap will no longer change the data curses sees."
 elif test -f "$TERMCAP"
 then
        echo "Your TERMCAP names the file $TERMCAP.  I will compile that."
        echo "Done."
        echo "Note that editing $HOME/.termcap will no longer change the data curses sees."
 elif test -f "$TERMCAP"
 then
        echo "Your TERMCAP names the file $TERMCAP.  I will compile that."
-       eval $TIC $TERMCAP
+       eval $TIC "$TERMCAP"
        echo "Done."
        echo "Note that editing $TERMCAP will no longer change the data curses sees."
 else
        echo "Your TERMCAP value appears to be an entry in termcap format."
        echo "I will compile it."
        echo "Done."
        echo "Note that editing $TERMCAP will no longer change the data curses sees."
 else
        echo "Your TERMCAP value appears to be an entry in termcap format."
        echo "I will compile it."
-       echo $TERMCAP >myterm$$
+       echo "$TERMCAP" >myterm$$
        eval $TIC myterm$$
        rm myterm$$
        echo "Done."
        eval $TIC myterm$$
        rm myterm$$
        echo "Done."