Switch to the OpenBSD implementations of the wide scanf functions.

This also gets us the C99 wcstoimax and wcstoumax, and a working fgetwc and
ungetwc, all of which are needed in the implementation.

This also brings several other files closer to upstream.

Change-Id: I23b025a8237a6dbb9aa50d2a96765ea729a85579
diff --git a/libc/bionic/flockfile.cpp b/libc/bionic/flockfile.cpp
index c60497d..3381e8e 100644
--- a/libc/bionic/flockfile.cpp
+++ b/libc/bionic/flockfile.cpp
@@ -29,7 +29,7 @@
 #include <errno.h>
 #include <stdio.h>
 
-#include "fileext.h"
+#include "local.h"
 
 // We can't use the OpenBSD implementation which uses kernel-specific
 // APIs not available on Linux. Instead we use a pthread_mutex_t within
diff --git a/libc/bionic/wchar.cpp b/libc/bionic/wchar.cpp
index e466c91..d23b4b7 100644
--- a/libc/bionic/wchar.cpp
+++ b/libc/bionic/wchar.cpp
@@ -74,24 +74,6 @@
   return -1;
 }
 
-int fwscanf(FILE* /*stream*/, const wchar_t* /*format*/, ... ) {
-  errno = ENOTSUP;
-  return -1;
-}
-
-int wscanf(const wchar_t* format, ... ) {
-  va_list args;
-  va_start (args, format);
-  int result = fwscanf(stdout, format, args );
-  va_end (args);
-  return result;
-}
-
-int swscanf(const wchar_t* /*s*/, const wchar_t* /*format*/, ... ) {
-  errno = ENOTSUP;
-  return -1;
-}
-
 int iswalnum(wint_t wc) { return isalnum(wc); }
 int iswalpha(wint_t wc) { return isalpha(wc); }
 int iswblank(wint_t wc) { return isblank(wc); }
@@ -123,10 +105,6 @@
   }
 }
 
-wint_t fgetwc(FILE* stream) {
-  return static_cast<wint_t>(fgetc(stream));
-}
-
 wchar_t* fgetws(wchar_t* ws, int n, FILE* stream) {
   return reinterpret_cast<wchar_t*>(fgets(reinterpret_cast<char*>(ws), n, stream));
 }
@@ -224,10 +202,6 @@
   return toupper(wc);
 }
 
-wint_t ungetwc(wint_t wc, FILE* stream) {
-  return ungetc(static_cast<char>(wc), stream);
-}
-
 int wctomb(char* s, wchar_t wc) {
   if (s == NULL) {
     return 0;