aboutsummaryrefslogtreecommitdiff
path: root/stdio-common/vfscanf.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common/vfscanf.c')
-rw-r--r--stdio-common/vfscanf.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index bd167b9a5b..ce5e5125f7 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -21,6 +21,7 @@
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <wctype.h>
@@ -407,7 +408,8 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
width = -1;
/* Check for type modifiers. */
- while (*f == 'h' || *f == 'l' || *f == 'L' || *f == 'a' || *f == 'q')
+ while (*f == 'h' || *f == 'l' || *f == 'L' || *f == 'a' || *f == 'q'
+ || *f == 'z' || *f == 't' || *f == 'j')
switch (*f++)
{
case 'h':
@@ -459,6 +461,30 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
arg and fill it in with a malloc'd pointer. */
flags |= MALLOC;
break;
+ case 'z':
+ if (flags & (SHORT|LONGDBL|CHAR))
+ conv_error ();
+ if (sizeof (size_t) > sizeof (unsigned long int))
+ flags |= LONGDBL;
+ else if (sizeof (size_t) > sizeof (unsigned int))
+ flags |= LONG;
+ break;
+ case 'j':
+ if (flags & (SHORT|LONGDBL|CHAR))
+ conv_error ();
+ if (sizeof (intmax_t) > sizeof (unsigned long int))
+ flags |= LONGDBL;
+ else if (sizeof (intmax_t) > sizeof (unsigned int))
+ flags |= LONG;
+ break;
+ case 't':
+ if (flags & (SHORT|LONGDBL|CHAR))
+ conv_error ();
+ if (sizeof (ptrdiff_t) > sizeof (unsigned long int))
+ flags |= LONGDBL;
+ else if (sizeof (ptrdiff_t) > sizeof (unsigned int))
+ flags |= LONG;
+ break;
}
/* End of the format string? */