More printf de-duplication.

Fix the 'j' (intmax_t/uintmax_t) length qualifier in the wide
variant. (With new tests that fail without this fix.)

Fix a typo in the wide support for intmax_t*, which isn't testable because
%n is disabled on Android (and will be removed in a later cleanup pass).

Also move the public vfprintf/vfwprint functions into stdio.cpp.

Bug: http://b/67371539
Test: ran tests
Change-Id: Ib003599b1e9cb789044a068940b59e447f2cb7cb
diff --git a/libc/stdio/vfwprintf.cpp b/libc/stdio/vfwprintf.cpp
index 80eb78a..38acccf 100644
--- a/libc/stdio/vfwprintf.cpp
+++ b/libc/stdio/vfwprintf.cpp
@@ -83,8 +83,7 @@
   wchar_t* pwchararg;
 };
 
-static int __find_arguments(const wchar_t* fmt0, va_list ap, union arg** argtable,
-                            size_t* argtablesiz);
+static int __find_arguments(const CHAR_TYPE* fmt0, va_list ap, union arg** argtable, size_t* argtablesiz);
 static int __grow_type_table(unsigned char** typetable, int* tablesize);
 
 /*
@@ -997,17 +996,6 @@
   return (ret);
 }
 
-int vfwprintf(FILE* __restrict fp, const wchar_t* __restrict fmt0, __va_list ap) {
-  int r;
-
-  FLOCKFILE(fp);
-  r = __vfwprintf(fp, fmt0, ap);
-  FUNLOCKFILE(fp);
-
-  return (r);
-}
-DEF_STRONG(vfwprintf);
-
 /*
  * Type ids for argument type table.
  */
@@ -1192,6 +1180,9 @@
           flags |= SHORTINT;
         }
         goto rflag;
+      case 'j':
+        flags |= MAXINT;
+        goto rflag;
       case 'l':
         if (*fmt == 'l') {
           fmt++;
@@ -1367,9 +1358,15 @@
       case TP_SSIZEINT:
         (*argtable)[n].pssizearg = va_arg(ap, ssize_t*);
         break;
-      case TP_MAXINT:
+      case T_MAXINT:
         (*argtable)[n].intmaxarg = va_arg(ap, intmax_t);
         break;
+      case T_MAXUINT:
+        (*argtable)[n].uintmaxarg = va_arg(ap, uintmax_t);
+        break;
+      case TP_MAXINT:
+        (*argtable)[n].pintmaxarg = va_arg(ap, intmax_t*);
+        break;
       case T_WINT:
         (*argtable)[n].wintarg = va_arg(ap, wint_t);
         break;