diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2007-04-17 20:53:24 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2007-04-17 20:53:24 +0000 |
commit | fb5750bfb4c4ffd5ae839c416de192c8bc262b4b (patch) | |
tree | 0ca72fa8942e71dc545c18d5d77060f53cdefe34 /newlib/libc/stdio/vfscanf.c | |
parent | 2351dd18b414d71a9306204e9eebf01f41289bbc (diff) | |
download | cygnal-fb5750bfb4c4ffd5ae839c416de192c8bc262b4b.tar.gz cygnal-fb5750bfb4c4ffd5ae839c416de192c8bc262b4b.tar.bz2 cygnal-fb5750bfb4c4ffd5ae839c416de192c8bc262b4b.zip |
2007-04-17 Brian Dessent <brian@dessent.net>
* libc/stdio/sscanf.c: Update documentation comments.
* libc/stdio/vfscanf.c (__SVFSCANF_R): Handle j, t, and z modifiers.
Diffstat (limited to 'newlib/libc/stdio/vfscanf.c')
-rw-r--r-- | newlib/libc/stdio/vfscanf.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index c9808bb48..3b3f63af8 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -109,6 +109,7 @@ Supporting OS subroutines required: #include <wctype.h> #include <stdio.h> #include <stdlib.h> +#include <stdint.h> #include <limits.h> #include <wchar.h> #include <string.h> @@ -380,6 +381,43 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), else flags |= SHORT; goto again; + case 'j': /* intmax_t */ + if (sizeof (intmax_t) == sizeof (long)) + flags |= LONG; + else + flags |= LONGDBL; + goto again; + case 't': /* ptrdiff_t */ + if (sizeof (ptrdiff_t) < sizeof (int)) + /* POSIX states ptrdiff_t is 16 or more bits, as + is short. */ + flags |= SHORT; + else if (sizeof (ptrdiff_t) == sizeof (int)) + /* no flag needed */; + else if (sizeof (ptrdiff_t) <= sizeof (long)) + flags |= LONG; + else + /* POSIX states that at least one programming + environment must support ptrdiff_t no wider than + long, but that means other environments can + have ptrdiff_t as wide as long long. */ + flags |= LONGDBL; + goto again; + case 'z': /* size_t */ + if (sizeof (size_t) < sizeof (int)) + /* POSIX states size_t is 16 or more bits, as is short. */ + flags |= SHORT; + else if (sizeof (size_t) == sizeof (int)) + /* no flag needed */; + else if (sizeof (size_t) <= sizeof (long)) + flags |= LONG; + else + /* POSIX states that at least one programming + environment must support size_t no wider than + long, but that means other environments can + have size_t as wide as long long. */ + flags |= LONGDBL; + goto again; case '0': case '1': |