dirname.go: Complete functionality

Now supports all flags and features of dirname.