rewrote dirname.c to be shorter (probably more efficient? (less iterations)), as well as have it under the public domain and not copyrighted by some random guy