Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
/****************************************************************************
|
2021-03-08 22:39:04 +01:00
|
|
|
* libs/libc/stdio/lib_libvscanf.c
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
*
|
2021-03-31 11:19:30 +02:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
*
|
2021-03-31 11:19:30 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
*
|
2021-03-31 11:19:30 +02:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/compiler.h>
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <debug.h>
|
|
|
|
|
2019-06-03 16:45:57 +02:00
|
|
|
#include <nuttx/compiler.h>
|
2019-02-16 00:31:58 +01:00
|
|
|
#include <nuttx/streams.h>
|
|
|
|
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
#include "libc.h"
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2019-06-03 16:45:57 +02:00
|
|
|
/* CONFIG_LIBC_LONG_LONG is not a valid selection of the compiler does not
|
|
|
|
* support long long types.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CONFIG_HAVE_LONG_LONG
|
|
|
|
# undef CONFIG_LIBC_LONG_LONG
|
|
|
|
#endif
|
|
|
|
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
#define MAXLN 128
|
|
|
|
|
|
|
|
#define HH_MOD -2
|
|
|
|
#define H_MOD -1
|
|
|
|
#define NO_MOD 0
|
|
|
|
#define L_MOD 1
|
|
|
|
#define LL_MOD 2
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
/* Support special access to CODE-space strings for Harvard architectures */
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
#ifdef CONFIG_ARCH_ROMGETC
|
|
|
|
# define fmt_char(fmt) up_romgetc(fmt)
|
|
|
|
#else
|
|
|
|
# define fmt_char(fmt) (*(fmt))
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Private Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: findscanset
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Fill in the given table from the scanset at the given format.
|
|
|
|
* Return a pointer to the character the closing ']'.
|
|
|
|
* The table has a 1 wherever characters should be considered part of the
|
|
|
|
* scanset.
|
|
|
|
*
|
|
|
|
* Function findscanset based on source function __sccl of FreeBSD
|
|
|
|
* (https://github.com/lattera/freebsd/blob/master/sys/kern/subr_scanf.c)
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_LIBC_SCANSET
|
|
|
|
static FAR const char *findscanset(FAR const char *fmt,
|
|
|
|
FAR unsigned char set[32])
|
|
|
|
{
|
|
|
|
int c;
|
|
|
|
int n;
|
|
|
|
int v;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
fmt++; /* Skip '[' */
|
|
|
|
|
|
|
|
/* First `clear' the whole table */
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
c = fmt_char(fmt++); /* First char hat => negated scanset */
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
if (c == '^')
|
|
|
|
{
|
|
|
|
v = 1; /* Default => accept */
|
2020-06-04 05:31:41 +02:00
|
|
|
c = fmt_char(fmt++); /* Get new first char */
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
v = 0; /* Default => reject */
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(set, 0, 32);
|
|
|
|
if (c == 0)
|
|
|
|
{
|
|
|
|
goto doexit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now set the entries corresponding to the actual scanset to the opposite
|
|
|
|
* of the above. The first character may be ']' (or '-') without being
|
|
|
|
* special; the last character may be '-'.
|
|
|
|
*/
|
|
|
|
|
|
|
|
for (; ; )
|
|
|
|
{
|
|
|
|
set[c / 8] |= (1 << (c % 8)); /* Take character c */
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
doswitch:n = fmt_char(fmt++); /* Examine the next */
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
switch (n)
|
|
|
|
{
|
|
|
|
case 0: /* Format ended too soon */
|
|
|
|
case ']': /* End of scanset */
|
|
|
|
goto doexit;
|
|
|
|
|
|
|
|
case '-':
|
|
|
|
/* A scanset of the form [01+-] is defined as "the digit 0, the
|
|
|
|
* digit 1, the character +, the character -", but the effect of a
|
|
|
|
* scanset such as [a-zA-Z0-9] is implementation defined. The V7
|
|
|
|
* Unix scanf treats "a-z" as "the letters a through z", but treats
|
|
|
|
* "a-a" as "the letter a, the character -, and the letter a". For
|
2020-06-04 05:31:41 +02:00
|
|
|
* compatibility, the `-' is not considered to define a range if
|
|
|
|
* the character following it is either a close bracket (required
|
|
|
|
* by ANSI) or is not numerically greater than the character* we
|
|
|
|
* just stored in the table (c).
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
*/
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
n = fmt_char(fmt);
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
if (n == ']' || n < c)
|
|
|
|
{
|
|
|
|
c = '-';
|
2019-02-27 15:41:08 +01:00
|
|
|
break; /* Resume the for (; ; ) */
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
fmt++;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
/* Fill in the range */
|
|
|
|
|
|
|
|
c++;
|
|
|
|
set[c / 8] |= (1 << (c % 8)); /* Take character c */
|
|
|
|
}
|
|
|
|
while (c < n);
|
|
|
|
|
|
|
|
/* Alas, the V7 Unix scanf also treats formats such as [a-c-e] as
|
|
|
|
* "the letters a through e". This too is permitted by the
|
|
|
|
* standard.
|
|
|
|
*/
|
|
|
|
|
|
|
|
goto doswitch;
|
|
|
|
|
|
|
|
default: /* Just another character */
|
|
|
|
c = n;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
doexit:
|
|
|
|
if (v) /* Default => accept */
|
|
|
|
{
|
|
|
|
for (i = 0; i < 32; i++) /* Invert all */
|
|
|
|
{
|
|
|
|
set[i] ^= 0xff;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (fmt - 1);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2019-02-16 01:26:06 +01:00
|
|
|
* Name: lib_vscanf
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
*
|
|
|
|
* Description:
|
2019-02-16 01:26:06 +01:00
|
|
|
* Stream-oriented implementation that underlies scanf family: scanf,
|
|
|
|
* fscanf, vfscanf, sscanf, and vsscanf
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2019-02-16 01:01:39 +01:00
|
|
|
int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
|
|
|
|
FAR const IPTR char *fmt, va_list ap)
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
|
|
|
int c;
|
|
|
|
FAR char *tv;
|
|
|
|
FAR const char *tc;
|
|
|
|
int modifier;
|
|
|
|
bool noassign;
|
|
|
|
bool conv;
|
|
|
|
int assigncount;
|
|
|
|
int count;
|
|
|
|
int ngetstart;
|
|
|
|
int width;
|
|
|
|
int fwidth;
|
|
|
|
int base = 10;
|
|
|
|
char tmp[MAXLN];
|
|
|
|
|
|
|
|
#ifdef CONFIG_LIBC_LONG_LONG
|
|
|
|
FAR unsigned long long *plonglong = NULL;
|
|
|
|
#endif
|
|
|
|
FAR unsigned long *plong = NULL;
|
|
|
|
FAR unsigned int *pint = NULL;
|
|
|
|
FAR unsigned short *pshort = NULL;
|
|
|
|
FAR unsigned char *pchar = NULL;
|
|
|
|
|
|
|
|
#ifdef CONFIG_LIBC_SCANSET
|
|
|
|
unsigned char set[32]; /* Bit field (256 / 8) */
|
|
|
|
#endif
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
/* keep this for future reference:
|
|
|
|
* linfo("buf=\"%s\" fmt=\"%s\"\n", buf, fmt);
|
|
|
|
*/
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
|
|
|
|
/* Parse the format, extracting values from the input buffer as needed */
|
|
|
|
|
|
|
|
assigncount = 0;
|
|
|
|
count = 0;
|
|
|
|
width = 0;
|
|
|
|
conv = false;
|
|
|
|
noassign = false;
|
|
|
|
modifier = NO_MOD;
|
|
|
|
ngetstart = obj->nget; /* for %n calculations */
|
|
|
|
|
2019-02-14 22:43:21 +01:00
|
|
|
/* Make sure lastc is not NULL. */
|
|
|
|
|
|
|
|
if (lastc == NULL)
|
|
|
|
{
|
|
|
|
lastc = &c;
|
|
|
|
}
|
|
|
|
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
/* Loop until all characters in the fmt string have been processed. We may
|
|
|
|
* have to continue loop after reaching the end the input data in order to
|
|
|
|
* handle trailing %n format specifiers.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Get first character, we keep always the next character in c */
|
|
|
|
|
|
|
|
c = obj->get(obj);
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
while (fmt_char(fmt))
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
|
|
|
/* Skip over white spaces */
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
if (isspace(fmt_char(fmt)))
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
|
|
|
while (isspace(c))
|
|
|
|
{
|
|
|
|
c = obj->get(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
while (isspace(fmt_char(fmt)))
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
|
|
|
fmt++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check for a conversion specifier */
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
if (fmt_char(fmt) == '%')
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
|
|
|
linfo("Specifier found\n");
|
|
|
|
|
|
|
|
/* Check for qualifiers on the conversion specifier */
|
|
|
|
|
|
|
|
fmt++;
|
2020-06-04 05:31:41 +02:00
|
|
|
for (; fmt_char(fmt); fmt++)
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
2020-06-04 05:31:41 +02:00
|
|
|
linfo("Processing %c\n", fmt_char(fmt));
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
|
|
|
|
#ifdef CONFIG_LIBC_SCANSET
|
2020-06-04 05:31:41 +02:00
|
|
|
if (strchr("dibouxXcseEfFgGaAn[%", fmt_char(fmt)))
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
#else
|
2020-06-04 05:31:41 +02:00
|
|
|
if (strchr("dibouxXcseEfFgGaAn%", fmt_char(fmt)))
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
#endif
|
|
|
|
{
|
2020-06-04 05:31:41 +02:00
|
|
|
if (fmt_char(fmt) != '%')
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
|
|
|
conv = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
if (fmt_char(fmt) == '*')
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
|
|
|
noassign = true;
|
|
|
|
}
|
2020-06-04 05:31:41 +02:00
|
|
|
else if (fmt_char(fmt) == 'l' || fmt_char(fmt) == 'L')
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
|
|
|
modifier = L_MOD;
|
|
|
|
|
|
|
|
if (*(fmt + 1) == 'l' || *(fmt + 1) == 'L')
|
|
|
|
{
|
|
|
|
modifier = LL_MOD;
|
|
|
|
fmt++;
|
|
|
|
}
|
|
|
|
}
|
2020-09-23 10:52:33 +02:00
|
|
|
else if (fmt_char(fmt) == 'j')
|
|
|
|
{
|
|
|
|
/* Same as long long if available. Otherwise, long. */
|
|
|
|
#ifdef CONFIG_LIBC_LONG_LONG
|
|
|
|
modifier = LL_MOD;
|
|
|
|
#else
|
|
|
|
modifier = L_MOD;
|
|
|
|
#endif
|
|
|
|
}
|
2020-06-04 05:31:41 +02:00
|
|
|
else if (fmt_char(fmt) == 'h' || fmt_char(fmt) == 'H')
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
|
|
|
modifier = H_MOD;
|
|
|
|
|
|
|
|
if (*(fmt + 1) == 'h' || *(fmt + 1) == 'H')
|
|
|
|
{
|
|
|
|
modifier = HH_MOD;
|
|
|
|
fmt++;
|
|
|
|
}
|
|
|
|
}
|
2020-06-04 05:31:41 +02:00
|
|
|
else if (fmt_char(fmt) >= '1' && fmt_char(fmt) <= '9')
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
2020-06-04 05:31:41 +02:00
|
|
|
for (tc = fmt; isdigit(fmt_char(fmt)); fmt++)
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
;
|
|
|
|
strncpy(tmp, tc, fmt - tc);
|
|
|
|
tmp[fmt - tc] = '\0';
|
|
|
|
width = atoi(tmp);
|
|
|
|
fmt--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Process %s: String conversion */
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
if (fmt_char(fmt) == 's')
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
|
|
|
linfo("Performing string conversion\n");
|
|
|
|
|
|
|
|
/* Get a pointer to the char * value. We need to do this even
|
|
|
|
* of we have reached the end of the input data in order to
|
|
|
|
* update the 'ap' variable.
|
|
|
|
*/
|
|
|
|
|
|
|
|
tv = NULL; /* To avoid warnings about begin uninitialized */
|
|
|
|
if (!noassign)
|
|
|
|
{
|
|
|
|
tv = va_arg(ap, FAR char *);
|
|
|
|
tv[0] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Skip over white space */
|
|
|
|
|
|
|
|
while (isspace(c))
|
|
|
|
{
|
|
|
|
c = obj->get(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* But we only perform the data conversion is we still have
|
|
|
|
* bytes remaining in the input data stream.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (c > 0)
|
|
|
|
{
|
|
|
|
/* Use the actual field's width if 1) no fieldwidth
|
|
|
|
* specified or 2) the actual field's width is smaller
|
|
|
|
* than fieldwidth specified.
|
|
|
|
*/
|
|
|
|
|
|
|
|
fwidth = 0;
|
|
|
|
while ((!width || (fwidth < width)) && (c > 0) &&
|
|
|
|
!isspace(c))
|
|
|
|
{
|
|
|
|
if (!noassign)
|
|
|
|
{
|
|
|
|
tv[fwidth] = c;
|
|
|
|
}
|
|
|
|
|
|
|
|
fwidth++;
|
|
|
|
c = obj->get(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!noassign)
|
|
|
|
{
|
|
|
|
tv[fwidth] = '\0';
|
|
|
|
assigncount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_LIBC_SCANSET
|
|
|
|
/* Process %[: Scanset conversion */
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
if (fmt_char(fmt) == '[')
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
|
|
|
linfo("Performing scanset conversion\n");
|
|
|
|
|
|
|
|
fmt = findscanset(fmt, set); /* find scanset */
|
|
|
|
|
|
|
|
/* Get a pointer to the char * value. We need to do this even
|
|
|
|
* if we have reached the end of the input data in order to
|
|
|
|
* update the 'ap' variable.
|
|
|
|
*/
|
|
|
|
|
|
|
|
tv = NULL; /* To avoid warnings about begin uninitialized */
|
|
|
|
if (!noassign)
|
|
|
|
{
|
|
|
|
tv = va_arg(ap, FAR char *);
|
|
|
|
tv[0] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
/* But we only perform the data conversion is we still have
|
|
|
|
* bytes remaining in the input data stream.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (c > 0)
|
|
|
|
{
|
|
|
|
/* Use the actual field's width if 1) no fieldwidth
|
|
|
|
* specified or 2) the actual field's width is smaller
|
|
|
|
* than the fieldwidth specified.
|
|
|
|
*/
|
|
|
|
|
|
|
|
fwidth = 0;
|
|
|
|
while ((!width || (fwidth < width)) && (c > 0)
|
|
|
|
&& ((set[c / 8] & (1 << (c % 8))) != 0))
|
|
|
|
{
|
|
|
|
if (!noassign)
|
|
|
|
{
|
|
|
|
tv[fwidth] = c;
|
|
|
|
}
|
|
|
|
|
|
|
|
fwidth++;
|
|
|
|
c = obj->get(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!fwidth)
|
|
|
|
{
|
2019-02-14 22:43:21 +01:00
|
|
|
*lastc = c;
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
return assigncount;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!noassign)
|
|
|
|
{
|
|
|
|
tv[fwidth] = '\0';
|
|
|
|
assigncount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Process %c: Character conversion */
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
else if (fmt_char(fmt) == 'c')
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
|
|
|
linfo("Performing character conversion\n");
|
|
|
|
|
|
|
|
/* Get a pointer to the char * value. We need to do this even
|
|
|
|
* if we have reached the end of the input data in order to
|
|
|
|
* update the 'ap' variable.
|
|
|
|
*/
|
|
|
|
|
|
|
|
tv = NULL; /* To avoid warnings about being uninitialized */
|
|
|
|
if (!noassign)
|
|
|
|
{
|
|
|
|
tv = va_arg(ap, FAR char *);
|
|
|
|
tv[0] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
/* But we only perform the data conversion is we still have
|
|
|
|
* bytes remaining in the input data stream.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (c > 0)
|
|
|
|
{
|
|
|
|
/* Was a field width specified? */
|
|
|
|
|
|
|
|
if (!width)
|
|
|
|
{
|
|
|
|
/* No, then width is this one single character */
|
|
|
|
|
|
|
|
width = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy the character(s) (if we are making an assignment) */
|
|
|
|
|
|
|
|
fwidth = 0;
|
|
|
|
while ((fwidth < width) && c > 0)
|
|
|
|
{
|
|
|
|
if (!noassign)
|
|
|
|
{
|
|
|
|
tv[fwidth] = c;
|
|
|
|
}
|
|
|
|
|
|
|
|
fwidth++;
|
|
|
|
c = obj->get(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fwidth != width)
|
|
|
|
{
|
2019-02-14 22:43:21 +01:00
|
|
|
*lastc = c;
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
return assigncount;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!noassign)
|
|
|
|
{
|
|
|
|
assigncount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Process %d, %o, %b, %x, %u: Various integer conversions */
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
else if (strchr("dobxXui", fmt_char(fmt)))
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
|
|
|
bool sign;
|
|
|
|
|
|
|
|
linfo("Performing integer conversion\n");
|
|
|
|
|
|
|
|
/* Get a pointer to the integer value. We need to do this even
|
|
|
|
* if we have reached the end of the input data in order to
|
|
|
|
* update the 'ap' variable.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!noassign)
|
|
|
|
{
|
|
|
|
/* We have to check whether we need to return a long or an
|
|
|
|
* int.
|
|
|
|
*/
|
|
|
|
|
|
|
|
switch (modifier)
|
|
|
|
{
|
|
|
|
case HH_MOD:
|
|
|
|
pchar = va_arg(ap, FAR unsigned char *);
|
|
|
|
*pchar = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case H_MOD:
|
|
|
|
pshort = va_arg(ap, FAR unsigned short *);
|
|
|
|
*pshort = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NO_MOD:
|
|
|
|
pint = va_arg(ap, FAR unsigned int *);
|
|
|
|
*pint = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
case L_MOD:
|
|
|
|
plong = va_arg(ap, FAR unsigned long *);
|
|
|
|
*plong = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
#ifdef CONFIG_LIBC_LONG_LONG
|
|
|
|
case LL_MOD:
|
|
|
|
plonglong = va_arg(ap, FAR unsigned long long *);
|
|
|
|
*plonglong = 0;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Skip over any white space before the integer string */
|
|
|
|
|
|
|
|
while (isspace(c))
|
|
|
|
{
|
|
|
|
c = obj->get(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* But we only perform the data conversion if we still have
|
|
|
|
* bytes remaining in the input data stream.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (c > 0)
|
|
|
|
{
|
|
|
|
FAR char *endptr;
|
|
|
|
int prefix;
|
|
|
|
bool stopconv;
|
|
|
|
int errsave;
|
2019-02-15 21:38:06 +01:00
|
|
|
unsigned long tmplong = 0;
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
#ifdef CONFIG_LIBC_LONG_LONG
|
2019-02-15 21:38:06 +01:00
|
|
|
unsigned long long tmplonglong = 0;
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
#endif
|
|
|
|
/* Copy the real string into a temporary working buffer. */
|
|
|
|
|
|
|
|
if (!width || width > sizeof(tmp) - 1)
|
|
|
|
{
|
|
|
|
width = sizeof(tmp) - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The base of the integer conversion depends on the
|
|
|
|
* specific conversion specification.
|
|
|
|
*/
|
|
|
|
|
|
|
|
fwidth = 0;
|
|
|
|
prefix = 0;
|
|
|
|
stopconv = false;
|
|
|
|
sign = false;
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
switch (fmt_char(fmt))
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
|
|
|
default:
|
|
|
|
case 'd':
|
|
|
|
sign = true;
|
|
|
|
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
|
|
|
|
case 'u':
|
|
|
|
while (fwidth < width && !stopconv)
|
|
|
|
{
|
|
|
|
if (c == '-' || c == '+')
|
|
|
|
{
|
|
|
|
if (fwidth != 0)
|
|
|
|
{
|
|
|
|
stopconv = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!(c >= '0' && c <= '9'))
|
|
|
|
{
|
|
|
|
stopconv = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!stopconv)
|
|
|
|
{
|
|
|
|
tmp[fwidth++] = c;
|
|
|
|
c = obj->get(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
base = 10;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'x':
|
|
|
|
case 'X':
|
|
|
|
while (fwidth < width && !stopconv)
|
|
|
|
{
|
|
|
|
if (c == '-' || c == '+')
|
|
|
|
{
|
|
|
|
if (fwidth != 0)
|
|
|
|
{
|
|
|
|
stopconv = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (c == '0')
|
|
|
|
{
|
|
|
|
if (prefix == 0)
|
|
|
|
{
|
|
|
|
prefix = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (c == 'x' || c == 'X')
|
|
|
|
{
|
|
|
|
if (prefix == 1)
|
|
|
|
{
|
|
|
|
prefix = 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
stopconv = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!((c >= '0' && c <= '9') ||
|
|
|
|
(c >= 'a' && c <= 'f') ||
|
|
|
|
(c >= 'A' && c <= 'F')))
|
|
|
|
{
|
|
|
|
stopconv = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
prefix = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!stopconv)
|
|
|
|
{
|
|
|
|
tmp[fwidth++] = c;
|
|
|
|
c = obj->get(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
base = 16;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'o':
|
|
|
|
while (fwidth < width && !stopconv)
|
|
|
|
{
|
|
|
|
if (c == '-' || c == '+')
|
|
|
|
{
|
|
|
|
if (fwidth != 0)
|
|
|
|
{
|
|
|
|
stopconv = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!(c >= '0' && c <= '7'))
|
|
|
|
{
|
|
|
|
stopconv = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!stopconv)
|
|
|
|
{
|
|
|
|
tmp[fwidth++] = c;
|
|
|
|
c = obj->get(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
base = 8;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'b': /* not official? */
|
|
|
|
while (fwidth < width && !stopconv)
|
|
|
|
{
|
|
|
|
if (c == '-' || c == '+')
|
|
|
|
{
|
|
|
|
if (fwidth != 0)
|
|
|
|
{
|
|
|
|
stopconv = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!(c >= '0' && c <= '1'))
|
|
|
|
{
|
|
|
|
stopconv = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!stopconv)
|
|
|
|
{
|
|
|
|
tmp[fwidth++] = c;
|
|
|
|
c = obj->get(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
base = 2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'i':
|
|
|
|
sign = true;
|
|
|
|
base = 10;
|
|
|
|
|
|
|
|
while (fwidth < width && !stopconv)
|
|
|
|
{
|
|
|
|
if (c == '-' || c == '+')
|
|
|
|
{
|
|
|
|
if (fwidth != 0)
|
|
|
|
{
|
|
|
|
stopconv = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (c == '0')
|
|
|
|
{
|
|
|
|
if (prefix == 0)
|
|
|
|
{
|
|
|
|
prefix = 1;
|
|
|
|
base = 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (c == 'x' || c == 'X')
|
|
|
|
{
|
|
|
|
if (prefix == 1)
|
|
|
|
{
|
|
|
|
prefix = 2;
|
|
|
|
base = 16;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
stopconv = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!((c >= '0' && c <= '7' && base >= 8) ||
|
|
|
|
(c >= '8' && c <= '9' && base >= 10) ||
|
|
|
|
(c >= 'a' && c <= 'f' && base == 16) ||
|
|
|
|
(c >= 'A' && c <= 'F' && base == 16)))
|
|
|
|
{
|
|
|
|
stopconv = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
prefix = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!stopconv)
|
|
|
|
{
|
|
|
|
tmp[fwidth++] = c;
|
|
|
|
c = obj->get(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp[fwidth] = 0;
|
|
|
|
|
|
|
|
linfo("tmp[]=\"%s\"\n", tmp);
|
|
|
|
|
|
|
|
/* Perform the integer conversion */
|
2020-06-04 05:31:41 +02:00
|
|
|
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
/* Preserve the errno value */
|
|
|
|
|
|
|
|
errsave = get_errno();
|
|
|
|
set_errno(0);
|
|
|
|
|
|
|
|
switch (modifier)
|
|
|
|
{
|
2019-02-15 21:38:06 +01:00
|
|
|
#ifndef CONFIG_LIBC_LONG_LONG
|
|
|
|
case LL_MOD:
|
|
|
|
#endif
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
case HH_MOD:
|
|
|
|
case H_MOD:
|
|
|
|
case NO_MOD:
|
|
|
|
default:
|
|
|
|
if (sign)
|
|
|
|
{
|
|
|
|
tmplong = strtol(tmp, &endptr, base);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tmplong = strtoul(tmp, &endptr, base);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
#ifdef CONFIG_LIBC_LONG_LONG
|
|
|
|
case LL_MOD:
|
|
|
|
if (sign)
|
|
|
|
{
|
|
|
|
tmplonglong = strtoll(tmp, &endptr, base);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tmplonglong = strtoull(tmp, &endptr, base);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if the number was successfully converted */
|
|
|
|
|
|
|
|
if (tmp == endptr || get_errno() == ERANGE)
|
|
|
|
{
|
2019-02-14 22:43:21 +01:00
|
|
|
*lastc = c;
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
return assigncount;
|
|
|
|
}
|
|
|
|
|
|
|
|
set_errno(errsave);
|
|
|
|
if (!noassign)
|
|
|
|
{
|
|
|
|
/* We have to check whether we need to return a long or
|
|
|
|
* an int.
|
|
|
|
*/
|
|
|
|
|
|
|
|
switch (modifier)
|
|
|
|
{
|
|
|
|
case HH_MOD:
|
|
|
|
linfo("Return %ld to 0x%p\n", tmplong, pchar);
|
|
|
|
*pchar = (unsigned char)tmplong;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case H_MOD:
|
|
|
|
linfo("Return %ld to 0x%p\n", tmplong, pshort);
|
|
|
|
*pshort = (unsigned short)tmplong;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NO_MOD:
|
|
|
|
linfo("Return %ld to 0x%p\n", tmplong, pint);
|
|
|
|
*pint = (unsigned int)tmplong;
|
|
|
|
break;
|
|
|
|
|
2019-02-15 21:38:06 +01:00
|
|
|
#ifndef CONFIG_LIBC_LONG_LONG
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
case L_MOD:
|
2019-02-15 21:38:06 +01:00
|
|
|
#endif
|
|
|
|
default:
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
linfo("Return %ld to 0x%p\n", tmplong, plong);
|
|
|
|
*plong = tmplong;
|
|
|
|
break;
|
|
|
|
|
|
|
|
#ifdef CONFIG_LIBC_LONG_LONG
|
|
|
|
case LL_MOD:
|
|
|
|
linfo("Return %lld to 0x%p\n", tmplonglong,
|
|
|
|
plonglong);
|
|
|
|
*plonglong = tmplonglong;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
assigncount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Process %a, %A, %f, %F, %e, %E, %g, and %G: Floating point
|
|
|
|
* conversions.
|
|
|
|
*/
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
else if (strchr("aAfFeEgG", fmt_char(fmt)) != NULL)
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
|
|
|
#ifdef CONFIG_HAVE_DOUBLE
|
2020-07-25 17:25:06 +02:00
|
|
|
FAR double *pd = NULL;
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
#endif
|
|
|
|
FAR float *pf = NULL;
|
|
|
|
|
|
|
|
linfo("Performing floating point conversion\n");
|
|
|
|
|
|
|
|
/* Get a pointer to the double value. We need to do this even
|
|
|
|
* if we have reached the end of the input data in order to
|
|
|
|
* upate the 'ap' variable.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!noassign)
|
|
|
|
{
|
|
|
|
/* We have to check whether we need to return a float or a
|
|
|
|
* double.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef CONFIG_HAVE_DOUBLE
|
|
|
|
if (modifier >= L_MOD)
|
|
|
|
{
|
2020-07-25 17:25:06 +02:00
|
|
|
pd = va_arg(ap, FAR double *);
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
*pd = 0.0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
pf = va_arg(ap, FAR float *);
|
|
|
|
*pf = 0.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_LIBC_FLOATINGPOINT
|
|
|
|
|
|
|
|
/* Skip over any white space before the real string */
|
|
|
|
|
|
|
|
while (isspace(c))
|
|
|
|
{
|
|
|
|
c = obj->get(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* But we only perform the data conversion is we still have
|
|
|
|
* bytes remaining in the input data stream.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (c > 0)
|
|
|
|
{
|
|
|
|
FAR char *endptr;
|
|
|
|
bool expnt;
|
|
|
|
bool dot;
|
|
|
|
bool sign;
|
|
|
|
bool stopconv;
|
|
|
|
int errsave;
|
|
|
|
# ifdef CONFIG_HAVE_DOUBLE
|
2020-07-25 17:25:06 +02:00
|
|
|
double dvalue;
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
# endif
|
|
|
|
float fvalue;
|
|
|
|
|
|
|
|
/* Was a fieldwidth specified? */
|
|
|
|
|
|
|
|
if (!width || width > sizeof(tmp) - 1)
|
|
|
|
{
|
|
|
|
width = sizeof(tmp) - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy the real string into a temporary working buffer. */
|
|
|
|
|
|
|
|
fwidth = 0;
|
|
|
|
expnt = false;
|
|
|
|
sign = false;
|
|
|
|
dot = false;
|
|
|
|
stopconv = false;
|
|
|
|
|
|
|
|
while (fwidth < width && !stopconv)
|
|
|
|
{
|
|
|
|
if (c == '-' || c == '+')
|
|
|
|
{
|
|
|
|
if (!sign)
|
|
|
|
{
|
|
|
|
sign = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
stopconv = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (c == '.')
|
|
|
|
{
|
|
|
|
if (!dot)
|
|
|
|
{
|
|
|
|
dot = true;
|
2019-02-14 22:43:21 +01:00
|
|
|
sign = true;
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
stopconv = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (c == 'e' || c == 'E')
|
|
|
|
{
|
|
|
|
if (!expnt)
|
|
|
|
{
|
|
|
|
expnt = true;
|
|
|
|
sign = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
stopconv = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!(c >= '0' && c <= '9'))
|
|
|
|
{
|
|
|
|
stopconv = true;
|
|
|
|
}
|
2019-02-14 22:43:21 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
sign = true;
|
|
|
|
}
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
|
|
|
|
if (!stopconv)
|
|
|
|
{
|
|
|
|
tmp[fwidth++] = c;
|
|
|
|
c = obj->get(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp[fwidth] = 0;
|
|
|
|
|
|
|
|
linfo("tmp[]=\"%s\"\n", tmp);
|
|
|
|
|
|
|
|
/* Perform the floating point conversion */
|
2020-06-04 05:31:41 +02:00
|
|
|
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
/* Preserve the errno value */
|
|
|
|
|
|
|
|
errsave = get_errno();
|
|
|
|
set_errno(0);
|
|
|
|
|
|
|
|
# ifdef CONFIG_HAVE_DOUBLE
|
|
|
|
if (modifier >= L_MOD)
|
|
|
|
{
|
2020-07-25 17:25:06 +02:00
|
|
|
/* Get the converted double value */
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
|
|
|
|
dvalue = strtod(tmp, &endptr);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
# endif
|
|
|
|
{
|
|
|
|
fvalue = strtof(tmp, &endptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if the number was successfully converted */
|
|
|
|
|
|
|
|
if (tmp == endptr || get_errno() == ERANGE)
|
|
|
|
{
|
2019-02-14 22:43:21 +01:00
|
|
|
*lastc = c;
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
return assigncount;
|
|
|
|
}
|
|
|
|
|
|
|
|
set_errno(errsave);
|
|
|
|
|
|
|
|
if (!noassign)
|
|
|
|
{
|
2020-06-04 05:31:41 +02:00
|
|
|
/* We have to check whether we need to return a float
|
2020-07-25 17:25:06 +02:00
|
|
|
* or a double.
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
# ifdef CONFIG_HAVE_DOUBLE
|
|
|
|
if (modifier >= L_MOD)
|
|
|
|
{
|
2020-07-25 17:25:06 +02:00
|
|
|
/* Return the double value */
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
|
|
|
|
linfo("Return %f to %p\n", dvalue, pd);
|
|
|
|
*pd = dvalue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
# endif
|
|
|
|
{
|
|
|
|
/* Return the float value */
|
|
|
|
|
2020-07-25 17:25:06 +02:00
|
|
|
linfo("Return %f to %p\n", (double)fvalue, pf);
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
*pf = fvalue;
|
|
|
|
}
|
|
|
|
|
|
|
|
assigncount++;
|
|
|
|
}
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
count++;
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Process %n: Character count */
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
else if (fmt_char(fmt) == 'n')
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
|
|
|
linfo("Performing character count\n");
|
|
|
|
|
|
|
|
if (!noassign)
|
|
|
|
{
|
|
|
|
size_t nchars = (size_t) (obj->nget - ngetstart);
|
|
|
|
|
|
|
|
if (c != EOF)
|
|
|
|
{
|
|
|
|
/* One more character already read */
|
|
|
|
|
|
|
|
nchars--;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Note %n does not count as a conversion */
|
|
|
|
|
|
|
|
switch (modifier)
|
|
|
|
{
|
|
|
|
case HH_MOD:
|
|
|
|
pchar = va_arg(ap, FAR unsigned char *);
|
|
|
|
*pchar = (unsigned char)nchars;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case H_MOD:
|
|
|
|
pshort = va_arg(ap, FAR unsigned short *);
|
|
|
|
*pshort = (unsigned short)nchars;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NO_MOD:
|
|
|
|
pint = va_arg(ap, FAR unsigned int *);
|
|
|
|
*pint = (unsigned int)nchars;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
case L_MOD:
|
|
|
|
plong = va_arg(ap, FAR unsigned long *);
|
|
|
|
*plong = (unsigned long)nchars;
|
|
|
|
break;
|
|
|
|
|
|
|
|
#ifdef CONFIG_LIBC_LONG_LONG
|
|
|
|
case LL_MOD:
|
|
|
|
plonglong = va_arg(ap, FAR unsigned long long *);
|
|
|
|
*plonglong = (unsigned long long)nchars;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
count++;
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
}
|
2020-06-04 05:31:41 +02:00
|
|
|
else if (fmt_char(fmt) == '%')
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
|
|
|
if (c != '%')
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
c = obj->get(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
width = 0;
|
|
|
|
noassign = false;
|
|
|
|
modifier = NO_MOD;
|
|
|
|
|
|
|
|
fmt++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* It is not a conversion specifier */
|
|
|
|
|
|
|
|
else if (c > 0)
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
/* Skip over any leading spaces in the input buffer */
|
|
|
|
|
|
|
|
while (isspace(c))
|
|
|
|
{
|
|
|
|
c = obj->get(obj);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Skip over matching characters in the buffer and format */
|
|
|
|
|
2020-06-04 05:31:41 +02:00
|
|
|
if (fmt_char(fmt) != c)
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fmt++;
|
|
|
|
c = obj->get(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* NULL terminator encountered */
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* sscanf is required to return EOF if the input ends before the first
|
|
|
|
* matching failure or conversion.
|
|
|
|
*/
|
|
|
|
|
2019-02-14 22:43:21 +01:00
|
|
|
*lastc = c;
|
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>
TODO: Remove 'Missing fscanf()' bug
Clean up remaining complaints for tools/nxstyle
Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.
Author: Johannes <nivus.entwicklung@gmail.com>
- Move vscanf logic to lib_sscanf.c Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
- Added scanf and fscanf
- Added hh, h, and ll modifiers
- Fixes for standard compliance in scanf
- Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 14:03:02 +01:00
|
|
|
return (count || !conv) ? assigncount : EOF;
|
|
|
|
}
|