vfscanf.c revision 49218d4f8e4d84d1c08aeb267bcf6e451f2056dc
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Copyright (c) 2000-2001, 2004 Sendmail, Inc. and its suppliers.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * All rights reserved.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Copyright (c) 1990, 1993
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * The Regents of the University of California. All rights reserved.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * This code is derived from software contributed to Berkeley by
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Chris Torek.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * By using this file, you agree to the terms and conditions set
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * forth in the LICENSE file which can be found at the top level of
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * the sendmail distribution.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma ident "%Z%%M% %I% %E% SMI"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncSM_IDSTR(id, "@(#)$Id: vfscanf.c,v 1.53 2005/06/14 23:07:20 ca Exp $")
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#define BUF 513 /* Maximum length of numeric string. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/* Flags used during conversion. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#define POINTER 0x20 /* weird %p pointer (`fake hex') */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync** The following are used in numeric conversions only:
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync** SIGNOK, NDIGITS, DPTOK, and EXPOK are for floating point;
int sig;
char const *fmt0;
return SM_IO_EOF;
return SM_IO_EOF;
nassigned = 0;
nread = 0;
c = *fmt++;
return nassigned;
if (isspace(c))
goto literal;
width = 0;
flags = 0;
goto input_failure;
goto match_failure;
nread++;
goto again;
goto again;
fmt++;
goto again;
goto again;
goto again;
c = CT_INT;
c = CT_INT;
base = 0;
c = CT_INT;
c = CT_INT;
c = CT_INT;
c = CT_FLOAT;
c = CT_STRING;
c = CT_CCL;
c = CT_CHAR;
c = CT_INT;
return SM_IO_EOF;
if (isupper(c))
c = CT_INT;
goto input_failure;
nread++;
goto input_failure;
case CT_CHAR:
if (width == 0)
sum += n;
width -= n;
if (sum == 0)
goto input_failure;
size_t r;
width);
goto input_failure;
nread += r;
nassigned++;
case CT_CCL:
if (width == 0)
if (--width == 0)
goto input_failure;
goto match_failure;
if (--width == 0)
if (p == p0)
goto input_failure;
n = p - p0;
goto match_failure;
nassigned++;
nread += n;
case CT_STRING:
if (width == 0)
if (--width == 0)
nread += n;
if (--width == 0)
nassigned++;
case CT_INT:
width++;
if (base == 0)
goto ok;
goto ok;
goto ok;
goto ok;
goto ok;
goto ok;
ok:
if (p > buf)
goto match_failure;
(void *)(long) res;
nassigned++;
case CT_FLOAT:
goto fok;
goto fok;
goto fok;
flags =
goto fok;
fok:
while (p > buf)
goto match_failure;
double res;
nassigned++;
return nassigned;
register char *tab;
register unsigned char *fmt;
tab[n] = v;
n = *fmt;
fmt++;
tab[++c] = v;
goto doswitch;
c = *fmt++;
return fmt;
return fmt;