Removal of some problematic whitespace generated on MacOSX.
[clinton/abcde.git] / abcde
diff --git a/abcde b/abcde
index 1705fab..ababbd3 100755 (executable)
--- a/abcde
+++ b/abcde
@@ -433,8 +433,8 @@ getcddbinfo()
 gettracknum()
 {
        if [ -n "$STARTTRACKNUMBER" ] ; then
 gettracknum()
 {
        if [ -n "$STARTTRACKNUMBER" ] ; then
-               # Get the trackpadding from the current track
-               CURRENTTRACKPADDING=$(echo -n $UTRACKNUM | wc -c)
+               # Get the trackpadding from the current track, also trim whitespace for MacOSX
+               CURRENTTRACKPADDING=$(echo -n $UTRACKNUM | wc -c | tr -d ' ')
                TRACKNUM=$( printf %0.${CURRENTTRACKPADDING}d $(expr ${UTRACKNUM} + ${STARTTRACKNUMBER} - $FIRSTTRACK ))
        else
                TRACKNUM=${UTRACKNUM}
                TRACKNUM=$( printf %0.${CURRENTTRACKPADDING}d $(expr ${UTRACKNUM} + ${STARTTRACKNUMBER} - $FIRSTTRACK ))
        else
                TRACKNUM=${UTRACKNUM}
@@ -3361,6 +3361,8 @@ elif [ X$(uname) = "XDarwin" ] ; then
        # We should have diskutil in OSX, but let's be sure...
        NEEDDISKUTIL=y
        CDROMREADERSYNTAX=cddafs
        # We should have diskutil in OSX, but let's be sure...
        NEEDDISKUTIL=y
        CDROMREADERSYNTAX=cddafs
+       # We won't find the eject program in OSX, and doing checkexec will fail further below...
+       unset EJECT
 elif [ X$(uname) = "XOpenBSD" ] ; then
        HTTPGET=wget
        MD5SUM=md5
 elif [ X$(uname) = "XOpenBSD" ] ; then
        HTTPGET=wget
        MD5SUM=md5
@@ -4285,7 +4287,7 @@ post_read
 
 # We are now finished with the cdrom - it can be safely ejected. Note that
 # abcde will not have completed yet.
 
 # We are now finished with the cdrom - it can be safely ejected. Note that
 # abcde will not have completed yet.
-if [ "$EJECTCD" = "y" ] && [ -x $(which $EJECT) ]; then
+if [ "$EJECTCD" = "y" ]; then
        # We check if the disk we are processing is actually the disk inside the
        # CD tray. If not, we do not eject the CD, since it might be so that the
        # user ejected it manually.
        # We check if the disk we are processing is actually the disk inside the
        # CD tray. If not, we do not eject the CD, since it might be so that the
        # user ejected it manually.
@@ -4302,7 +4304,7 @@ if [ "$EJECTCD" = "y" ] && [ -x $(which $EJECT) ]; then
                $eject $EJECTOPTS $cd
        elif [ X"$(uname)" = X"Darwin" ] ; then
                diskutil eject ${CDROM#/dev/} 0
                $eject $EJECTOPTS $cd
        elif [ X"$(uname)" = X"Darwin" ] ; then
                diskutil eject ${CDROM#/dev/} 0
-       else
+    elif [ -x $(which $EJECT) ]; then
                $EJECT $EJECTOPTS "$CDROM"
        fi
        #fi
                $EJECT $EJECTOPTS "$CDROM"
        fi
        #fi