2004-11-23 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/stdio.h: Add new iprintf and iscanf variants. Also do some reordering. * libc/machine/powerpc/vfscanf.c: Remove __sccl function. * libc/stdio/Makefile.am: Add support for new iprintf and iscanf family functions. * libc/stdio/Makefile.in: Regenerated. * libc/stdio/fiprintf.c: Remove doc to siprintf.c. * libc/stdio/iprintf.c: Ditto. * libc/stdio/local.h (__svfiscanf_r): New prototype. * libc/stdio/siprintf.c: Add docs for various iprintf family functions. * libc/stdio/sniprintf.c: Move docs to siprintf.c. * libc/stdio/stdio.tex: Add new functions. * libc/stdio/vfscanf.c: Split out __sccl function to separate file and add special name defines so this file can be used to build vfiscanf.o. * libc/stdio/asiprintf.c: New file. * libc/stdio/fiscanf.c: Ditto. * libc/stdio/iscanf.c: Ditto. * libc/stdio/sccl.c: Ditto. * libc/stdio/siscanf.c: Ditto. * libc/stdio/vasiprintf.c: Ditto. * libc/stdio/viprintf.c: Ditto. * libc/stdio/viscanf.c: Ditto. * libc/stdio/vsiprintf.c: Ditto. * libc/stdio/vsiscanf.c: Ditto. * libc/stdio/vsniprintf.c: Ditto.
This commit is contained in:
parent
4b8e88e31d
commit
3bf091476a
|
@ -1,3 +1,32 @@
|
|||
2004-11-23 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* libc/include/stdio.h: Add new iprintf and iscanf variants. Also
|
||||
do some reordering.
|
||||
* libc/machine/powerpc/vfscanf.c: Remove __sccl function.
|
||||
* libc/stdio/Makefile.am: Add support for new iprintf and iscanf
|
||||
family functions.
|
||||
* libc/stdio/Makefile.in: Regenerated.
|
||||
* libc/stdio/fiprintf.c: Remove doc to siprintf.c.
|
||||
* libc/stdio/iprintf.c: Ditto.
|
||||
* libc/stdio/local.h (__svfiscanf_r): New prototype.
|
||||
* libc/stdio/siprintf.c: Add docs for various iprintf family functions.
|
||||
* libc/stdio/sniprintf.c: Move docs to siprintf.c.
|
||||
* libc/stdio/stdio.tex: Add new functions.
|
||||
* libc/stdio/vfscanf.c: Split out __sccl function to separate
|
||||
file and add special name defines so this file can be used
|
||||
to build vfiscanf.o.
|
||||
* libc/stdio/asiprintf.c: New file.
|
||||
* libc/stdio/fiscanf.c: Ditto.
|
||||
* libc/stdio/iscanf.c: Ditto.
|
||||
* libc/stdio/sccl.c: Ditto.
|
||||
* libc/stdio/siscanf.c: Ditto.
|
||||
* libc/stdio/vasiprintf.c: Ditto.
|
||||
* libc/stdio/viprintf.c: Ditto.
|
||||
* libc/stdio/viscanf.c: Ditto.
|
||||
* libc/stdio/vsiprintf.c: Ditto.
|
||||
* libc/stdio/vsiscanf.c: Ditto.
|
||||
* libc/stdio/vsniprintf.c: Ditto.
|
||||
|
||||
2004-11-19 Shaun Jackman <sjackman@gmail.com>
|
||||
|
||||
* libc/include/stdio.h: Add sniprintf.
|
||||
|
|
|
@ -219,7 +219,6 @@ int _EXFUN(remove, (const char *));
|
|||
int _EXFUN(rename, (const char *, const char *));
|
||||
#endif
|
||||
#ifndef __STRICT_ANSI__
|
||||
int _EXFUN(asprintf, (char **, const char *, ...));
|
||||
#ifdef _COMPILING_NEWLIB
|
||||
int _EXFUN(fseeko, (FILE *, _off_t, int));
|
||||
_off_t _EXFUN(ftello, ( FILE *));
|
||||
|
@ -227,20 +226,27 @@ _off_t _EXFUN(ftello, ( FILE *));
|
|||
int _EXFUN(fseeko, (FILE *, off_t, int));
|
||||
off_t _EXFUN(ftello, ( FILE *));
|
||||
#endif
|
||||
int _EXFUN(vfiprintf, (FILE *, const char *, __VALIST));
|
||||
int _EXFUN(iprintf, (const char *, ...));
|
||||
int _EXFUN(fiprintf, (FILE *, const char *, ...));
|
||||
int _EXFUN(siprintf, (char *, const char *, ...));
|
||||
char * _EXFUN(tempnam, (const char *, const char *));
|
||||
int _EXFUN(vasprintf, (char **, const char *, __VALIST));
|
||||
int _EXFUN(vsnprintf, (char *, size_t, const char *, __VALIST));
|
||||
int _EXFUN(vfscanf, (FILE *, const char *, __VALIST));
|
||||
int _EXFUN(vscanf, (const char *, __VALIST));
|
||||
int _EXFUN(vsscanf, (const char *, const char *, __VALIST));
|
||||
#ifndef _REENT_ONLY
|
||||
int _EXFUN(asiprintf, (char **, const char *, ...));
|
||||
int _EXFUN(asprintf, (char **, const char *, ...));
|
||||
int _EXFUN(fcloseall, (_VOID));
|
||||
int _EXFUN(fiprintf, (FILE *, const char *, ...));
|
||||
int _EXFUN(iprintf, (const char *, ...));
|
||||
int _EXFUN(siprintf, (char *, const char *, ...));
|
||||
int _EXFUN(snprintf, (char *, size_t, const char *, ...));
|
||||
int _EXFUN(sniprintf, (char *, size_t, const char *, ...));
|
||||
char * _EXFUN(tempnam, (const char *, const char *));
|
||||
int _EXFUN(vasiprintf, (char **, const char *, __VALIST));
|
||||
int _EXFUN(vasprintf, (char **, const char *, __VALIST));
|
||||
int _EXFUN(vsniprintf, (char *, size_t, const char *, __VALIST));
|
||||
int _EXFUN(vsnprintf, (char *, size_t, const char *, __VALIST));
|
||||
int _EXFUN(vfiprintf, (FILE *, const char *, __VALIST));
|
||||
int _EXFUN(vfiscanf, (FILE *, const char *, __VALIST));
|
||||
int _EXFUN(vfscanf, (FILE *, const char *, __VALIST));
|
||||
int _EXFUN(viscanf, (const char *, __VALIST));
|
||||
int _EXFUN(vscanf, (const char *, __VALIST));
|
||||
int _EXFUN(vsiscanf, (const char *, const char *, __VALIST));
|
||||
int _EXFUN(vsscanf, (const char *, const char *, __VALIST));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -272,18 +278,20 @@ int _EXFUN(putchar_unlocked, (int));
|
|||
* Recursive versions of the above.
|
||||
*/
|
||||
|
||||
int _EXFUN(_asiprintf_r, (struct _reent *, char **, const char *, ...));
|
||||
int _EXFUN(_asprintf_r, (struct _reent *, char **, const char *, ...));
|
||||
int _EXFUN(_fcloseall_r, (struct _reent *));
|
||||
FILE * _EXFUN(_fdopen_r, (struct _reent *, int, const char *));
|
||||
FILE * _EXFUN(_fopen_r, (struct _reent *, const char *, const char *));
|
||||
int _EXFUN(_fclose_r, (struct _reent *, FILE *));
|
||||
int _EXFUN(_fiscanf_r, (struct _reent *, FILE *, const char *, ...));
|
||||
int _EXFUN(_fscanf_r, (struct _reent *, FILE *, const char *, ...));
|
||||
int _EXFUN(_fseek_r, (struct _reent *, FILE *, long, int));
|
||||
long _EXFUN(_ftell_r, (struct _reent *, FILE *));
|
||||
int _EXFUN(_getchar_r, (struct _reent *));
|
||||
char * _EXFUN(_gets_r, (struct _reent *, char *));
|
||||
int _EXFUN(_iprintf_r, (struct _reent *, const char *, ...));
|
||||
int _EXFUN(_siprintf_r, (struct _reent *, char *, const char *, ...));
|
||||
int _EXFUN(_iscanf_r, (struct _reent *, const char *, ...));
|
||||
int _EXFUN(_mkstemp_r, (struct _reent *, char *));
|
||||
char * _EXFUN(_mktemp_r, (struct _reent *, char *));
|
||||
void _EXFUN(_perror_r, (struct _reent *, const char *));
|
||||
|
@ -294,22 +302,32 @@ int _EXFUN(_remove_r, (struct _reent *, const char *));
|
|||
int _EXFUN(_rename_r, (struct _reent *,
|
||||
const char *_old, const char *_new));
|
||||
int _EXFUN(_scanf_r, (struct _reent *, const char *, ...));
|
||||
int _EXFUN(_sprintf_r, (struct _reent *, char *, const char *, ...));
|
||||
int _EXFUN(_siprintf_r, (struct _reent *, char *, const char *, ...));
|
||||
int _EXFUN(_siscanf_r, (struct _reent *, const char *, const char *, ...));
|
||||
int _EXFUN(_sniprintf_r, (struct _reent *, char *, size_t, const char *, ...));
|
||||
int _EXFUN(_snprintf_r, (struct _reent *, char *, size_t, const char *, ...));
|
||||
int _EXFUN(_sprintf_r, (struct _reent *, char *, const char *, ...));
|
||||
int _EXFUN(_sscanf_r, (struct _reent *, const char *, const char *, ...));
|
||||
char * _EXFUN(_tempnam_r, (struct _reent *, const char *, const char *));
|
||||
FILE * _EXFUN(_tmpfile_r, (struct _reent *));
|
||||
char * _EXFUN(_tmpnam_r, (struct _reent *, char *));
|
||||
int _EXFUN(_ungetc_r, (struct _reent *, int, FILE *));
|
||||
int _EXFUN(_vasiprintf_r, (struct _reent *, char **, const char *, __VALIST));
|
||||
int _EXFUN(_vasprintf_r, (struct _reent *, char **, const char *, __VALIST));
|
||||
int _EXFUN(_vfiprintf_r, (struct _reent *, FILE *, const char *, __VALIST));
|
||||
int _EXFUN(_vfprintf_r, (struct _reent *, FILE *, const char *, __VALIST));
|
||||
int _EXFUN(_viprintf_r, (struct _reent *, const char *, __VALIST));
|
||||
int _EXFUN(_vprintf_r, (struct _reent *, const char *, __VALIST));
|
||||
int _EXFUN(_vsiprintf_r, (struct _reent *, char *, const char *, __VALIST));
|
||||
int _EXFUN(_vsprintf_r, (struct _reent *, char *, const char *, __VALIST));
|
||||
int _EXFUN(_vsniprintf_r, (struct _reent *, char *, size_t, const char *, __VALIST));
|
||||
int _EXFUN(_vsnprintf_r, (struct _reent *, char *, size_t, const char *, __VALIST));
|
||||
int _EXFUN(_vfiscanf_r, (struct _reent *, FILE *, const char *, __VALIST));
|
||||
int _EXFUN(_vfscanf_r, (struct _reent *, FILE *, const char *, __VALIST));
|
||||
int _EXFUN(_viscanf_r, (struct _reent *, const char *, __VALIST));
|
||||
int _EXFUN(_vscanf_r, (struct _reent *, const char *, __VALIST));
|
||||
int _EXFUN(_vsscanf_r, (struct _reent *, const char *, const char *, __VALIST));
|
||||
int _EXFUN(_vsiscanf_r, (struct _reent *, const char *, const char *, __VALIST));
|
||||
|
||||
ssize_t _EXFUN(__getdelim, (char **, size_t *, int, FILE *));
|
||||
ssize_t _EXFUN(__getline, (char **, size_t *, FILE *));
|
||||
|
|
|
@ -1260,106 +1260,3 @@ match_failure:
|
|||
return nassigned;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill in the given table from the scanset at the given format
|
||||
* (just after `['). Return a pointer to the character past the
|
||||
* closing `]'. The table has a 1 wherever characters should be
|
||||
* considered part of the scanset.
|
||||
*/
|
||||
|
||||
/*static*/
|
||||
u_char *
|
||||
__sccl (tab, fmt)
|
||||
register char *tab;
|
||||
register u_char *fmt;
|
||||
{
|
||||
register int c, n, v;
|
||||
|
||||
/* first `clear' the whole table */
|
||||
c = *fmt++; /* first char hat => negated scanset */
|
||||
if (c == '^')
|
||||
{
|
||||
v = 1; /* default => accept */
|
||||
c = *fmt++; /* get new first char */
|
||||
}
|
||||
else
|
||||
v = 0; /* default => reject */
|
||||
/* should probably use memset here */
|
||||
for (n = 0; n < 256; n++)
|
||||
tab[n] = v;
|
||||
if (c == 0)
|
||||
return fmt - 1; /* format ended before closing ] */
|
||||
|
||||
/*
|
||||
* 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 '-'.
|
||||
*/
|
||||
|
||||
v = 1 - v;
|
||||
for (;;)
|
||||
{
|
||||
tab[c] = v; /* take character c */
|
||||
doswitch:
|
||||
n = *fmt++; /* and examine the next */
|
||||
switch (n)
|
||||
{
|
||||
|
||||
case 0: /* format ended too soon */
|
||||
return fmt - 1;
|
||||
|
||||
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 compatibility, the `-' is not considerd 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).
|
||||
*/
|
||||
n = *fmt;
|
||||
if (n == ']' || n < c)
|
||||
{
|
||||
c = '-';
|
||||
break; /* resume the for(;;) */
|
||||
}
|
||||
fmt++;
|
||||
do
|
||||
{ /* fill in the range */
|
||||
tab[++c] = v;
|
||||
}
|
||||
while (c < n);
|
||||
#if 1 /* XXX another disgusting compatibility hack */
|
||||
/*
|
||||
* 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;
|
||||
#else
|
||||
c = *fmt++;
|
||||
if (c == 0)
|
||||
return fmt - 1;
|
||||
if (c == ']')
|
||||
return fmt;
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case ']': /* end of scanset */
|
||||
return fmt;
|
||||
|
||||
default: /* just another character */
|
||||
c = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ GENERAL_SOURCES = \
|
|||
fread.c \
|
||||
freopen.c \
|
||||
fscanf.c \
|
||||
fiscanf.c \
|
||||
fseek.c \
|
||||
fsetpos.c \
|
||||
ftell.c \
|
||||
|
@ -39,6 +40,7 @@ GENERAL_SOURCES = \
|
|||
getline.c \
|
||||
gets.c \
|
||||
iprintf.c \
|
||||
iscanf.c \
|
||||
makebuf.c \
|
||||
perror.c \
|
||||
printf.c \
|
||||
|
@ -53,11 +55,13 @@ GENERAL_SOURCES = \
|
|||
rewind.c \
|
||||
rget.c \
|
||||
scanf.c \
|
||||
sccl.c \
|
||||
setbuf.c \
|
||||
setbuffer.c \
|
||||
setlinebuf.c \
|
||||
setvbuf.c \
|
||||
siprintf.c \
|
||||
siscanf.c \
|
||||
sniprintf.c \
|
||||
snprintf.c \
|
||||
sprintf.c \
|
||||
|
@ -66,10 +70,14 @@ GENERAL_SOURCES = \
|
|||
tmpfile.c \
|
||||
tmpnam.c \
|
||||
ungetc.c \
|
||||
vfscanf.c \
|
||||
viprintf.c \
|
||||
viscanf.c \
|
||||
vprintf.c \
|
||||
vscanf.c \
|
||||
vsiprintf.c \
|
||||
vsiscanf.c \
|
||||
vsnprintf.c \
|
||||
vsniprintf.c \
|
||||
vsprintf.c \
|
||||
vsscanf.c \
|
||||
wbuf.c \
|
||||
|
@ -80,6 +88,7 @@ if ELIX_LEVEL_1
|
|||
LIB_OBJS =
|
||||
else
|
||||
LIB_OBJS = \
|
||||
asiprintf.$(oext) \
|
||||
asprintf.$(oext) \
|
||||
fcloseall.$(oext) \
|
||||
fseeko.$(oext) \
|
||||
|
@ -87,10 +96,11 @@ LIB_OBJS = \
|
|||
getw.$(oext) \
|
||||
mktemp.$(oext) \
|
||||
putw.$(oext) \
|
||||
vasiprintf.$(oext) \
|
||||
vasprintf.$(oext)
|
||||
endif
|
||||
|
||||
LIBADD_OBJS = vfiprintf.$(oext) vfprintf.$(oext)
|
||||
LIBADD_OBJS = vfiprintf.$(oext) vfprintf.$(oext) vfiscanf.$(oext)
|
||||
|
||||
libstdio_la_LDFLAGS = -Xcompiler -nostdlib
|
||||
|
||||
|
@ -121,6 +131,12 @@ vfprintf.$(oext): vfprintf.c
|
|||
vfiprintf.$(oext): vfprintf.c
|
||||
$(LIB_COMPILE) -fshort-enums -DINTEGER_ONLY -c $(srcdir)/vfprintf.c -o $@
|
||||
|
||||
vfscanf.$(oext): vfscanf.c
|
||||
$(LIB_COMPILE) -c $(srcdir)/vfscanf.c
|
||||
|
||||
vfiscanf.$(oext): vfscanf.c
|
||||
$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfscanf.c -o $@
|
||||
|
||||
CHEWOUT_FILES = \
|
||||
clearerr.def \
|
||||
fclose.def \
|
||||
|
@ -151,7 +167,6 @@ CHEWOUT_FILES = \
|
|||
getline.def \
|
||||
gets.def \
|
||||
getw.def \
|
||||
iprintf.def \
|
||||
mktemp.def \
|
||||
perror.def \
|
||||
putc.def \
|
||||
|
@ -168,13 +183,15 @@ CHEWOUT_FILES = \
|
|||
setlinebuf.def \
|
||||
setvbuf.def \
|
||||
siprintf.def \
|
||||
sniprintf.def \
|
||||
siscanf.def \
|
||||
sprintf.def \
|
||||
sscanf.def \
|
||||
tmpfile.def \
|
||||
tmpnam.def \
|
||||
vfprintf.def \
|
||||
vfscanf.def
|
||||
vfscanf.def \
|
||||
viprintf.def \
|
||||
viscanf.def
|
||||
|
||||
SUFFIXES = .def
|
||||
|
||||
|
@ -204,6 +221,7 @@ ftell.$(oext): local.h
|
|||
fvwrite.$(oext): local.h fvwrite.h
|
||||
fwalk.$(oext): local.h
|
||||
fwrite.$(oext): local.h fvwrite.h
|
||||
iscanf.$(oext): local.h
|
||||
makebuf.$(oext): local.h
|
||||
puts.$(oext): fvwrite.h
|
||||
refill.$(oext): local.h
|
||||
|
@ -211,14 +229,20 @@ scanf.$(oext): local.h
|
|||
setbuf.$(oext): local.h
|
||||
setvbuf.$(oext): local.h
|
||||
siprintf.$(oext): local.h
|
||||
sniprintf.$(oext): local.h
|
||||
sprintf.$(oext): local.h
|
||||
siscanf.$(oext): local.h
|
||||
sscanf.$(oext): local.h
|
||||
stdio.$(oext): local.h
|
||||
ungetc.$(oext): local.h
|
||||
vfiprintf.$(oext): local.h
|
||||
vfprintf.$(oext): local.h
|
||||
vfiscanf.$(oext): local.h floatio.h
|
||||
vfscanf.$(oext): local.h floatio.h
|
||||
viscanf.$(oext): local.h
|
||||
vscanf.$(oext): local.h
|
||||
vsniprintf.$(oext): local.h
|
||||
vsiscanf.$(oext): local.h
|
||||
vsscanf.$(oext): local.h
|
||||
wbuf.$(oext): local.h fvwrite.h
|
||||
wsetup.$(oext): local.h
|
||||
|
|
|
@ -110,12 +110,12 @@ AUTOMAKE_OPTIONS = cygnus
|
|||
|
||||
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
|
||||
|
||||
GENERAL_SOURCES = clearerr.c fclose.c fdopen.c feof.c ferror.c fflush.c fgetc.c fgetpos.c fgets.c fileno.c findfp.c fiprintf.c flags.c fopen.c fprintf.c fputc.c fputs.c fread.c freopen.c fscanf.c fseek.c fsetpos.c ftell.c fvwrite.c fwalk.c fwrite.c getc.c getchar.c getc_u.c getchar_u.c getdelim.c getline.c gets.c iprintf.c makebuf.c perror.c printf.c putc.c putchar.c putc_u.c putchar_u.c puts.c refill.c remove.c rename.c rewind.c rget.c scanf.c setbuf.c setbuffer.c setlinebuf.c setvbuf.c siprintf.c sniprintf.c snprintf.c sprintf.c sscanf.c stdio.c tmpfile.c tmpnam.c ungetc.c vfscanf.c vprintf.c vscanf.c vsnprintf.c vsprintf.c vsscanf.c wbuf.c wsetup.c
|
||||
GENERAL_SOURCES = clearerr.c fclose.c fdopen.c feof.c ferror.c fflush.c fgetc.c fgetpos.c fgets.c fileno.c findfp.c fiprintf.c flags.c fopen.c fprintf.c fputc.c fputs.c fread.c freopen.c fscanf.c fiscanf.c fseek.c fsetpos.c ftell.c fvwrite.c fwalk.c fwrite.c getc.c getchar.c getc_u.c getchar_u.c getdelim.c getline.c gets.c iprintf.c iscanf.c makebuf.c perror.c printf.c putc.c putchar.c putc_u.c putchar_u.c puts.c refill.c remove.c rename.c rewind.c rget.c scanf.c sccl.c setbuf.c setbuffer.c setlinebuf.c setvbuf.c siprintf.c siscanf.c sniprintf.c snprintf.c sprintf.c sscanf.c stdio.c tmpfile.c tmpnam.c ungetc.c viprintf.c viscanf.c vprintf.c vscanf.c vsiprintf.c vsiscanf.c vsnprintf.c vsniprintf.c vsprintf.c vsscanf.c wbuf.c wsetup.c
|
||||
|
||||
@ELIX_LEVEL_1_TRUE@LIB_OBJS =
|
||||
@ELIX_LEVEL_1_FALSE@LIB_OBJS = asprintf.$(oext) fcloseall.$(oext) fseeko.$(oext) ftello.$(oext) getw.$(oext) mktemp.$(oext) putw.$(oext) vasprintf.$(oext)
|
||||
@ELIX_LEVEL_1_FALSE@LIB_OBJS = asiprintf.$(oext) asprintf.$(oext) fcloseall.$(oext) fseeko.$(oext) ftello.$(oext) getw.$(oext) mktemp.$(oext) putw.$(oext) vasiprintf.$(oext) vasprintf.$(oext)
|
||||
|
||||
LIBADD_OBJS = vfiprintf.$(oext) vfprintf.$(oext)
|
||||
LIBADD_OBJS = vfiprintf.$(oext) vfprintf.$(oext) vfiscanf.$(oext)
|
||||
|
||||
libstdio_la_LDFLAGS = -Xcompiler -nostdlib
|
||||
|
||||
|
@ -132,7 +132,7 @@ libstdio_la_LDFLAGS = -Xcompiler -nostdlib
|
|||
@USE_LIBTOOL_FALSE@lib_a_LIBADD = $(LIBADD_OBJS) $(LIB_OBJS)
|
||||
@USE_LIBTOOL_FALSE@lib_a_DEPENDENCIES = $(LIBADD_OBJS) $(LIB_OBJS)
|
||||
|
||||
CHEWOUT_FILES = clearerr.def fclose.def fcloseall.def fdopen.def feof.def ferror.def fflush.def fgetc.def fgetpos.def fgets.def fileno.def fiprintf.def fopen.def fputc.def fputs.def fread.def freopen.def fseek.def fsetpos.def ftell.def fwrite.def getc.def getchar.def getc_u.def getchar_u.def getdelim.def getline.def gets.def getw.def iprintf.def mktemp.def perror.def putc.def putchar.def putc_u.def putchar_u.def puts.def putw.def remove.def rename.def rewind.def setbuf.def setbuffer.def setlinebuf.def setvbuf.def siprintf.def sniprintf.def sprintf.def sscanf.def tmpfile.def tmpnam.def vfprintf.def vfscanf.def
|
||||
CHEWOUT_FILES = clearerr.def fclose.def fcloseall.def fdopen.def feof.def ferror.def fflush.def fgetc.def fgetpos.def fgets.def fileno.def fiprintf.def fopen.def fputc.def fputs.def fread.def freopen.def fseek.def fsetpos.def ftell.def fwrite.def getc.def getchar.def getc_u.def getchar_u.def getdelim.def getline.def gets.def getw.def mktemp.def perror.def putc.def putchar.def putc_u.def putchar_u.def puts.def putw.def remove.def rename.def rewind.def setbuf.def setbuffer.def setlinebuf.def setvbuf.def siprintf.def siscanf.def sprintf.def sscanf.def tmpfile.def tmpnam.def vfprintf.def vfscanf.def viprintf.def viscanf.def
|
||||
|
||||
|
||||
SUFFIXES = .def
|
||||
|
@ -157,40 +157,47 @@ LIBS = @LIBS@
|
|||
@USE_LIBTOOL_FALSE@fiprintf.$(OBJEXT) flags.$(OBJEXT) fopen.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@fprintf.$(OBJEXT) fputc.$(OBJEXT) fputs.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@fread.$(OBJEXT) freopen.$(OBJEXT) fscanf.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@fseek.$(OBJEXT) fsetpos.$(OBJEXT) ftell.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@fvwrite.$(OBJEXT) fwalk.$(OBJEXT) fwrite.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@getc.$(OBJEXT) getchar.$(OBJEXT) getc_u.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@getchar_u.$(OBJEXT) getdelim.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@getline.$(OBJEXT) gets.$(OBJEXT) iprintf.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@makebuf.$(OBJEXT) perror.$(OBJEXT) printf.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@putc.$(OBJEXT) putchar.$(OBJEXT) putc_u.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@fiscanf.$(OBJEXT) fseek.$(OBJEXT) fsetpos.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@ftell.$(OBJEXT) fvwrite.$(OBJEXT) fwalk.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@fwrite.$(OBJEXT) getc.$(OBJEXT) getchar.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@getc_u.$(OBJEXT) getchar_u.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@getdelim.$(OBJEXT) getline.$(OBJEXT) gets.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@iprintf.$(OBJEXT) iscanf.$(OBJEXT) makebuf.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@perror.$(OBJEXT) printf.$(OBJEXT) putc.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@putchar.$(OBJEXT) putc_u.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@putchar_u.$(OBJEXT) puts.$(OBJEXT) refill.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@remove.$(OBJEXT) rename.$(OBJEXT) rewind.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@rget.$(OBJEXT) scanf.$(OBJEXT) setbuf.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@setbuffer.$(OBJEXT) setlinebuf.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@setvbuf.$(OBJEXT) siprintf.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@rget.$(OBJEXT) scanf.$(OBJEXT) sccl.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@setbuf.$(OBJEXT) setbuffer.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@setlinebuf.$(OBJEXT) setvbuf.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@siprintf.$(OBJEXT) siscanf.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@sniprintf.$(OBJEXT) snprintf.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@sprintf.$(OBJEXT) sscanf.$(OBJEXT) stdio.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@tmpfile.$(OBJEXT) tmpnam.$(OBJEXT) ungetc.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@vfscanf.$(OBJEXT) vprintf.$(OBJEXT) vscanf.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@vsnprintf.$(OBJEXT) vsprintf.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@vsscanf.$(OBJEXT) wbuf.$(OBJEXT) wsetup.$(OBJEXT)
|
||||
@USE_LIBTOOL_FALSE@viprintf.$(OBJEXT) viscanf.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@vprintf.$(OBJEXT) vscanf.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@vsiprintf.$(OBJEXT) vsiscanf.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@vsnprintf.$(OBJEXT) vsniprintf.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@vsprintf.$(OBJEXT) vsscanf.$(OBJEXT) wbuf.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@wsetup.$(OBJEXT)
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
|
||||
@USE_LIBTOOL_TRUE@libstdio_la_OBJECTS = clearerr.lo fclose.lo fdopen.lo \
|
||||
@USE_LIBTOOL_TRUE@feof.lo ferror.lo fflush.lo fgetc.lo fgetpos.lo \
|
||||
@USE_LIBTOOL_TRUE@fgets.lo fileno.lo findfp.lo fiprintf.lo flags.lo \
|
||||
@USE_LIBTOOL_TRUE@fopen.lo fprintf.lo fputc.lo fputs.lo fread.lo \
|
||||
@USE_LIBTOOL_TRUE@freopen.lo fscanf.lo fseek.lo fsetpos.lo ftell.lo \
|
||||
@USE_LIBTOOL_TRUE@fvwrite.lo fwalk.lo fwrite.lo getc.lo getchar.lo \
|
||||
@USE_LIBTOOL_TRUE@getc_u.lo getchar_u.lo getdelim.lo getline.lo gets.lo \
|
||||
@USE_LIBTOOL_TRUE@iprintf.lo makebuf.lo perror.lo printf.lo putc.lo \
|
||||
@USE_LIBTOOL_TRUE@putchar.lo putc_u.lo putchar_u.lo puts.lo refill.lo \
|
||||
@USE_LIBTOOL_TRUE@remove.lo rename.lo rewind.lo rget.lo scanf.lo \
|
||||
@USE_LIBTOOL_TRUE@setbuf.lo setbuffer.lo setlinebuf.lo setvbuf.lo \
|
||||
@USE_LIBTOOL_TRUE@siprintf.lo sniprintf.lo snprintf.lo sprintf.lo \
|
||||
@USE_LIBTOOL_TRUE@freopen.lo fscanf.lo fiscanf.lo fseek.lo fsetpos.lo \
|
||||
@USE_LIBTOOL_TRUE@ftell.lo fvwrite.lo fwalk.lo fwrite.lo getc.lo \
|
||||
@USE_LIBTOOL_TRUE@getchar.lo getc_u.lo getchar_u.lo getdelim.lo \
|
||||
@USE_LIBTOOL_TRUE@getline.lo gets.lo iprintf.lo iscanf.lo makebuf.lo \
|
||||
@USE_LIBTOOL_TRUE@perror.lo printf.lo putc.lo putchar.lo putc_u.lo \
|
||||
@USE_LIBTOOL_TRUE@putchar_u.lo puts.lo refill.lo remove.lo rename.lo \
|
||||
@USE_LIBTOOL_TRUE@rewind.lo rget.lo scanf.lo sccl.lo setbuf.lo \
|
||||
@USE_LIBTOOL_TRUE@setbuffer.lo setlinebuf.lo setvbuf.lo siprintf.lo \
|
||||
@USE_LIBTOOL_TRUE@siscanf.lo sniprintf.lo snprintf.lo sprintf.lo \
|
||||
@USE_LIBTOOL_TRUE@sscanf.lo stdio.lo tmpfile.lo tmpnam.lo ungetc.lo \
|
||||
@USE_LIBTOOL_TRUE@vfscanf.lo vprintf.lo vscanf.lo vsnprintf.lo \
|
||||
@USE_LIBTOOL_TRUE@viprintf.lo viscanf.lo vprintf.lo vscanf.lo \
|
||||
@USE_LIBTOOL_TRUE@vsiprintf.lo vsiscanf.lo vsnprintf.lo vsniprintf.lo \
|
||||
@USE_LIBTOOL_TRUE@vsprintf.lo vsscanf.lo wbuf.lo wsetup.lo
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
|
@ -432,6 +439,12 @@ vfprintf.$(oext): vfprintf.c
|
|||
vfiprintf.$(oext): vfprintf.c
|
||||
$(LIB_COMPILE) -fshort-enums -DINTEGER_ONLY -c $(srcdir)/vfprintf.c -o $@
|
||||
|
||||
vfscanf.$(oext): vfscanf.c
|
||||
$(LIB_COMPILE) -c $(srcdir)/vfscanf.c
|
||||
|
||||
vfiscanf.$(oext): vfscanf.c
|
||||
$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfscanf.c -o $@
|
||||
|
||||
.c.def:
|
||||
$(CHEW) < $< > $*.def 2> $*.ref
|
||||
touch stmp-def
|
||||
|
@ -452,6 +465,7 @@ ftell.$(oext): local.h
|
|||
fvwrite.$(oext): local.h fvwrite.h
|
||||
fwalk.$(oext): local.h
|
||||
fwrite.$(oext): local.h fvwrite.h
|
||||
iscanf.$(oext): local.h
|
||||
makebuf.$(oext): local.h
|
||||
puts.$(oext): fvwrite.h
|
||||
refill.$(oext): local.h
|
||||
|
@ -459,14 +473,20 @@ scanf.$(oext): local.h
|
|||
setbuf.$(oext): local.h
|
||||
setvbuf.$(oext): local.h
|
||||
siprintf.$(oext): local.h
|
||||
sniprintf.$(oext): local.h
|
||||
sprintf.$(oext): local.h
|
||||
siscanf.$(oext): local.h
|
||||
sscanf.$(oext): local.h
|
||||
stdio.$(oext): local.h
|
||||
ungetc.$(oext): local.h
|
||||
vfiprintf.$(oext): local.h
|
||||
vfprintf.$(oext): local.h
|
||||
vfiscanf.$(oext): local.h floatio.h
|
||||
vfscanf.$(oext): local.h floatio.h
|
||||
viscanf.$(oext): local.h
|
||||
vscanf.$(oext): local.h
|
||||
vsniprintf.$(oext): local.h
|
||||
vsiscanf.$(oext): local.h
|
||||
vsscanf.$(oext): local.h
|
||||
wbuf.$(oext): local.h fvwrite.h
|
||||
wsetup.$(oext): local.h
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
/* This code was copied from asprintf.c */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#include "local.h"
|
||||
|
||||
int
|
||||
#ifdef _HAVE_STDC
|
||||
_DEFUN(_asiprintf_r, (ptr, strp, fmt),
|
||||
struct _reent *ptr _AND
|
||||
char **strp _AND
|
||||
_CONST char *fmt _DOTS)
|
||||
#else
|
||||
_asiprintf_r(ptr, strp, fmt, va_alist)
|
||||
struct _reent *ptr;
|
||||
char **strp;
|
||||
_CONST char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
va_list ap;
|
||||
FILE f;
|
||||
|
||||
/* mark a zero-length reallocatable buffer */
|
||||
f._flags = __SWR | __SSTR | __SMBF;
|
||||
f._bf._base = f._p = NULL;
|
||||
f._bf._size = f._w = 0;
|
||||
f._file = -1; /* No file. */
|
||||
#ifdef _HAVE_STDC
|
||||
va_start (ap, fmt);
|
||||
#else
|
||||
va_start (ap);
|
||||
#endif
|
||||
ret = vfiprintf (&f, fmt, ap);
|
||||
va_end (ap);
|
||||
*f._p = 0;
|
||||
*strp = f._bf._base;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
#ifdef _HAVE_STDC
|
||||
_DEFUN(asiprintf, (strp, fmt),
|
||||
char **strp _AND
|
||||
_CONST char *fmt _DOTS)
|
||||
#else
|
||||
asiprintf(strp, fmt, va_alist)
|
||||
char **strp;
|
||||
_CONST char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
va_list ap;
|
||||
FILE f;
|
||||
|
||||
/* mark a zero-length reallocatable buffer */
|
||||
f._flags = __SWR | __SSTR | __SMBF;
|
||||
f._bf._base = f._p = NULL;
|
||||
f._bf._size = f._w = 0;
|
||||
f._file = -1; /* No file. */
|
||||
#ifdef _HAVE_STDC
|
||||
va_start (ap, fmt);
|
||||
#else
|
||||
va_start (ap);
|
||||
#endif
|
||||
ret = vfiprintf (&f, fmt, ap);
|
||||
va_end (ap);
|
||||
*f._p = 0;
|
||||
*strp = f._bf._base;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -15,45 +15,6 @@
|
|||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
<<fiprintf>>---format output to file (integer only)
|
||||
|
||||
INDEX
|
||||
fiprintf
|
||||
|
||||
ANSI_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
||||
int fiprintf(FILE *<[fd]>, const char *<[format]>, ...);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
||||
int fiprintf(<[fd]>, <[format]> [, <[arg]>, ...]);
|
||||
FILE *<[fd]>;
|
||||
char *<[format]>;
|
||||
|
||||
DESCRIPTION
|
||||
<<fiprintf>> is a restricted version of <<fprintf>>: it has the same
|
||||
arguments and behavior, save that it cannot perform any floating-point
|
||||
formatting---the <<f>>, <<g>>, <<G>>, <<e>>, and <<F>> type specifiers
|
||||
are not recognized.
|
||||
|
||||
RETURNS
|
||||
<<fiprintf>> returns the number of bytes in the output string,
|
||||
save that the concluding <<NULL>> is not counted.
|
||||
<<fiprintf>> returns when the end of the format string is
|
||||
encountered. If an error occurs, <<fiprintf>>
|
||||
returns <<EOF>>.
|
||||
|
||||
PORTABILITY
|
||||
<<fiprintf>> is not required by ANSI C.
|
||||
|
||||
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
||||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
#ifdef _HAVE_STDC
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#include "local.h"
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
#ifdef _HAVE_STDC
|
||||
fiscanf(FILE *fp, _CONST char *fmt, ...)
|
||||
#else
|
||||
fiscanf(FILE *fp, fmt, va_alist)
|
||||
FILE *fp;
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
va_list ap;
|
||||
|
||||
#ifdef _HAVE_STDC
|
||||
va_start (ap, fmt);
|
||||
#else
|
||||
va_start (ap);
|
||||
#endif
|
||||
ret = __svfiscanf_r (_REENT, fp, fmt, ap);
|
||||
va_end (ap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* !_REENT_ONLY */
|
||||
|
||||
int
|
||||
#ifdef _HAVE_STDC
|
||||
_fiscanf_r(struct _reent *ptr, FILE *fp, _CONST char *fmt, ...)
|
||||
#else
|
||||
_fiscanf_r(ptr, FILE *fp, fmt, va_alist)
|
||||
struct _reent *ptr;
|
||||
FILE *fp;
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
va_list ap;
|
||||
|
||||
#ifdef _HAVE_STDC
|
||||
va_start (ap, fmt);
|
||||
#else
|
||||
va_start (ap);
|
||||
#endif
|
||||
ret = __svfiscanf_r (ptr, fp, fmt, ap);
|
||||
va_end (ap);
|
||||
return (ret);
|
||||
}
|
||||
|
|
@ -15,44 +15,6 @@
|
|||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
<<iprintf>>---write formatted output (integer only)
|
||||
|
||||
INDEX
|
||||
iprintf
|
||||
|
||||
ANSI_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
||||
int iprintf(const char *<[format]>, ...);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
||||
int iprintf(<[format]> [, <[arg]>, ...])
|
||||
char *<[format]>;
|
||||
|
||||
DESCRIPTION
|
||||
<<iprintf>> is a restricted version of <<printf>>: it has the same
|
||||
arguments and behavior, save that it cannot perform any floating-point
|
||||
formatting: the <<f>>, <<g>>, <<G>>, <<e>>, and <<F>> type specifiers
|
||||
are not recognized.
|
||||
|
||||
RETURNS
|
||||
<<iprintf>> returns the number of bytes in the output string,
|
||||
save that the concluding <<NULL>> is not counted.
|
||||
<<iprintf>> returns when the end of the format string is
|
||||
encountered. If an error occurs, <<iprintf>>
|
||||
returns <<EOF>>.
|
||||
|
||||
PORTABILITY
|
||||
<<iprintf>> is not required by ANSI C.
|
||||
|
||||
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
||||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#include "local.h"
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
#ifdef _HAVE_STDC
|
||||
iscanf(_CONST char *fmt, ...)
|
||||
#else
|
||||
iscanf(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
va_list ap;
|
||||
|
||||
_REENT_SMALL_CHECK_INIT (_stdin_r (_REENT));
|
||||
#ifdef _HAVE_STDC
|
||||
va_start (ap, fmt);
|
||||
#else
|
||||
va_start (ap);
|
||||
#endif
|
||||
ret = __svfiscanf_r (_REENT, _stdin_r (_REENT), fmt, ap);
|
||||
va_end (ap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* !_REENT_ONLY */
|
||||
|
||||
int
|
||||
#ifdef _HAVE_STDC
|
||||
_iscanf_r(struct _reent *ptr, _CONST char *fmt, ...)
|
||||
#else
|
||||
_iscanf_r(ptr, fmt, va_alist)
|
||||
struct _reent *ptr;
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
va_list ap;
|
||||
|
||||
_REENT_SMALL_CHECK_INIT (_stdin_r (ptr));
|
||||
#ifdef _HAVE_STDC
|
||||
va_start (ap, fmt);
|
||||
#else
|
||||
va_start (ap);
|
||||
#endif
|
||||
ret = __svfiscanf_r (ptr, _stdin_r (ptr), fmt, ap);
|
||||
va_end (ap);
|
||||
return (ret);
|
||||
}
|
||||
|
|
@ -30,6 +30,7 @@
|
|||
#include <unistd.h>
|
||||
|
||||
extern int _EXFUN(__svfscanf_r,(struct _reent *,FILE *, _CONST char *,va_list));
|
||||
extern int _EXFUN(__svfiscanf_r,(struct _reent *,FILE *, _CONST char *,va_list));
|
||||
extern FILE *_EXFUN(__sfp,(struct _reent *));
|
||||
extern int _EXFUN(__sflags,(struct _reent *,_CONST char*, int*));
|
||||
extern int _EXFUN(__srefill,(FILE *));
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/* Split from vfscanf.c */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <newlib.h>
|
||||
#include <stdio.h>
|
||||
#include "local.h"
|
||||
|
||||
/*
|
||||
* Fill in the given table from the scanset at the given format
|
||||
* (just after `['). Return a pointer to the character past the
|
||||
* closing `]'. The table has a 1 wherever characters should be
|
||||
* considered part of the scanset.
|
||||
*/
|
||||
|
||||
u_char *
|
||||
_DEFUN(__sccl, (tab, fmt),
|
||||
register char *tab _AND
|
||||
register u_char *fmt)
|
||||
{
|
||||
register int c, n, v;
|
||||
|
||||
/* first `clear' the whole table */
|
||||
c = *fmt++; /* first char hat => negated scanset */
|
||||
if (c == '^')
|
||||
{
|
||||
v = 1; /* default => accept */
|
||||
c = *fmt++; /* get new first char */
|
||||
}
|
||||
else
|
||||
v = 0; /* default => reject */
|
||||
/* should probably use memset here */
|
||||
for (n = 0; n < 256; n++)
|
||||
tab[n] = v;
|
||||
if (c == 0)
|
||||
return fmt - 1; /* format ended before closing ] */
|
||||
|
||||
/*
|
||||
* 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 '-'.
|
||||
*/
|
||||
|
||||
v = 1 - v;
|
||||
for (;;)
|
||||
{
|
||||
tab[c] = v; /* take character c */
|
||||
doswitch:
|
||||
n = *fmt++; /* and examine the next */
|
||||
switch (n)
|
||||
{
|
||||
|
||||
case 0: /* format ended too soon */
|
||||
return fmt - 1;
|
||||
|
||||
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 compatibility, the `-' is not considerd 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).
|
||||
*/
|
||||
n = *fmt;
|
||||
if (n == ']' || n < c)
|
||||
{
|
||||
c = '-';
|
||||
break; /* resume the for(;;) */
|
||||
}
|
||||
fmt++;
|
||||
do
|
||||
{ /* fill in the range */
|
||||
tab[++c] = v;
|
||||
}
|
||||
while (c < n);
|
||||
#if 1 /* XXX another disgusting compatibility hack */
|
||||
/*
|
||||
* 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;
|
||||
#else
|
||||
c = *fmt++;
|
||||
if (c == 0)
|
||||
return fmt - 1;
|
||||
if (c == ']')
|
||||
return fmt;
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case ']': /* end of scanset */
|
||||
return fmt;
|
||||
|
||||
default: /* just another character */
|
||||
c = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
|
@ -17,37 +17,68 @@
|
|||
|
||||
/*
|
||||
FUNCTION
|
||||
<<siprintf>>---write formatted output (integer only)
|
||||
<<iprintf>>, <<fiprintf>>, <<asiprintf>>, <<siprintf>>, <<sniprintf>>---format output
|
||||
|
||||
INDEX
|
||||
fiprintf
|
||||
INDEX
|
||||
iprintf
|
||||
INDEX
|
||||
asiprintf
|
||||
INDEX
|
||||
siprintf
|
||||
INDEX
|
||||
sniprintf
|
||||
|
||||
ANSI_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
||||
int iprintf(const char *<[format]> [, <[arg]>, ...]);
|
||||
int fiprintf(FILE *<[fd]>, const char *<[format]> [, <[arg]>, ...]);
|
||||
int siprintf(char *<[str]>, const char *<[format]> [, <[arg]>, ...]);
|
||||
int asiprintf(char **<[strp]>, const char *<[format]> [, <[arg]>, ...]);
|
||||
int sniprintf(char *<[str]>, size_t <[size]>, const char *<[format]> [, <[arg]>, ...]);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int siprintf(<[str]>, <[format]>, [, <[arg]>, ...])
|
||||
char *<[str]>;
|
||||
const char *<[format]>;
|
||||
int iprintf(<[format]> [, <[arg]>, ...])
|
||||
char *<[format]>;
|
||||
|
||||
int fiprintf(<[fd]>, <[format]> [, <[arg]>, ...]);
|
||||
FILE *<[fd]>;
|
||||
char *<[format]>;
|
||||
|
||||
int asiprintf(<[strp]>, <[format]> [, <[arg]>, ...]);
|
||||
char **<[strp]>;
|
||||
char *<[format]>;
|
||||
|
||||
int siprintf(<[str]>, <[format]> [, <[arg]>, ...]);
|
||||
char *<[str]>;
|
||||
char *<[format]>;
|
||||
|
||||
int sniprintf(<[str]>, size_t <[size]>, <[format]> [, <[arg]>, ...]);
|
||||
char *<[str]>;
|
||||
size_t <[size]>;
|
||||
char *<[format]>;
|
||||
|
||||
DESCRIPTION
|
||||
<<siprintf>> is a restricted version of <<sprintf>>: it has the same
|
||||
arguments and behavior, save that it cannot perform any floating-point
|
||||
formatting: the <<f>>, <<g>>, <<G>>, <<e>>, and <<F>> type specifiers
|
||||
are not recognized.
|
||||
<<iprintf>>, <<fiprintf>>, <<siprintf>>, <<sniprintf>>,
|
||||
<<asiprintf>>, are the same as <<printf>>, <<fprintf>>,
|
||||
<<sprintf>>, <<snprintf>>, and <<asprintf>>, respectively,
|
||||
only that they restrict usage to non-floating-point format
|
||||
specifiers.
|
||||
|
||||
RETURNS
|
||||
<<siprintf>> returns the number of bytes in the output string,
|
||||
save that the concluding <<NULL>> is not counted.
|
||||
<<siprintf>> returns when the end of the format string is
|
||||
encountered.
|
||||
<<siprintf>> and <<asiprintf>> return the number of bytes in the output string,
|
||||
save that the concluding <<NULL>> is not counted.
|
||||
<<iprintf>> and <<fiprintf>> return the number of characters transmitted.
|
||||
If an error occurs, <<iprintf>> and <<fiprintf>> return <<EOF>> and
|
||||
<<asiprintf>> returns -1. No error returns occur for <<siprintf>>.
|
||||
|
||||
PORTABILITY
|
||||
<<siprintf>> is not required by ANSI C.
|
||||
<<iprintf>>, <<fiprintf>>, <<siprintf>>, <<sniprintf>>, and <<asprintf>>
|
||||
are newlib extensions.
|
||||
|
||||
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
||||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
|
@ -64,6 +95,39 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
|||
#include <limits.h>
|
||||
#include "local.h"
|
||||
|
||||
int
|
||||
#ifdef _HAVE_STDC
|
||||
_DEFUN(_siprintf_r, (ptr, str, fmt),
|
||||
struct _reent *ptr _AND
|
||||
char *str _AND
|
||||
_CONST char *fmt _DOTS)
|
||||
#else
|
||||
_siprintf_r(ptr, str, fmt, va_alist)
|
||||
struct _reent *ptr;
|
||||
char *str;
|
||||
_CONST char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
va_list ap;
|
||||
FILE f;
|
||||
|
||||
f._flags = __SWR | __SSTR;
|
||||
f._bf._base = f._p = (unsigned char *) str;
|
||||
f._bf._size = f._w = INT_MAX;
|
||||
f._file = -1; /* No file. */
|
||||
#ifdef _HAVE_STDC
|
||||
va_start (ap, fmt);
|
||||
#else
|
||||
va_start (ap);
|
||||
#endif
|
||||
ret = _vfiprintf_r (ptr, &f, fmt, ap);
|
||||
va_end (ap);
|
||||
*f._p = 0;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
|
@ -73,9 +137,9 @@ _DEFUN(siprintf, (str, fmt),
|
|||
_CONST char *fmt _DOTS)
|
||||
#else
|
||||
siprintf(str, fmt, va_alist)
|
||||
char *str;
|
||||
_CONST char *fmt;
|
||||
va_dcl
|
||||
char *str;
|
||||
_CONST char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
|
@ -91,44 +155,10 @@ siprintf(str, fmt, va_alist)
|
|||
#else
|
||||
va_start (ap);
|
||||
#endif
|
||||
ret = vfiprintf (&f, fmt, ap);
|
||||
ret = _vfiprintf_r (_REENT, &f, fmt, ap);
|
||||
va_end (ap);
|
||||
*f._p = 0;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#endif /* ! _REENT_ONLY */
|
||||
|
||||
int
|
||||
#ifdef _HAVE_STDC
|
||||
_DEFUN(_siprintf_r, (rptr, str, fmt),
|
||||
struct _reent *rptr _AND
|
||||
char *str _AND
|
||||
_CONST char *fmt _DOTS)
|
||||
#else
|
||||
_siprintf_r(rptr, str, fmt, va_alist)
|
||||
struct _reent *rptr;
|
||||
char *str;
|
||||
_CONST char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
va_list ap;
|
||||
FILE f;
|
||||
|
||||
f._flags = __SWR | __SSTR;
|
||||
f._bf._base = f._p = (unsigned char *) str;
|
||||
f._bf._size = f._w = INT_MAX;
|
||||
f._file = -1; /* No file. */
|
||||
#ifdef _HAVE_STDC
|
||||
va_start (ap, fmt);
|
||||
#else
|
||||
va_start (ap);
|
||||
#endif
|
||||
ret = _vfiprintf_r (rptr, &f, fmt, ap);
|
||||
va_end (ap);
|
||||
*f._p = 0;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,193 @@
|
|||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
<<iscanf>>, <<fiscanf>>, <<siscanf>>---scan and format non-floating input
|
||||
|
||||
INDEX
|
||||
iscanf
|
||||
INDEX
|
||||
fiscanf
|
||||
INDEX
|
||||
siscanf
|
||||
|
||||
ANSI_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
||||
int iscanf(const char *<[format]> [, <[arg]>, ...]);
|
||||
int fiscanf(FILE *<[fd]>, const char *<[format]> [, <[arg]>, ...]);
|
||||
int siscanf(const char *<[str]>, const char *<[format]>
|
||||
[, <[arg]>, ...]);
|
||||
|
||||
int _iscanf_r(struct _reent *<[ptr]>, const char *<[format]> [, <[arg]>, ...]);
|
||||
int _fiscanf_r(struct _reent *<[ptr]>, FILE *<[fd]>, const char *<[format]> [, <[arg]>, ...]);
|
||||
int _siscanf_r(struct _reent *<[ptr]>, const char *<[str]>, const char *<[format]>
|
||||
[, <[arg]>, ...]);
|
||||
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
||||
int iscanf(<[format]> [, <[arg]>, ...])
|
||||
char *<[format]>;
|
||||
|
||||
int fiscanf(<[fd]>, <[format]> [, <[arg]>, ...]);
|
||||
FILE *<[fd]>;
|
||||
char *<[format]>;
|
||||
|
||||
int siscanf(<[str]>, <[format]> [, <[arg]>, ...]);
|
||||
char *<[str]>;
|
||||
char *<[format]>;
|
||||
|
||||
int _iscanf_r(<[ptr]>, <[format]> [, <[arg]>, ...])
|
||||
struct _reent *<[ptr]>;
|
||||
char *<[format]>;
|
||||
|
||||
int _fiscanf_r(<[ptr]>, <[fd]>, <[format]> [, <[arg]>, ...]);
|
||||
struct _reent *<[ptr]>;
|
||||
FILE *<[fd]>;
|
||||
char *<[format]>;
|
||||
|
||||
int _siscanf_r(<[ptr]>, <[str]>, <[format]> [, <[arg]>, ...]);
|
||||
struct _reent *<[ptr]>;
|
||||
char *<[str]>;
|
||||
char *<[format]>;
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
<<iscanf>>, <<fiscanf>>, and <<siscanf>> are the same as
|
||||
<<scanf>>, <<fscanf>>, and <<sscanf>> respectively, only that
|
||||
they restrict the available formats to non-floating-point
|
||||
format specifiers.
|
||||
|
||||
The routines <<_iscanf_r>>, <<_fiscanf_r>>, and <<_siscanf_r>> are reentrant
|
||||
versions of <<iscanf>>, <<fiscanf>>, and <<siscanf>> that take an additional
|
||||
first argument pointing to a reentrancy structure.
|
||||
|
||||
RETURNS
|
||||
<<iscanf>> returns the number of input fields successfully
|
||||
scanned, converted and stored; the return value does
|
||||
not include scanned fields which were not stored.
|
||||
|
||||
If <<iscanf>> attempts to read at end-of-file, the return
|
||||
value is <<EOF>>.
|
||||
|
||||
If no fields were stored, the return value is <<0>>.
|
||||
|
||||
PORTABILITY
|
||||
<<iscanf>>, <<fiscanf>>, and <<siscanf>> are newlib extensions.
|
||||
|
||||
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
||||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#include "local.h"
|
||||
|
||||
/* | ARGSUSED */
|
||||
/*SUPPRESS 590*/
|
||||
static _READ_WRITE_RETURN_TYPE
|
||||
_DEFUN(eofread, (cookie, buf, len),
|
||||
_PTR cookie _AND
|
||||
char *buf _AND
|
||||
int len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
|
||||
#ifdef _HAVE_STDC
|
||||
int
|
||||
_DEFUN(siscanf, (str, fmt),
|
||||
_CONST char *str _AND
|
||||
_CONST char *fmt _DOTS)
|
||||
#else
|
||||
int
|
||||
siscanf(str, fmt, va_alist)
|
||||
_CONST char *str;
|
||||
_CONST char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
va_list ap;
|
||||
FILE f;
|
||||
|
||||
f._flags = __SRD | __SSTR;
|
||||
f._bf._base = f._p = (unsigned char *) str;
|
||||
f._bf._size = f._r = strlen (str);
|
||||
f._read = eofread;
|
||||
f._ub._base = NULL;
|
||||
f._lb._base = NULL;
|
||||
f._file = -1; /* No file. */
|
||||
#ifdef _HAVE_STDC
|
||||
va_start (ap, fmt);
|
||||
#else
|
||||
va_start (ap);
|
||||
#endif
|
||||
ret = __svfiscanf_r (_REENT, &f, fmt, ap);
|
||||
va_end (ap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* !_REENT_ONLY */
|
||||
|
||||
#ifdef _HAVE_STDC
|
||||
int
|
||||
_DEFUN(_siscanf_r, (ptr, str, fmt),
|
||||
struct _reent *ptr _AND
|
||||
_CONST char *str _AND
|
||||
_CONST char *fmt _DOTS)
|
||||
#else
|
||||
int
|
||||
_siscanf_r(ptr, str, fmt, va_alist)
|
||||
struct _reent *ptr;
|
||||
_CONST char *str;
|
||||
_CONST char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
va_list ap;
|
||||
FILE f;
|
||||
|
||||
f._flags = __SRD | __SSTR;
|
||||
f._bf._base = f._p = (unsigned char *) str;
|
||||
f._bf._size = f._r = strlen (str);
|
||||
f._read = eofread;
|
||||
f._ub._base = NULL;
|
||||
f._lb._base = NULL;
|
||||
f._file = -1; /* No file. */
|
||||
#ifdef _HAVE_STDC
|
||||
va_start (ap, fmt);
|
||||
#else
|
||||
va_start (ap);
|
||||
#endif
|
||||
ret = __svfiscanf_r (ptr, &f, fmt, ap);
|
||||
va_end (ap);
|
||||
return ret;
|
||||
}
|
|
@ -17,45 +17,6 @@
|
|||
|
||||
/* This code created by modifying snprintf.c so copyright inherited. */
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
<<sniprintf>>---write formatted output (integer only)
|
||||
|
||||
INDEX
|
||||
sniprintf
|
||||
|
||||
ANSI_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
||||
int sniprintf(char *<[str]>, size_t <[size]>, const char *<[format]> [, <[arg]>, ...]);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
||||
int sniprintf(<[str]>, size_t <[size]>, <[format]> [, <[arg]>, ...]);
|
||||
char *<[str]>;
|
||||
size_t <[size]>;
|
||||
char *<[format]>;
|
||||
|
||||
DESCRIPTION
|
||||
<<sniprintf>> is a restricted version of <<snprintf>>: it has the same
|
||||
arguments and behavior, save that it cannot perform any floating-point
|
||||
formatting: the <<f>>, <<g>>, <<G>>, <<e>>, and <<F>> type specifiers
|
||||
are not recognized.
|
||||
|
||||
RETURNS
|
||||
<<sniprintf>> returns the number of bytes in the output string,
|
||||
save that the concluding <<NULL>> is not counted.
|
||||
<<sniprintf>> returns when the end of the format string is
|
||||
encountered.
|
||||
|
||||
PORTABILITY
|
||||
<<sniprintf>> is not required by ANSI C.
|
||||
|
||||
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
||||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -34,7 +34,6 @@ structure.
|
|||
* fgetpos:: Record position in a stream or file
|
||||
* fgets:: Get character string from a file or stream
|
||||
* fileno:: Get file descriptor associated with stream
|
||||
* fiprintf:: Write formatted output to file (integer only)
|
||||
* fopen:: Open a file
|
||||
* fdopen:: Turn an open file into a stream
|
||||
* fputc:: Write a character on a stream or file
|
||||
|
@ -53,7 +52,6 @@ structure.
|
|||
* getline:: Get character string from a file or stream
|
||||
* gets:: Get character string from standard input (obsolete)
|
||||
* getw:: Get a word (int) from a file or stream
|
||||
* iprintf:: Write formatted output (integer only)
|
||||
* mktemp:: Generate unused file name
|
||||
* perror:: Print an error message on standard error
|
||||
* putc:: Write a character on a stream or file (macro)
|
||||
|
@ -69,12 +67,14 @@ structure.
|
|||
* setbuffer:: Specify full buffering for a file or stream with size
|
||||
* setlinebuf:: Specify line buffering for a file or stream
|
||||
* setvbuf:: Specify buffering for a file or stream
|
||||
* siprintf:: Write formatted output to string (integer only)
|
||||
* sniprintf:: Write formatted output to string up to max size (integer only)
|
||||
* printf:: Write formatted output
|
||||
* scanf:: Scan and format input
|
||||
* iprintf:: Write formatted output (integer only)
|
||||
* iscanf:: Scan and format input (integer only)
|
||||
* tmpfile:: Create a temporary file
|
||||
* tmpnam:: Generate name for a temporary file
|
||||
* viprintf:: Format variable argument list for non-floating-point output
|
||||
* viscanf:: Scan variable format list for non-floating-point input
|
||||
* vprintf:: Format variable argument list
|
||||
* vscanf:: Format variable argument list
|
||||
@end menu
|
||||
|
@ -109,9 +109,6 @@ structure.
|
|||
@page
|
||||
@include stdio/fileno.def
|
||||
|
||||
@page
|
||||
@include stdio/fiprintf.def
|
||||
|
||||
@page
|
||||
@include stdio/fopen.def
|
||||
|
||||
|
@ -166,9 +163,6 @@ structure.
|
|||
@page
|
||||
@include stdio/getw.def
|
||||
|
||||
@page
|
||||
@include stdio/iprintf.def
|
||||
|
||||
@page
|
||||
@include stdio/mktemp.def
|
||||
|
||||
|
@ -214,18 +208,18 @@ structure.
|
|||
@page
|
||||
@include stdio/setvbuf.def
|
||||
|
||||
@page
|
||||
@include stdio/siprintf.def
|
||||
|
||||
@page
|
||||
@include stdio/sniprintf.def
|
||||
|
||||
@page
|
||||
@include stdio/sprintf.def
|
||||
|
||||
@page
|
||||
@include stdio/sscanf.def
|
||||
|
||||
@page
|
||||
@include stdio/siprintf.def
|
||||
|
||||
@page
|
||||
@include stdio/siscanf.def
|
||||
|
||||
@page
|
||||
@include stdio/tmpfile.def
|
||||
|
||||
|
@ -237,3 +231,10 @@ structure.
|
|||
|
||||
@page
|
||||
@include stdio/vfscanf.def
|
||||
|
||||
@page
|
||||
@include stdio/viprintf.def
|
||||
|
||||
@page
|
||||
@include stdio/viscanf.def
|
||||
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
/* This code was based on vsiprintf.c */
|
||||
/* doc in vfprintf.c */
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
_DEFUN(vasiprintf, (strp, fmt, ap),
|
||||
char **strp _AND
|
||||
_CONST char *fmt _AND
|
||||
va_list ap)
|
||||
{
|
||||
int ret;
|
||||
FILE f;
|
||||
|
||||
f._flags = __SWR | __SSTR | __SMBF;
|
||||
f._bf._base = f._p = NULL;
|
||||
f._bf._size = f._w = 0;
|
||||
f._file = -1; /* No file. */
|
||||
ret = _vfiprintf_r (_REENT, &f, fmt, ap);
|
||||
*f._p = 0;
|
||||
*strp = f._bf._base;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* !_REENT_ONLY */
|
||||
|
||||
int
|
||||
_DEFUN(_vasiprintf_r, (ptr, strp, fmt, ap),
|
||||
struct _reent *ptr _AND
|
||||
char **strp _AND
|
||||
_CONST char *fmt _AND
|
||||
va_list ap)
|
||||
{
|
||||
int ret;
|
||||
FILE f;
|
||||
|
||||
f._flags = __SWR | __SSTR | __SMBF ;
|
||||
f._bf._base = f._p = NULL;
|
||||
f._bf._size = f._w = 0;
|
||||
f._file = -1; /* No file. */
|
||||
ret = _vfiprintf_r (ptr, &f, fmt, ap);
|
||||
*f._p = 0;
|
||||
*strp = f._bf._base;
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -119,9 +119,20 @@ Supporting OS subroutines required:
|
|||
#endif
|
||||
#include "local.h"
|
||||
|
||||
#ifndef NO_FLOATING_POINT
|
||||
#ifdef INTEGER_ONLY
|
||||
#define VFSCANF vfiscanf
|
||||
#define _VFSCANF_R _vfiscanf_r
|
||||
#define __SVFSCANF __svfiscanf
|
||||
#define __SVFSCANF_R __svfiscanf_r
|
||||
#else
|
||||
#define VFSCANF vfscanf
|
||||
#define _VFSCANF_R _vfscanf_r
|
||||
#define __SVFSCANF __svfscanf
|
||||
#define __SVFSCANF_R __svfscanf_r
|
||||
#ifndef NO_FLOATING_POINT
|
||||
#define FLOATING_POINT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef FLOATING_POINT
|
||||
#include <float.h>
|
||||
|
@ -214,39 +225,39 @@ typedef unsigned long long u_long_long;
|
|||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
_DEFUN(vfscanf, (fp, fmt, ap),
|
||||
_DEFUN(VFSCANF, (fp, fmt, ap),
|
||||
register FILE *fp _AND
|
||||
_CONST char *fmt _AND
|
||||
va_list ap)
|
||||
{
|
||||
CHECK_INIT(fp);
|
||||
return __svfscanf_r (_REENT, fp, fmt, ap);
|
||||
return __SVFSCANF_R (_REENT, fp, fmt, ap);
|
||||
}
|
||||
|
||||
int
|
||||
_DEFUN(__svfscanf, (fp, fmt0, ap),
|
||||
_DEFUN(__SVFSCANF, (fp, fmt0, ap),
|
||||
register FILE *fp _AND
|
||||
char _CONST *fmt0 _AND
|
||||
va_list ap)
|
||||
{
|
||||
return __svfscanf_r (_REENT, fp, fmt0, ap);
|
||||
return __SVFSCANF_R (_REENT, fp, fmt0, ap);
|
||||
}
|
||||
|
||||
#endif /* !_REENT_ONLY */
|
||||
|
||||
int
|
||||
_DEFUN(_vfscanf_r, (data, fp, fmt, ap),
|
||||
_DEFUN(_VFSCANF_R, (data, fp, fmt, ap),
|
||||
struct _reent *data _AND
|
||||
register FILE *fp _AND
|
||||
_CONST char *fmt _AND
|
||||
va_list ap)
|
||||
{
|
||||
return __svfscanf_r (data, fp, fmt, ap);
|
||||
return __SVFSCANF_R (data, fp, fmt, ap);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_DEFUN(__svfscanf_r, (rptr, fp, fmt0, ap),
|
||||
_DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
|
||||
struct _reent *rptr _AND
|
||||
register FILE *fp _AND
|
||||
char _CONST *fmt0 _AND
|
||||
|
@ -1169,107 +1180,3 @@ all_done:
|
|||
_funlockfile (fp);
|
||||
return nassigned;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill in the given table from the scanset at the given format
|
||||
* (just after `['). Return a pointer to the character past the
|
||||
* closing `]'. The table has a 1 wherever characters should be
|
||||
* considered part of the scanset.
|
||||
*/
|
||||
|
||||
/*static*/
|
||||
u_char *
|
||||
_DEFUN(__sccl, (tab, fmt),
|
||||
register char *tab _AND
|
||||
register u_char *fmt)
|
||||
{
|
||||
register int c, n, v;
|
||||
|
||||
/* first `clear' the whole table */
|
||||
c = *fmt++; /* first char hat => negated scanset */
|
||||
if (c == '^')
|
||||
{
|
||||
v = 1; /* default => accept */
|
||||
c = *fmt++; /* get new first char */
|
||||
}
|
||||
else
|
||||
v = 0; /* default => reject */
|
||||
/* should probably use memset here */
|
||||
for (n = 0; n < 256; n++)
|
||||
tab[n] = v;
|
||||
if (c == 0)
|
||||
return fmt - 1; /* format ended before closing ] */
|
||||
|
||||
/*
|
||||
* 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 '-'.
|
||||
*/
|
||||
|
||||
v = 1 - v;
|
||||
for (;;)
|
||||
{
|
||||
tab[c] = v; /* take character c */
|
||||
doswitch:
|
||||
n = *fmt++; /* and examine the next */
|
||||
switch (n)
|
||||
{
|
||||
|
||||
case 0: /* format ended too soon */
|
||||
return fmt - 1;
|
||||
|
||||
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 compatibility, the `-' is not considerd 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).
|
||||
*/
|
||||
n = *fmt;
|
||||
if (n == ']' || n < c)
|
||||
{
|
||||
c = '-';
|
||||
break; /* resume the for(;;) */
|
||||
}
|
||||
fmt++;
|
||||
do
|
||||
{ /* fill in the range */
|
||||
tab[++c] = v;
|
||||
}
|
||||
while (c < n);
|
||||
#if 1 /* XXX another disgusting compatibility hack */
|
||||
/*
|
||||
* 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;
|
||||
#else
|
||||
c = *fmt++;
|
||||
if (c == 0)
|
||||
return fmt - 1;
|
||||
if (c == ']')
|
||||
return fmt;
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case ']': /* end of scanset */
|
||||
return fmt;
|
||||
|
||||
default: /* just another character */
|
||||
c = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
|
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
<<viprintf>>, <<vfiprintf>>, <<vsiprintf>>---format argument list
|
||||
|
||||
INDEX
|
||||
viprintf
|
||||
INDEX
|
||||
vfiprintf
|
||||
INDEX
|
||||
vsiprintf
|
||||
INDEX
|
||||
vsniprintf
|
||||
|
||||
ANSI_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
int viprintf(const char *<[fmt]>, va_list <[list]>);
|
||||
int vfiprintf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
|
||||
int vsiprintf(char *<[str]>, const char *<[fmt]>, va_list <[list]>);
|
||||
int vasiprintf(char **<[strp]>, const char *<[fmt]>, va_list <[list]>);
|
||||
int vsniprintf(char *<[str]>, size_t <[size]>, const char *<[fmt]>, va_list <[list]>);
|
||||
|
||||
int _viprintf_r(struct _reent *<[reent]>, const char *<[fmt]>,
|
||||
va_list <[list]>);
|
||||
int _vfiprintf_r(struct _reent *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
|
||||
va_list <[list]>);
|
||||
int _vasiprintf_r(struct _reent *<[reent]>, char **<[str]>, const char *<[fmt]>,
|
||||
va_list <[list]>);
|
||||
int _vsiprintf_r(struct _reent *<[reent]>, char *<[str]>, const char *<[fmt]>,
|
||||
va_list <[list]>);
|
||||
int _vsniprintf_r(struct _reent *<[reent]>, char *<[str]>, size_t <[size]>, const char *<[fmt]>,
|
||||
va_list <[list]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
#include <varargs.h>
|
||||
int viprintf( <[fmt]>, <[list]>)
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int vfiprintf(<[fp]>, <[fmt]>, <[list]>)
|
||||
FILE *<[fp]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int vasiprintf(<[strp]>, <[fmt]>, <[list]>)
|
||||
char **<[strp]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int vsiprintf(<[str]>, <[fmt]>, <[list]>)
|
||||
char *<[str]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int vsniprintf(<[str]>, <[size]>, <[fmt]>, <[list]>)
|
||||
char *<[str]>;
|
||||
size_t <[size]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _viprintf_r(<[reent]>, <[fmt]>, <[list]>)
|
||||
struct _reent *<[reent]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _vfiprintf_r(<[reent]>, <[fp]>, <[fmt]>, <[list]>)
|
||||
struct _reent *<[reent]>;
|
||||
FILE *<[fp]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _vasiprintf_r(<[reent]>, <[strp]>, <[fmt]>, <[list]>)
|
||||
struct _reent *<[reent]>;
|
||||
char **<[strp]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _vsiprintf_r(<[reent]>, <[str]>, <[fmt]>, <[list]>)
|
||||
struct _reent *<[reent]>;
|
||||
char *<[str]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _vsniprintf_r(<[reent]>, <[str]>, <[size]>, <[fmt]>, <[list]>)
|
||||
struct _reent *<[reent]>;
|
||||
char *<[str]>;
|
||||
size_t <[size]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
DESCRIPTION
|
||||
<<viprintf>>, <<vfiprintf>>, <<vasiprintf>>, <<vsiprintf>> and
|
||||
<<vsniprintf>> are (respectively) variants of <<iprintf>>, <<fiprintf>>,
|
||||
<<asiprintf>>, <<siprintf>>, and <<sniprintf>>. They differ only in
|
||||
restricting the caller to use non-floating-point format specifiers.
|
||||
|
||||
RETURNS
|
||||
The return values are consistent with the corresponding functions:
|
||||
<<vasiprintf>>/<<vsiprintf>> returns the number of bytes in the output string,
|
||||
save that the concluding <<NULL>> is not counted.
|
||||
<<viprintf>> and <<vfiprintf>> return the number of characters transmitted.
|
||||
If an error occurs, <<viprintf>> and <<vfiprintf>> return <<EOF>> and
|
||||
<<vasiprintf>> returns -1. No error returns occur for <<vsiprintf>>.
|
||||
|
||||
PORTABILITY
|
||||
<<viprintf>>, <<vfiprintf>>, <<vasiprintf>>, <<vsiprintf>> and <<vsniprintf>>
|
||||
are newlib extensions.
|
||||
|
||||
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
||||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#include "local.h"
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
_DEFUN(viprintf, (fmt, ap),
|
||||
_CONST char *fmt _AND
|
||||
va_list ap)
|
||||
{
|
||||
_REENT_SMALL_CHECK_INIT (_stdout_r (_REENT));
|
||||
return _vfiprintf_r (_REENT, _stdout_r (_REENT), fmt, ap);
|
||||
}
|
||||
|
||||
#endif /* !_REENT_ONLY */
|
||||
|
||||
int
|
||||
_DEFUN(_viprintf_r, (ptr, fmt, ap),
|
||||
struct _reent *ptr _AND
|
||||
_CONST char *fmt _AND
|
||||
va_list ap)
|
||||
{
|
||||
_REENT_SMALL_CHECK_INIT (_stdout_r (ptr));
|
||||
return _vfiprintf_r (ptr, _stdout_r (ptr), fmt, ap);
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
/*-
|
||||
* Code created by modifying iscanf.c which has following copyright.
|
||||
*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
<<viscanf>>, <<vfiscanf>>, <<vsiscanf>>---format argument list
|
||||
|
||||
INDEX
|
||||
viscanf
|
||||
INDEX
|
||||
vfiscanf
|
||||
INDEX
|
||||
vsiscanf
|
||||
|
||||
ANSI_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
int viscanf(const char *<[fmt]>, va_list <[list]>);
|
||||
int vfiscanf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
|
||||
int vsiscanf(const char *<[str]>, const char *<[fmt]>, va_list <[list]>);
|
||||
|
||||
int _viscanf_r(struct _reent *<[reent]>, const char *<[fmt]>,
|
||||
va_list <[list]>);
|
||||
int _vfiscanf_r(struct _reent *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
|
||||
va_list <[list]>);
|
||||
int _vsiscanf_r(struct _reent *<[reent]>, const char *<[str]>, const char *<[fmt]>,
|
||||
va_list <[list]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
#include <varargs.h>
|
||||
int viscanf( <[fmt]>, <[ist]>)
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int vfiscanf( <[fp]>, <[fmt]>, <[list]>)
|
||||
FILE *<[fp]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int vsiscanf( <[str]>, <[fmt]>, <[list]>)
|
||||
char *<[str]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _viscanf_r( <[reent]>, <[fmt]>, <[ist]>)
|
||||
struct _reent *<[reent]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _vfiscanf_r( <[reent]>, <[fp]>, <[fmt]>, <[list]>)
|
||||
struct _reent *<[reent]>;
|
||||
FILE *<[fp]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
int _vsiscanf_r( <[reent]>, <[str]>, <[fmt]>, <[list]>)
|
||||
struct _reent *<[reent]>;
|
||||
char *<[str]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
DESCRIPTION
|
||||
<<viscanf>>, <<vfiscanf>>, and <<vsiscanf>> are (respectively) variants
|
||||
of <<iscanf>>, <<fiscanf>>, and <<siscanf>>. They differ only in
|
||||
allowing their caller to pass the variable argument list as a
|
||||
<<va_list>> object (initialized by <<va_start>>) rather than
|
||||
directly accepting a variable number of arguments.
|
||||
|
||||
RETURNS
|
||||
The return values are consistent with the corresponding functions:
|
||||
<<viscanf>> returns the number of input fields successfully scanned,
|
||||
converted, and stored; the return value does not include scanned
|
||||
fields which were not stored.
|
||||
|
||||
If <<viscanf>> attempts to read at end-of-file, the return value
|
||||
is <<EOF>>.
|
||||
|
||||
If no fields were stored, the return value is <<0>>.
|
||||
|
||||
The routines <<_viscanf_r>>, <<_vfiscanf_f>>, and <<_vsiscanf_r>> are
|
||||
reentrant versions which take an additional first parameter which points to the
|
||||
reentrancy structure.
|
||||
|
||||
PORTABILITY
|
||||
These are newlib extensions.
|
||||
|
||||
Supporting OS subroutines required:
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#include "local.h"
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
_DEFUN(viscanf, (fmt, ap),
|
||||
_CONST char *fmt _AND
|
||||
va_list ap)
|
||||
{
|
||||
_REENT_SMALL_CHECK_INIT (_stdin_r (_REENT));
|
||||
return __svfiscanf_r (_REENT, _stdin_r (_REENT), fmt, ap);
|
||||
}
|
||||
|
||||
#endif /* !_REENT_ONLY */
|
||||
|
||||
int
|
||||
_DEFUN(_viscanf_r, (ptr, fmt, ap),
|
||||
struct _reent *ptr _AND
|
||||
_CONST char *fmt _AND
|
||||
va_list ap)
|
||||
{
|
||||
_REENT_SMALL_CHECK_INIT (_stdin_r (ptr));
|
||||
return __svfiscanf_r (ptr, _stdin_r (ptr), fmt, ap);
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
/* doc in vfiprintf.c */
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
_DEFUN(vsiprintf, (str, fmt, ap),
|
||||
char *str _AND
|
||||
_CONST char *fmt _AND
|
||||
va_list ap)
|
||||
{
|
||||
int ret;
|
||||
FILE f;
|
||||
|
||||
f._flags = __SWR | __SSTR;
|
||||
f._bf._base = f._p = (unsigned char *) str;
|
||||
f._bf._size = f._w = INT_MAX;
|
||||
f._file = -1; /* No file. */
|
||||
ret = _vfiprintf_r (_REENT, &f, fmt, ap);
|
||||
*f._p = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* !_REENT_ONLY */
|
||||
|
||||
int
|
||||
_DEFUN(_vsiprintf_r, (ptr, str, fmt, ap),
|
||||
struct _reent *ptr _AND
|
||||
char *str _AND
|
||||
_CONST char *fmt _AND
|
||||
va_list ap)
|
||||
{
|
||||
int ret;
|
||||
FILE f;
|
||||
|
||||
f._flags = __SWR | __SSTR;
|
||||
f._bf._base = f._p = (unsigned char *) str;
|
||||
f._bf._size = f._w = INT_MAX;
|
||||
f._file = -1; /* No file. */
|
||||
ret = _vfiprintf_r (ptr, &f, fmt, ap);
|
||||
*f._p = 0;
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Code created by modifying iscanf.c which has following copyright.
|
||||
*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#include "local.h"
|
||||
|
||||
static _READ_WRITE_RETURN_TYPE
|
||||
_DEFUN(eofread1, (cookie, buf, len),
|
||||
_PTR cookie _AND
|
||||
char *buf _AND
|
||||
int len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* vsiscanf
|
||||
*/
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
_DEFUN(vsiscanf, (str, fmt, ap),
|
||||
_CONST char *str _AND
|
||||
_CONST char *fmt _AND
|
||||
va_list ap)
|
||||
{
|
||||
return _vsiscanf_r (_REENT, str, fmt, ap);
|
||||
}
|
||||
|
||||
#endif /* !_REENT_ONLY */
|
||||
|
||||
int
|
||||
_DEFUN(_vsiscanf_r, (ptr, str, fmt, ap),
|
||||
struct _reent *ptr _AND
|
||||
_CONST char *str _AND
|
||||
_CONST char *fmt _AND
|
||||
va_list ap)
|
||||
{
|
||||
FILE f;
|
||||
|
||||
f._flags = __SRD | __SSTR;
|
||||
f._bf._base = f._p = (unsigned char *) str;
|
||||
f._bf._size = f._r = strlen (str);
|
||||
f._read = eofread1;
|
||||
f._ub._base = NULL;
|
||||
f._lb._base = NULL;
|
||||
f._file = -1; /* No file. */
|
||||
return __svfiscanf_r (ptr, &f, fmt, ap);
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
<<vsniprintf>>---write formatted output (integer only)
|
||||
|
||||
INDEX
|
||||
vsniprintf
|
||||
|
||||
ANSI_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
||||
int vsniprintf(char *<[str]>, size_t <[size]>, const char *<[fmt]>, va_list <[list]>);
|
||||
|
||||
TRAD_SYNOPSIS
|
||||
#include <stdio.h>
|
||||
|
||||
int vsnprintf(<[str]>, <[size]>, <[fmt]>, <[list]>)
|
||||
char *<[str]>;
|
||||
size_t <[size]>;
|
||||
char *<[fmt]>;
|
||||
va_list <[list]>;
|
||||
|
||||
DESCRIPTION
|
||||
<<vsniprintf>> is a restricted version of <<vsnprintf>>: it has the same
|
||||
arguments and behavior, save that it cannot perform any floating-point
|
||||
formatting: the <<f>>, <<g>>, <<G>>, <<e>>, and <<F>> type specifiers
|
||||
are not recognized.
|
||||
|
||||
RETURNS
|
||||
<<vsniprintf>> returns the number of bytes in the output string,
|
||||
save that the concluding <<NULL>> is not counted.
|
||||
<<vsniprintf>> returns when the end of the format string is
|
||||
encountered.
|
||||
|
||||
PORTABILITY
|
||||
<<vsniprintf>> is not required by ANSI C.
|
||||
|
||||
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
||||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <reent.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
#ifndef _REENT_ONLY
|
||||
|
||||
int
|
||||
_DEFUN(vsniprintf, (str, size, fmt, ap),
|
||||
char *str _AND
|
||||
size_t size _AND
|
||||
_CONST char *fmt _AND
|
||||
va_list ap)
|
||||
{
|
||||
int ret;
|
||||
FILE f;
|
||||
|
||||
f._flags = __SWR | __SSTR;
|
||||
f._bf._base = f._p = (unsigned char *) str;
|
||||
f._bf._size = f._w = (size > 0 ? size - 1 : 0);
|
||||
f._file = -1; /* No file. */
|
||||
ret = _vfiprintf_r (_REENT, &f, fmt, ap);
|
||||
if (size > 0)
|
||||
*f._p = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* !_REENT_ONLY */
|
||||
|
||||
int
|
||||
_DEFUN(_vsniprintf_r, (ptr, str, size, fmt, ap),
|
||||
struct _reent *ptr _AND
|
||||
char *str _AND
|
||||
size_t size _AND
|
||||
_CONST char *fmt _AND
|
||||
va_list ap)
|
||||
{
|
||||
int ret;
|
||||
FILE f;
|
||||
|
||||
f._flags = __SWR | __SSTR;
|
||||
f._bf._base = f._p = (unsigned char *) str;
|
||||
f._bf._size = f._w = (size > 0 ? size - 1 : 0);
|
||||
f._file = -1; /* No file. */
|
||||
ret = _vfiprintf_r (ptr, &f, fmt, ap);
|
||||
if (size > 0)
|
||||
*f._p = 0;
|
||||
return ret;
|
||||
}
|
Loading…
Reference in New Issue