]> sourceware.org Git - newlib-cygwin.git/commitdiff
2007-04-17 Brian Dessent <brian@dessent.net>
authorJeff Johnston <jjohnstn@redhat.com>
Tue, 17 Apr 2007 20:53:24 +0000 (20:53 +0000)
committerJeff Johnston <jjohnstn@redhat.com>
Tue, 17 Apr 2007 20:53:24 +0000 (20:53 +0000)
        * libc/stdio/sscanf.c: Update documentation comments.
        * libc/stdio/vfscanf.c (__SVFSCANF_R): Handle j, t, and z modifiers.

newlib/ChangeLog
newlib/libc/stdio/sscanf.c
newlib/libc/stdio/vfscanf.c

index 67ae8054ece84cd54a16703b359a9cdfa2fd4be0..bfb444fa887db37197a48bc5ff875a1421c917b1 100644 (file)
@@ -1,3 +1,8 @@
+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.
+
 2007-04-12  Eric Blake  <ebb9@byu.net>
 
        * libc/stdio/vfprintf.c (_VFPRINTF_F, cvt): Don't confuse %F with %e.
index 5ad39d8b732f43b3a85b75b0eddfcc71b6fb04e1..b74dd3ebe07a49bcc6047dc114e26fcdb4449a22 100644 (file)
@@ -147,9 +147,9 @@ DESCRIPTION
                Then <<scanf>> proceeds to the next format specification.
 
         o size
-               <<h>>, <<l>>, and <<L>> are optional size characters which
-               override the default way that <<scanf>> interprets the
-               data type of the corresponding argument.
+               <<h>>, <<j>>, <<l>>, <<L>>, <<t>>, and <<z>> are optional size
+               characters which override the default way that <<scanf>>
+               interprets the data type of the corresponding argument.
 
 
 .Modifier   Type(s)
@@ -162,6 +162,11 @@ DESCRIPTION
 .   h       D, I, O, U, X     no effect
 .           e, f, c, s, p
 .
+.   j       d, i, o, u, x, n  convert input to intmax_t,
+.                             store in intmax_t object
+.
+.   j       all others        no effect
+.
 .   l       d, i, o, u, x, n  convert input to long,
 .                             store in long object
 .
@@ -180,7 +185,18 @@ DESCRIPTION
 .   L       e, f, g, E, G     convert to long double,
 .                             store in long double
 .
-.   L      all others         no effect
+.   L       all others        no effect
+.
+.   t       d, i, o, u, x, n  convert input to ptrdiff_t,
+.                             store in ptrdiff_t object
+.
+.   t       all others        no effect
+.
+.   z       d, i, o, u, x, n  convert input to size_t,
+.                             store in size_t object
+.
+.   z       all others        no effect
+.
 
 
         o <[type]>
index c9808bb48cb8f2e4af204790a78a8a130f5d443f..3b3f63af8811d453410b595ad6f6169f3242050f 100644 (file)
@@ -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':
This page took 0.045977 seconds and 5 git commands to generate.