Removed conflicting "backwards compatibility" code to make scanf
ANSI compliant.
This commit is contained in:
parent
015dc20943
commit
2893ea1742
|
@ -34,7 +34,7 @@
|
|||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" from: @(#)scanf.3 6.14 (Berkeley) 1/8/93
|
||||
.\" $Id: scanf.3,v 1.3 1993/08/01 07:44:52 mycroft Exp $
|
||||
.\" $Id: scanf.3,v 1.4 1995/01/26 01:34:44 jtc Exp $
|
||||
.\"
|
||||
.Dd January 8, 1993
|
||||
.Dt SCANF 3
|
||||
|
@ -201,7 +201,7 @@ the next pointer must be a pointer to
|
|||
.Em int .
|
||||
.It Cm D
|
||||
Equivalent to
|
||||
.Xr ld ;
|
||||
.Cm ld ;
|
||||
this exists only for backwards compatibility.
|
||||
.It Cm i
|
||||
Matches an optionally signed integer;
|
||||
|
@ -222,7 +222,7 @@ the next pointer must be a pointer to
|
|||
.Em unsigned int .
|
||||
.It Cm O
|
||||
Equivalent to
|
||||
.Xr lo ;
|
||||
.Cm lo ;
|
||||
this exists for backwards compatibility.
|
||||
.It Cm u
|
||||
Matches an optionally signed decimal integer;
|
||||
|
@ -234,12 +234,7 @@ the next pointer must be a pointer to
|
|||
.Em unsigned int .
|
||||
.It Cm X
|
||||
Equivalent to
|
||||
.Cm lx ;
|
||||
this violates the
|
||||
.St -ansiC ,
|
||||
but is backwards compatible with previous
|
||||
.Ux
|
||||
systems.
|
||||
.Cm x .
|
||||
.It Cm f
|
||||
Matches an optionally signed floating-point number;
|
||||
the next pointer must be a pointer to
|
||||
|
@ -252,16 +247,10 @@ Equivalent to
|
|||
.Cm f .
|
||||
.It Cm E
|
||||
Equivalent to
|
||||
.Cm lf ;
|
||||
this violates the
|
||||
.St -ansiC ,
|
||||
but is backwards compatible with previous
|
||||
.Ux
|
||||
systems.
|
||||
.It Cm F
|
||||
.Cm f .
|
||||
.It Cm G
|
||||
Equivalent to
|
||||
.Cm lf ;
|
||||
this exists only for backwards compatibility.
|
||||
.Cm f .
|
||||
.It Cm s
|
||||
Matches a sequence of non-white-space characters;
|
||||
the next pointer must be a pointer to
|
||||
|
@ -358,19 +347,6 @@ and a `conversion' of
|
|||
.Ql %\e0
|
||||
causes an immediate return of
|
||||
.Dv EOF .
|
||||
The
|
||||
.Cm F
|
||||
and
|
||||
.Cm X
|
||||
conversions will be changed in the future
|
||||
to conform to the
|
||||
.Tn ANSI
|
||||
C standard,
|
||||
after which they will act like
|
||||
.Cm f
|
||||
and
|
||||
.Cm x
|
||||
respectively.
|
||||
.Pp
|
||||
.Sh RETURN VALUES
|
||||
These
|
||||
|
@ -413,12 +389,6 @@ and
|
|||
.Fn vfscanf
|
||||
are new to this release.
|
||||
.Sh BUGS
|
||||
The current situation with
|
||||
.Cm %F
|
||||
and
|
||||
.Cm %X
|
||||
conversions is unfortunate.
|
||||
.Pp
|
||||
All of the backwards compatibility formats will be removed in the future.
|
||||
.Pp
|
||||
Numerical strings are truncated to 512 characters; for example,
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
/*static char *sccsid = "from: @(#)vfscanf.c 5.7 (Berkeley) 12/14/92";*/
|
||||
static char *rcsid = "$Id: vfscanf.c,v 1.8 1994/09/19 04:43:05 mycroft Exp $";
|
||||
static char *rcsid = "$Id: vfscanf.c,v 1.9 1995/01/26 01:34:45 jtc Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -212,9 +212,7 @@ literal:
|
|||
base = 10;
|
||||
break;
|
||||
|
||||
case 'X': /* compat XXX */
|
||||
flags |= LONG;
|
||||
/* FALLTHROUGH */
|
||||
case 'X':
|
||||
case 'x':
|
||||
flags |= PFXOK; /* enable 0x prefixing */
|
||||
c = CT_INT;
|
||||
|
@ -223,11 +221,11 @@ literal:
|
|||
break;
|
||||
|
||||
#ifdef FLOATING_POINT
|
||||
case 'E': /* compat XXX */
|
||||
case 'F': /* compat */
|
||||
flags |= LONG;
|
||||
/* FALLTHROUGH */
|
||||
case 'e': case 'f': case 'g':
|
||||
case 'E':
|
||||
case 'G':
|
||||
case 'e':
|
||||
case 'f':
|
||||
case 'g':
|
||||
c = CT_FLOAT;
|
||||
break;
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue