libc: Fix alphasort() signature (and implementation).

The declaration for alphasort() in <dirent.h> used the deprecated:

  int alphasort(const void*, const void*);

while both Posix and GLibc use instead:

  int alphasort(const struct dirent** a, const struct dirent** b);

See: http://pubs.opengroup.org/onlinepubs/9699919799/functions/alphasort.html

This patch does the following:

- Update the declaration to match Posix/GLibc
- Get rid of the upstream BSD code which isn't compatible with the new
  signature.
- Implement a new trivial alphasort() with the right signature, and
  ensure that it uses strcoll() instead of strcmp().
- Remove Bionic-specific #ifdef .. #else .. #endif block in
  dirent_test.cpp which uses alphasort().

Even through strcoll() currently uses strcmp(), this does the right
thing in the case where we decide to update strcoll() to properly
implement locale-specific ordered comparison.

Change-Id: I4fd45604d8a940aaf2eb0ecd7d73e2f11c9bca96
diff --git a/libc/Android.mk b/libc/Android.mk
index b0220c1..bb3fd00 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -279,13 +279,13 @@
 
 libc_bionic_src_files := \
     bionic/assert.cpp \
+    bionic/dirent.cpp \
     bionic/eventfd.cpp \
     bionic/__fgets_chk.cpp \
     bionic/getcwd.cpp \
     bionic/__memcpy_chk.cpp \
     bionic/__memmove_chk.cpp \
     bionic/__memset_chk.cpp \
-    bionic/opendir.cpp \
     bionic/setlocale.cpp \
     bionic/__strcat_chk.cpp \
     bionic/__strcpy_chk.cpp \
@@ -309,7 +309,6 @@
     upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
     upstream-netbsd/common/lib/libc/inet/inet_addr.c \
     upstream-netbsd/libc/compat-43/creat.c \
-    upstream-netbsd/libc/gen/alphasort.c \
     upstream-netbsd/libc/gen/ftw.c \
     upstream-netbsd/libc/gen/nftw.c \
     upstream-netbsd/libc/gen/nice.c \