From bc7186cc312ebf7a7f02e2e3c606d623b34bb8b8 Mon Sep 17 00:00:00 2001 From: John Kohl Date: Wed, 2 May 1990 22:29:22 +0000 Subject: [PATCH] Initial revision git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@687 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/posix/vfprintf.c | 47 +++++++++++++++++++++++++++++++++++ src/lib/krb5/posix/vsprintf.c | 39 +++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 src/lib/krb5/posix/vfprintf.c create mode 100644 src/lib/krb5/posix/vsprintf.c diff --git a/src/lib/krb5/posix/vfprintf.c b/src/lib/krb5/posix/vfprintf.c new file mode 100644 index 000000000..94f0fb582 --- /dev/null +++ b/src/lib/krb5/posix/vfprintf.c @@ -0,0 +1,47 @@ +/* + * Copyright (c) 1988 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 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)vfprintf.c 5.2 (Berkeley) 6/27/88"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include + +int +vfprintf(iop, fmt, ap) + FILE *iop; + char *fmt; + va_list ap; +{ + int len; + char localbuf[BUFSIZ]; + + if (iop->_flag & _IONBF) { + iop->_flag &= ~_IONBF; + iop->_ptr = iop->_base = localbuf; + len = _doprnt(fmt, ap, iop); + (void) fflush(iop); + iop->_flag |= _IONBF; + iop->_base = NULL; + iop->_bufsiz = 0; + iop->_cnt = 0; + } else + len = _doprnt(fmt, ap, iop); + + return (ferror(iop) ? EOF : len); +} diff --git a/src/lib/krb5/posix/vsprintf.c b/src/lib/krb5/posix/vsprintf.c new file mode 100644 index 000000000..7f43f9066 --- /dev/null +++ b/src/lib/krb5/posix/vsprintf.c @@ -0,0 +1,39 @@ +/* + * Copyright (c) 1988 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 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)vsprintf.c 5.2 (Berkeley) 6/27/88"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include + +int +vsprintf(str, fmt, ap) + char *str, *fmt; + va_list ap; +{ + FILE f; + int len; + + f._flag = _IOWRT+_IOSTRG; + f._ptr = str; + f._cnt = 32767; + len = _doprnt(fmt, ap, &f); + *f._ptr = 0; + return (len); +} -- 2.26.2