POSIX shell compatible and POSIX conforming dirname implementation
I don't think there's a really compelling reason for this eval in stripslashes:


eval "$2=\$i"



It's a dirty hack to update the parameter variable in-place.
But this is not a common practice, I don't know other commands or built-ins that work that way, and I would find such usage unexpected.
I would find it more usable if stripslashes behaved more like other commands do:


print the result on stdout
set the result in a designated variable (like REPLY)


That would be more in-line with common UNIX practices, and unsurprising, familiar.



As a minor nitpick, I avoid quoting when it's unnecessary.
For example instead of [ "$p" != '//' ], I would write [ "$p" != // ]



Instead of this:


        [ -z "$p" ] &amp;&amp; p=/



This form is shorter:

        [ "$p" ] || p=/




This might be subjective, but I would rewrite this part using regular if-else:


[ -n "$skip78" ] || {
    { [ "$p" != '//' ] || [ -z "$alt" ]; } &amp;&amp; {
        stripslashes "$p" p
        [ -z "$p" ] &amp;&amp; p=/
    }
}