@@ -88,21 +88,33 @@ display_howto ()
8888 # Since XTBPATH must be set, parse that first for the manpath
8989 if [[ -n $XTBPATH ]] ; then
9090 xtbpath_munge=" $XTBPATH "
91- while [[ " :${xtbpath_munge} :" =~ ^:([^:]+):(.* ):$ ]] ; do
92- [[ -d " ${BASH_REMATCH[1]} /man" ]] || { xtbpath_munge=" ${BASH_REMATCH[2]} " ; continue ; }
93- xtb_manpath=" ${BASH_REMATCH[1]} /man"
94- break
91+ local path_pattern=" ^:([^:]+):(.*)$"
92+ debug " xtbpath_munge=$xtbpath_munge "
93+ while [[ " :${xtbpath_munge} :" =~ $path_pattern ]] ; do
94+ debug " Pattern matched: ${BASH_REMATCH[0]} "
95+ if [[ -d " ${BASH_REMATCH[1]} /man" ]] ; then
96+ xtb_manpath=" ${BASH_REMATCH[1]} /man"
97+ debug " Use xtb_manpath=$xtb_manpath "
98+ break
99+ else
100+ xtbpath_munge=" ${BASH_REMATCH[2]} "
101+ debug " xtbpath_munge=$xtbpath_munge "
102+ continue
103+ fi
95104 done
96105 else
97106 warning " The environment variable 'XTBPATH' is unset, trying fallback 'XTBHOME'."
98107 warning " Please check your installation."
99108 fi
100109 # If no man directory is found along path, fallback to XTBHOME
101110 if [[ -z $xtb_manpath ]] ; then
111+ debug " Could not identify xtb manual path."
102112 # Assume if XTBHOME is set, it is the root directorry and contains the man directory
103113 if [[ -n $XTBHOME ]] ; then
114+ debug " Old variable XTBHOME is set ($XTBHOME )."
104115 if [[ -d " $XTBHOME /man" ]] ; then
105116 xtb_manpath=" $XTBHOME /man"
117+ debug " Fallback xtb_manpath=$xtb_manpath "
106118 else
107119 fatal " Manual directory '$XTBHOME /man' is missing."
108120 fi
@@ -115,6 +127,7 @@ display_howto ()
115127 fi
116128 fi
117129 debug " XTBPATH=$XTBPATH (XTBHOME=$XTBHOME )"
130+ debug " $( declare -p MANPATH ) "
118131
119132 message " From version 6.0 onwards there is no HOWTO included, displaying man page instead."
120133
@@ -345,8 +358,8 @@ add_to_MANPATH ()
345358{
346359 [[ -d " $1 " ]] || fatal " Cowardly refuse to add non-existent directory to PATH."
347360 [[ -x " $1 " ]] || fatal " Cowardly refuse to add non-accessible directory to PATH."
348- [[ :$MANPATH : =~ :$1 : ]] || PATH =" $1 :$MANPATH "
349- debug " $PATH "
361+ [[ :$MANPATH : =~ :$1 : ]] || MANPATH =" $1 :$MANPATH "
362+ debug " $MANPATH "
350363}
351364
352365#
796809 # Add the manual path, even though we won't need it
797810 [[ -d " ${XTBPATH} /man" ]] && add_to_MANPATH " ${XTBPATH} /man"
798811 export XTBPATH PATH MANPATH
812+ debug " $( declare -p XTBPATH PATH MANPATH ) "
799813fi
800814
801815# Check whether we have the right executable
0 commit comments